summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2015-01-01 09:13:04 (GMT)
committerDimitri van Heesch <dimitri@stack.nl>2015-08-27 13:43:31 (GMT)
commit56987af3987f40ac77e70cd39ebbdac3702c1ce2 (patch)
tree441fe1be085e1e83c4a08f3e7ad2ab8681fec045 /src
parentf16c156065ac8bc6242870c2ae701252b5d4f9b2 (diff)
downloadDoxygen-56987af3987f40ac77e70cd39ebbdac3702c1ce2.zip
Doxygen-56987af3987f40ac77e70cd39ebbdac3702c1ce2.tar.gz
Doxygen-56987af3987f40ac77e70cd39ebbdac3702c1ce2.tar.bz2
Add mathjax support to template & context.
Diffstat (limited to 'src')
-rw-r--r--src/config.l6
-rw-r--r--src/context.cpp13
-rw-r--r--src/htmlgen.cpp6
-rw-r--r--src/template.cpp20
4 files changed, 40 insertions, 5 deletions
diff --git a/src/config.l b/src/config.l
index 1bbe320..b158e5c 100644
--- a/src/config.l
+++ b/src/config.l
@@ -1198,6 +1198,12 @@ void Config::check()
exit(1);
}
}
+ QCString &path = Config_getString("MATHJAX_RELPATH");
+ if (!path.isEmpty() && path.at(path.length()-1)!='/')
+ {
+ path+="/";
+ }
+
}
// Test to see if LaTeX header is valid
diff --git a/src/context.cpp b/src/context.cpp
index 17229f7..f7e6ae2 100644
--- a/src/context.cpp
+++ b/src/context.cpp
@@ -370,13 +370,26 @@ class DoxygenContext::Private : public PropertyMapper
{
return TemplateVariant(dateToString(TRUE));
}
+ TemplateVariant maxJaxCodeFile() const
+ {
+ return m_cache.maxJaxCodeFile;
+ }
Private()
{
//%% string version
addProperty("version",this,&Private::version); //makeProperty(this,&Private::version));
//%% string date
addProperty("date", this,&Private::date);
+ //%% string
+ addProperty("mathJaxCodeFile", this,&Private::maxJaxCodeFile);
}
+ private:
+ struct Cachable
+ {
+ Cachable() { maxJaxCodeFile=fileToString(Config_getString("MATHJAX_CODEFILE")); }
+ QCString maxJaxCodeFile;
+ };
+ mutable Cachable m_cache;
};
//%% }
diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp
index e6431e8..7908393 100644
--- a/src/htmlgen.cpp
+++ b/src/htmlgen.cpp
@@ -333,10 +333,6 @@ static QCString substituteHtmlKeywords(const QCString &s,
if (mathJax)
{
QCString path = Config_getString("MATHJAX_RELPATH");
- if (!path.isEmpty() && path.at(path.length()-1)!='/')
- {
- path+="/";
- }
if (path.isEmpty() || path.left(2)=="..") // relative path
{
path.prepend(relPath);
@@ -364,7 +360,7 @@ static QCString substituteHtmlKeywords(const QCString &s,
mathJaxJs += "\n";
}
mathJaxJs += "</script>";
- mathJaxJs += "<script src=\"" + path + "MathJax.js\"></script>\n";
+ mathJaxJs += "<script type=\"text/javascript\" src=\"" + path + "MathJax.js\"></script>\n";
}
// first substitute generic keywords
diff --git a/src/template.cpp b/src/template.cpp
index ce9493b..e81ed17 100644
--- a/src/template.cpp
+++ b/src/template.cpp
@@ -1116,6 +1116,25 @@ class FilterGroupBy
//--------------------------------------------------------------------
+/** @brief The implementation of the "relative" filter */
+class FilterRelative
+{
+ public:
+ static TemplateVariant apply(const TemplateVariant &v,const TemplateVariant &)
+ {
+ if (v.isValid() && v.type()==TemplateVariant::String && v.toString().left(2)=="..")
+ {
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
+ }
+};
+
+//--------------------------------------------------------------------
+
/** @brief The implementation of the "paginate" filter */
class FilterPaginate
{
@@ -1416,6 +1435,7 @@ static TemplateFilterFactory::AutoRegister<FilterFlatten> fFlatten("flatten"
static TemplateFilterFactory::AutoRegister<FilterDefault> fDefault("default");
static TemplateFilterFactory::AutoRegister<FilterPrepend> fPrepend("prepend");
static TemplateFilterFactory::AutoRegister<FilterGroupBy> fGroupBy("groupBy");
+static TemplateFilterFactory::AutoRegister<FilterRelative> fRelative("relative");
static TemplateFilterFactory::AutoRegister<FilterListSort> fListSort("listsort");
static TemplateFilterFactory::AutoRegister<FilterPaginate> fPaginate("paginate");
static TemplateFilterFactory::AutoRegister<FilterStripPath> fStripPath("stripPath");