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 &maximaVersion,
74 const wxString &saveName);
83 const wxString &maximaVersion,
84 const wxString &saveName);
87 std::atomic_bool m_abortBackgroundTask;
89 static void AnchorAliasses(HelpFileAnchors &anchors);
91 class GetHTMLFiles :
public wxDirTraverser
94 explicit GetHTMLFiles(std::vector<wxString>& files,
const wxString &prefix = wxEmptyString) :
95 m_files(files), m_prefix(prefix) { }
96 virtual wxDirTraverseResult OnFile(
const wxString& filename)
override;
97 virtual wxDirTraverseResult OnDir(
const wxString& dirname)
override;
98 std::vector<wxString>& GetResult()
const {
return m_files;}
100 std::vector<wxString>& m_files;
103 class GetHTMLFiles_Recursive :
public wxDirTraverser
106 explicit GetHTMLFiles_Recursive(std::vector<wxString>& files,
107 const wxString &prefix = wxEmptyString) :
108 m_files(files), m_prefix(prefix) { }
109 virtual wxDirTraverseResult OnFile(
const wxString& filename)
override;
110 virtual wxDirTraverseResult OnDir(
const wxString& dirname)
override;
111 std::vector<wxString>& GetResult()
const {
return m_files;}
113 std::vector<wxString>& m_files;
120 jthread m_helpfileanchorsThread;
121 std::mutex m_helpFileAnchorsLock;
126 HelpFileAnchors m_helpFileURLs_singlePage;
128 HelpFileAnchors m_helpFileURLs_filePerChapter;
130 HelpFileAnchors m_helpFileAnchors;
131 wxString m_maximaHtmlDir;
132 wxString m_maximaVersion;
The configuration storage for the current worksheet.
Definition: Configuration.h:85
Definition: MaximaManual.h:59
bool LoadManualAnchorsFromCache()
Load the result from the last CompileHelpFileAnchors from the disk cache.
Definition: MaximaManual.cpp:99
void LoadHelpFileAnchors(const wxString &docdir, const wxString &maximaVersion)
Search maxima's help file for command and variable names.
Definition: MaximaManual.cpp:524
void SaveManualAnchorsToCache(const wxString &maximaHtmlDir, const wxString &maximaVersion, const wxString &saveName)
Save the list of help file anchors to the cache.
Definition: MaximaManual.cpp:310
void CompileHelpFileAnchors(const wxString &maximaHtmlDir, const wxString &maximaVersion, const wxString &saveName)
Collect all keyword anchors in the help file.
Definition: MaximaManual.cpp:148
bool LoadManualAnchorsFromXML(const wxXmlDocument &xmlDocument, bool checkManualVersion=true)
Load the help file anchors from an wxXmlDocument.
Definition: MaximaManual.cpp:377
bool LoadBuiltInManualAnchors()
Load the help file anchors from the built-in list.
Definition: MaximaManual.cpp:88