diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2016-06-02 18:36:21 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2016-06-02 18:36:21 (GMT) |
commit | d3f2fcd53000fc4a09cf56c90930f8c8e2ad02b4 (patch) | |
tree | 2d1fa5fde2c5853ae0bda0e4efe2c77a3f3d2c39 | |
parent | 7c3126407bbb46717a4e0a09b61ee001702af7bf (diff) | |
download | Doxygen-d3f2fcd53000fc4a09cf56c90930f8c8e2ad02b4.zip Doxygen-d3f2fcd53000fc4a09cf56c90930f8c8e2ad02b4.tar.gz Doxygen-d3f2fcd53000fc4a09cf56c90930f8c8e2ad02b4.tar.bz2 |
Adding partial htmlhelp support to template system
-rw-r--r-- | src/template.cpp | 99 | ||||
-rw-r--r-- | templates/html/htmlhelpindexhhc.tpl | 18 | ||||
-rw-r--r-- | templates/html/htmljsnavindex.tpl | 2 | ||||
-rw-r--r-- | templates/html/htmljsnavtree.tpl | 2 | ||||
-rw-r--r-- | templates/html/htmllayout.tpl | 1 |
5 files changed, 101 insertions, 21 deletions
diff --git a/src/template.cpp b/src/template.cpp index 9e814d7..10b3e43 100644 --- a/src/template.cpp +++ b/src/template.cpp @@ -1292,6 +1292,64 @@ class FilterDivisibleBy } }; +//-------------------------------------------------------------------- + +/** @brief The implementation of the "isRelativeURL" filter */ +class FilterIsRelativeURL +{ + public: + static TemplateVariant apply(const TemplateVariant &v,const TemplateVariant &) + { + if (v.isValid() && v.type()==TemplateVariant::String) + { + QCString s = v.toString(); + if (!s.isEmpty() && s.at(0)=='!') return TRUE; + } + return FALSE; + } +}; + +//-------------------------------------------------------------------- + +/** @brief The implementation of the "isRelativeURL" filter */ +class FilterIsAbsoluteURL +{ + public: + static TemplateVariant apply(const TemplateVariant &v,const TemplateVariant &) + { + if (v.isValid() && v.type()==TemplateVariant::String) + { + QCString s = v.toString(); + if (!s.isEmpty() && s.at(0)=='^') return TRUE; + } + return FALSE; + } +}; + +//-------------------------------------------------------------------- + +/** @brief The implementation of the "decodeURL" filter + * The leading character is removed from the value in case it is a ^ or !. + * - ^ is used to encode a absolute URL + * - ! is used to encode a relative URL + */ +class FilterDecodeURL +{ + public: + static TemplateVariant apply(const TemplateVariant &v,const TemplateVariant &) + { + if (v.isValid() && v.type()==TemplateVariant::String) + { + QCString s = v.toString(); + if (!s.isEmpty() && (s.at(0)=='^' || s.at(0)=='!')) + { + return s.mid(1); + } + } + return v; + } +}; + //-------------------------------------------------------------------- @@ -1343,25 +1401,28 @@ class TemplateFilterFactory }; // register a handlers for each filter we support -static TemplateFilterFactory::AutoRegister<FilterAdd> fAdd("add"); -static TemplateFilterFactory::AutoRegister<FilterGet> fGet("get"); -static TemplateFilterFactory::AutoRegister<FilterRaw> fRaw("raw"); -static TemplateFilterFactory::AutoRegister<FilterList> fList("list"); -static TemplateFilterFactory::AutoRegister<FilterAppend> fAppend("append"); -static TemplateFilterFactory::AutoRegister<FilterLength> fLength("length"); -static TemplateFilterFactory::AutoRegister<FilterNoWrap> fNoWrap("nowrap"); -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<FilterTexLabel> fTexLabel("texLabel"); -static TemplateFilterFactory::AutoRegister<FilterTexIndex> fTexIndex("texIndex"); -static TemplateFilterFactory::AutoRegister<FilterPaginate> fPaginate("paginate"); -static TemplateFilterFactory::AutoRegister<FilterStripPath> fStripPath("stripPath"); -static TemplateFilterFactory::AutoRegister<FilterAlphaIndex> fAlphaIndex("alphaIndex"); -static TemplateFilterFactory::AutoRegister<FilterDivisibleBy> fDivisibleBy("divisibleby"); +static TemplateFilterFactory::AutoRegister<FilterAdd> fAdd("add"); +static TemplateFilterFactory::AutoRegister<FilterGet> fGet("get"); +static TemplateFilterFactory::AutoRegister<FilterRaw> fRaw("raw"); +static TemplateFilterFactory::AutoRegister<FilterList> fList("list"); +static TemplateFilterFactory::AutoRegister<FilterAppend> fAppend("append"); +static TemplateFilterFactory::AutoRegister<FilterLength> fLength("length"); +static TemplateFilterFactory::AutoRegister<FilterNoWrap> fNoWrap("nowrap"); +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<FilterTexLabel> fTexLabel("texLabel"); +static TemplateFilterFactory::AutoRegister<FilterTexIndex> fTexIndex("texIndex"); +static TemplateFilterFactory::AutoRegister<FilterPaginate> fPaginate("paginate"); +static TemplateFilterFactory::AutoRegister<FilterStripPath> fStripPath("stripPath"); +static TemplateFilterFactory::AutoRegister<FilterDecodeURL> fDecodeURL("decodeURL"); +static TemplateFilterFactory::AutoRegister<FilterAlphaIndex> fAlphaIndex("alphaIndex"); +static TemplateFilterFactory::AutoRegister<FilterDivisibleBy> fDivisibleBy("divisibleby"); +static TemplateFilterFactory::AutoRegister<FilterIsRelativeURL> fIsRelativeURL("isRelativeURL"); +static TemplateFilterFactory::AutoRegister<FilterIsAbsoluteURL> fIsAbsoluteURL("isAbsoluteURL"); //-------------------------------------------------------------------- diff --git a/templates/html/htmlhelpindexhhc.tpl b/templates/html/htmlhelpindexhhc.tpl new file mode 100644 index 0000000..b5e83de --- /dev/null +++ b/templates/html/htmlhelpindexhhc.tpl @@ -0,0 +1,18 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> +<HTML><HEAD></HEAD><BODY> +<OBJECT type="text/site properties"> +<param name="FrameName" value="right"> +</OBJECT> +<UL> +{% recursetree index.nav %} +<LI><OBJECT type="text/sitemap"><param name="Name" value="{{ node.name }}"> + <param name="{% if node.file|isAbsoluteURL %}URL{% else %}Local{% endif %}" value="{{ node.file|decodeURL }}{{ config.HTML_FILE_EXTENSION }}{% if node.anchor %}#{{ node.anchor }}{% endif %}"> + <param name="ImageNumber" value="1{% if node.is_leaf_node %}1{% endif %}"> + </OBJECT> + {% if not node.is_leaf_node %} + <UL>{{ children }}</UL> + {% endif %} +{% endrecursetree %} +</UL> +</BODY> +</HTML> diff --git a/templates/html/htmljsnavindex.tpl b/templates/html/htmljsnavindex.tpl index 07a9efc..b24b166 100644 --- a/templates/html/htmljsnavindex.tpl +++ b/templates/html/htmljsnavindex.tpl @@ -2,6 +2,6 @@ var NAVTREEINDEX{{ idx }} = { {% for entry in entries %} - "{{ entry.file }}{{ config.HTML_FILE_EXTENSION }}{% if entry.anchor %}#{{ entry.anchor }}{% endif %}":[{% for e in entry.path %}{% if not forloop.first %}{{ e.index }}{% if not forloop.last%},{% endif %}{% endif %}{% endfor %}]{% if not forloop.last %},{%endif %} + "{{ entry.file|decodeURL }}{{ config.HTML_FILE_EXTENSION }}{% if entry.anchor %}#{{ entry.anchor }}{% endif %}":[{% for e in entry.path %}{% if not forloop.first %}{{ e.index }}{% if not forloop.last%},{% endif %}{% endif %}{% endfor %}]{% if not forloop.last %},{%endif %} {% endfor %} }; diff --git a/templates/html/htmljsnavtree.tpl b/templates/html/htmljsnavtree.tpl index 9970161..947b980 100644 --- a/templates/html/htmljsnavtree.tpl +++ b/templates/html/htmljsnavtree.tpl @@ -1,7 +1,7 @@ var NAVTREE = [ {% recursetree index.nav %} - [ "{{ node.name }}", {% if node.file %}"{% if node.isReference %}{{ node.externalReference }}{% endif %}{{ node.file }}{{ config.HTML_FILE_EXTENSION }}{% if node.anchor %}#{{ node.anchor }}{% endif %}"{% else %}null{% endif %},{% if not node.is_leaf_node %} [ + [ "{{ node.name }}", {% if node.file %}"{% if node.isReference %}{{ node.externalReference }}{% endif %}{{ node.file|decodeURL }}{{ config.HTML_FILE_EXTENSION }}{% if node.anchor %}#{{ node.anchor }}{% endif %}"{% else %}null{% endif %},{% if not node.is_leaf_node %} [ {{ children }} ]{% else %} null{% endif %} ]{% if not node.last %},{% endif %} {% endrecursetree %} diff --git a/templates/html/htmllayout.tpl b/templates/html/htmllayout.tpl index 9834f67..a40bdbc 100644 --- a/templates/html/htmllayout.tpl +++ b/templates/html/htmllayout.tpl @@ -270,6 +270,7 @@ {% if config.GENERATE_HTMLHELP %} {% encoding config.CHM_INDEX_ENCODING|default:'CP1250' %} {% create 'index.hhp' from 'htmlhelpindexhhp.tpl' %} + {% create 'index.hhc' from 'htmlhelpindexhhc.tpl' %} {% endencoding %} {% endif %} |