42#include <wx/xml/xml.h>
43#include <wx/filename.h>
45#include "Configuration.h"
47#include <unordered_map>
62 typedef std::unordered_map <wxString, wxString, wxStringHash> HelpFileAnchors;
63 HelpFileAnchors GetHelpfileAnchors();
64 void FindMaximaHtmlDir(
const wxString &docDir);
65 wxString GetHelpfileAnchorName(wxString keyword);
66 wxString GetHelpfileUrl_Singlepage(
const wxString &keyword);
67 wxString GetHelpfileUrl_FilePerChapter(
const wxString &keyword);
68 wxString GetHelpfileURL(
const wxString &keyword);
73 const wxString &maximaHtmlDir,
74 const wxString &maximaVersion,
75 const wxString &saveName);
84 const wxString &maximaVersion,
85 const wxString &saveName);
89 static void AnchorAliasses(HelpFileAnchors &anchors);
91 class GetHTMLFiles :
public wxDirTraverser
94 explicit GetHTMLFiles(std::vector<wxString>& files,
95 stop_token stopToken = {},
96 const wxString &prefix = wxEmptyString) :
97 m_files(files), m_stopToken(stopToken), m_prefix(prefix) { }
98 virtual wxDirTraverseResult OnFile(
const wxString& filename)
override;
99 virtual wxDirTraverseResult OnDir(
const wxString& dirname)
override;
100 std::vector<wxString>& GetResult()
const {
return m_files;}
102 std::vector<wxString>& m_files;
103 stop_token m_stopToken;
106 class GetHTMLFiles_Recursive :
public wxDirTraverser
109 explicit GetHTMLFiles_Recursive(std::vector<wxString>& files,
110 stop_token stopToken = {},
111 const wxString &prefix = wxEmptyString) :
112 m_files(files), m_stopToken(stopToken), m_prefix(prefix) { }
113 virtual wxDirTraverseResult OnFile(
const wxString& filename)
override;
114 virtual wxDirTraverseResult OnDir(
const wxString& dirname)
override;
115 std::vector<wxString>& GetResult()
const {
return m_files;}
117 std::vector<wxString>& m_files;
118 stop_token m_stopToken;
125 jthread m_helpfileanchorsThread;
126 std::mutex m_helpFileAnchorsLock;
131 HelpFileAnchors m_helpFileURLs_singlePage;
133 HelpFileAnchors m_helpFileURLs_filePerChapter;
135 HelpFileAnchors m_helpFileAnchors;
136 wxString m_maximaHtmlDir;
137 wxString m_maximaVersion;
The configuration storage for the current worksheet.
Definition: Configuration.h:86
Definition: MaximaManual.h:59
bool LoadManualAnchorsFromCache()
Load the result from the last CompileHelpFileAnchors from the disk cache.
Definition: MaximaManual.cpp:97
void LoadHelpFileAnchors(const wxString &docdir, const wxString &maximaVersion)
Search maxima's help file for command and variable names.
Definition: MaximaManual.cpp:525
void SaveManualAnchorsToCache(const wxString &maximaHtmlDir, const wxString &maximaVersion, const wxString &saveName)
Save the list of help file anchors to the cache.
Definition: MaximaManual.cpp:311
bool LoadManualAnchorsFromXML(const wxXmlDocument &xmlDocument, bool checkManualVersion=true)
Load the help file anchors from an wxXmlDocument.
Definition: MaximaManual.cpp:378
bool LoadBuiltInManualAnchors()
Load the help file anchors from the built-in list.
Definition: MaximaManual.cpp:86
void CompileHelpFileAnchors(stop_token stopToken, const wxString &maximaHtmlDir, const wxString &maximaVersion, const wxString &saveName)
Collect all keyword anchors in the help file.
Definition: MaximaManual.cpp:145