From f8a86910e4cd1d98993bd6991eb1b1aff7a86b05 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sat, 22 Nov 2014 10:51:58 +0100 Subject: Improved main page rendering via template engine --- src/context.cpp | 10 +++++++--- templates/html/htmllayout.tpl | 18 +++++++++--------- templates/html/htmlpage.tpl | 42 ++++++++++++++++++++++++++++++++++++++++++ templates/html/htmltabs.tpl | 14 ++++++++------ 4 files changed, 66 insertions(+), 18 deletions(-) diff --git a/src/context.cpp b/src/context.cpp index ec68e5e..06bc14c 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -2946,7 +2946,7 @@ class PageContext::Private : public DefinitionContext } TemplateVariant relPath() const { - if (m_pageDef==Doxygen::mainPage) + if (m_isMainPage) { return ""; } @@ -2957,7 +2957,7 @@ class PageContext::Private : public DefinitionContext } TemplateVariant highlight() const { - if (m_pageDef==Doxygen::mainPage) + if (m_isMainPage) { return "main"; } @@ -8197,7 +8197,11 @@ void generateOutputViaTemplate() } else { - ctx->set("mainPage",FALSE); + // TODO: for LaTeX output index should be main... => solve in template + Doxygen::mainPage = new PageDef("[generated]",1,"index","",theTranslator->trMainPage()); + Doxygen::mainPage->setFileName("index",TRUE); + SharedPtr mainPage(PageContext::alloc(Doxygen::mainPage,TRUE)); + ctx->set("mainPage",mainPage.get()); } //%% GlobalsIndex globalsIndex: ctx->set("globalsIndex",globalsIndex.get()); diff --git a/templates/html/htmllayout.tpl b/templates/html/htmllayout.tpl index ff99fa5..ffcd318 100644 --- a/templates/html/htmllayout.tpl +++ b/templates/html/htmllayout.tpl @@ -1,4 +1,4 @@ -{% msg %}----- Start generating HTML output for from template ----{% endmsg %} +{% msg %}----- Start generating HTML output for {{ config.PROJECT_NAME }} from template ----{% endmsg %} {# ---- copy fixed resources to the output ----- #} @@ -67,11 +67,9 @@ {# ----------- HTML DOCUMENTATION PAGES ------------ #} {# write main page documentation #} -{% if mainPage %} - {% with page=mainPage compound=mainPage %} - {% create mainPage.fileName|append:config.HTML_FILE_EXTENSION from 'htmlpage.tpl' %} - {% endwith %} -{% endif %} +{% with page=mainPage compound=mainPage isMainPage=True %} + {% create mainPage.fileName|append:config.HTML_FILE_EXTENSION from 'htmlpage.tpl' %} +{% endwith %} {# write namespace documentation pages #} {% for compound in namespaceList %} @@ -110,7 +108,7 @@ {# write related page documentation #} {% for compound in pageList %} - {% with page=compound %} + {% with page=compound isMainPage=False %} {% create compound.fileName|append:config.HTML_FILE_EXTENSION from 'htmlpage.tpl' %} {% endwith %} {% endfor %} @@ -122,6 +120,8 @@ {% endwith %} {% endfor %} +{# TODO: write example documentation #} + {# ----------- INDEXES ------------ #} {# --- related pages --- #} @@ -179,7 +179,7 @@ {# TODO: write the class inheritance hierarchy #} {% if classHierarchy.tree %} {% with page=classHierarchy %} - {% create classHierarchy.fileName|append:config.HTML_FILE_EXTENSION from 'hierarchy.tpl' %} + {# {% create classHierarchy.fileName|append:config.HTML_FILE_EXTENSION from 'hierarchy.tpl' %} #} {% endwith %} {% endif %} @@ -229,4 +229,4 @@ {% create 'navtreedata.js' from 'htmljsnavtree.tpl' %} {% endif %} -{% msg %}----- End generating HTML output for from template ----{% endmsg %} +{% msg %}----- End generating HTML output for {{ config.PROJECT_NAME }} from template ----{% endmsg %} diff --git a/templates/html/htmlpage.tpl b/templates/html/htmlpage.tpl index 1e6a5b1..e703513 100644 --- a/templates/html/htmlpage.tpl +++ b/templates/html/htmlpage.tpl @@ -9,6 +9,48 @@ {% block content %}
+{% if isMainPage and config.DISABLE_INDEX %} +{# no other navigation means, so we produce the links on the main page #} + +{% endif %} {{ compound.details }}
{% endblock %} diff --git a/templates/html/htmltabs.tpl b/templates/html/htmltabs.tpl index 90c62b4..3119eb6 100644 --- a/templates/html/htmltabs.tpl +++ b/templates/html/htmltabs.tpl @@ -4,27 +4,27 @@ {# main tab #} {{ tr.mainPage|nowrap }} {# pages tab #} - {% if pageTree.tree|length>0 %} + {% if pageTree.tree %} {{ tr.pages|nowrap }} {% endif %} {# modules tab #} - {% if moduleTree.tree|length>0 %} + {% if moduleTree.tree %} {{ tr.modules|nowrap }} {% endif %} {# namespaces tab #} - {% if namespaceList|length>0 %} + {% if namespaceList %} {{ tr.namespaces|nowrap }} {% endif %} {# classes tab #} - {% if classList|length>0 %} + {% if classList %} {{ tr.classes|nowrap }} {% endif %} {# files tab #} - {% if fileList|length>0 %} + {% if fileList %} {{ tr.files|nowrap }} {% endif %} {# examples tab #} - {% if exampleList|length>0 %} + {% if exampleList.items %} {{ tr.examples|nowrap }} {% endif %} {# search box #} @@ -80,7 +80,9 @@ {% if page.highlight=='classes' %} {{ tr.classList|nowrap }} {{ tr.classIndex|nowrap }} + {% if classHierarchy.tree %} {{ tr.classHierarchy|nowrap }} + {% endif %} {{ tr.classMembers|nowrap }} {% endif %} {# file subtabs #} -- cgit v0.12