Permalink
Browse files

Improved main page rendering via template engine

  • Loading branch information...
Dimitri van Heesch
Dimitri van Heesch committed Nov 22, 2014
1 parent 5d266c5 commit f8a86910e4cd1d98993bd6991eb1b1aff7a86b05
Showing with 66 additions and 18 deletions.
  1. +7 −3 src/context.cpp
  2. +9 −9 templates/html/htmllayout.tpl
  3. +42 −0 templates/html/htmlpage.tpl
  4. +8 −6 templates/html/htmltabs.tpl
View
@@ -2946,7 +2946,7 @@ class PageContext::Private : public DefinitionContext<PageContext::Private>
}
TemplateVariant relPath() const
{
if (m_pageDef==Doxygen::mainPage)
if (m_isMainPage)
{
return "";
}
@@ -2957,7 +2957,7 @@ class PageContext::Private : public DefinitionContext<PageContext::Private>
}
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<PageContext> mainPage(PageContext::alloc(Doxygen::mainPage,TRUE));
ctx->set("mainPage",mainPage.get());
}
//%% GlobalsIndex globalsIndex:
ctx->set("globalsIndex",globalsIndex.get());
@@ -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 %}
@@ -9,6 +9,48 @@
{% block content %}
<div class="contents">
{% if isMainPage and config.DISABLE_INDEX %}
{# no other navigation means, so we produce the links on the main page #}
<ul>
{% if pageTree.tree %}
<li><a href="{{ page.relPath }}pages{{ config.HTML_FILE_EXTENSION }}"><span>{{ tr.pages }}</span></a></li>
{% endif %}
{% if moduleTree.tree %}
<li><a href="{{ page.relPath }}modules{{ config.HTML_FILE_EXTENSION }}"><span>{{ tr.modules }}</span></a></li>
{% endif %}
{% if namespaceList %}
<li><a href="{{ page.relPath }}namespaces{{ config.HTML_FILE_EXTENSION }}"><span>{{ tr.namespaces }}</span></a>
<ul>
<li><a href="{{ page.relPath }}namespaces{{ config.HTML_FILE_EXTENSION }}"><span>{{ tr.namespaceList }} </span></a></li>
<li><a href="{{ page.relPath }}namespacemembers{{ config.HTML_FILE_EXTENSION }}"><span>{{ tr.namespaceMembers }}</span></a></li>
</ul>
</li>
{% endif %}
{% if classList %}
<li><a href="{{ page.relPath }}annotated{{ config.HTML_FILE_EXTENSION }}"><span>{{ tr.classes }}</span></a>
<ul>
<li><a href="{{ page.relPath }}annotated{{ config.HTML_FILE_EXTENSION }}"><span>{{ tr.classList }}</span></a></li>
<li><a href="{{ page.relPath }}classes{{ config.HTML_FILE_EXTENSION }}"><span>{{ tr.classIndex }}</span></a></li>
{% if classHierarchy.tree %}
<li><a href="{{ page.relPath }}hierarchy{{ config.HTML_FILE_EXTENSION }}"><span>{{ tr.classHierarchy }} </span></a></li>
{% endif %}
<li><a href="{{ page.relPath }}functions{{ config.HTML_FILE_EXTENSION }}"><span>{{ tr.classMembers }} </span></a></li>
</ul>
</li>
{% endif %}
{% if fileList %}
<li><a href="{{ page.relPath }}files{{ config.HTML_FILE_EXTENSION }}"><span>{{ tr.files }}</span></a>
<ul>
<li><a href="{{ page.relPath }}files{{ config.HTML_FILE_EXTENSION }}"><span>{{ tr.fileList }} </span></a></li>
<li><a href="{{ page.relPath }}globals{{ config.HTML_FILE_EXTENSION }}"><span>{{ tr.fileMembers }} </span></a></li>
</ul>
</li>
{% endif %}
{% if exampleList.items %}
<li><a href="{{ page.relPath }}examples{{ config.HTML_FILE_EXTENSION }}"><span>{{ tr.examples }}</span></a>
{% endif %}
</ul>
{% endif %}
{{ compound.details }}
</div>
{% endblock %}
@@ -4,27 +4,27 @@
{# main tab #}
<li{% if page.highlight=='main' %} class="current"{% endif %}><a href="{{ page.relPath }}index{{ config.HTML_FILE_EXTENSION }}"><span>{{ tr.mainPage|nowrap }}</span></a></li>
{# pages tab #}
{% if pageTree.tree|length>0 %}
{% if pageTree.tree %}
<li{% if page.highlight=='pages' %} class="current"{% endif %}><a href="{{ page.relPath }}pages{{ config.HTML_FILE_EXTENSION }}"><span>{{ tr.pages|nowrap }}</span></a></li>
{% endif %}
{# modules tab #}
{% if moduleTree.tree|length>0 %}
{% if moduleTree.tree %}
<li{% if page.highlight=='modules' %} class="current"{% endif %}><a href="{{ page.relPath }}modules{{ config.HTML_FILE_EXTENSION }}"><span>{{ tr.modules|nowrap }}</span></a></li>
{% endif %}
{# namespaces tab #}
{% if namespaceList|length>0 %}
{% if namespaceList %}
<li{% if page.highlight=='namespaces' %} class="current"{% endif %}><a href="{{ page.relPath }}namespaces{{ config.HTML_FILE_EXTENSION }}"><span>{{ tr.namespaces|nowrap }}</span></a></li>
{% endif %}
{# classes tab #}
{% if classList|length>0 %}
{% if classList %}
<li{% if page.highlight=='classes' %} class="current"{% endif %}><a href="{{ page.relPath }}annotated{{ config.HTML_FILE_EXTENSION }}"><span>{{ tr.classes|nowrap }}</span></a></li>
{% endif %}
{# files tab #}
{% if fileList|length>0 %}
{% if fileList %}
<li{% if page.highlight=='files' %} class="current"{% endif %}><a href="{{ page.relPath }}files{{ config.HTML_FILE_EXTENSION }}"><span>{{ tr.files|nowrap }}</span></a></li>
{% endif %}
{# examples tab #}
{% if exampleList|length>0 %}
{% if exampleList.items %}
<li{% if page.highlight=='examples' %} class="current"{% endif %}><a href="{{ page.relPath }}examples{{ config.HTML_FILE_EXTENSION }}"><span>{{ tr.examples|nowrap }}</span></a></li>
{% endif %}
{# search box #}
@@ -80,7 +80,9 @@
{% if page.highlight=='classes' %}
<li{% if page.subhighlight=='classlist' %} class="current"{% endif %}><a href="{{ page.relPath }}annotated{{ config.HTML_FILE_EXTENSION }}"><span>{{ tr.classList|nowrap }}</span></a></li>
<li{% if page.subhighlight=='classindex' %} class="current"{% endif %}><a href="{{ page.relPath }}classes{{ config.HTML_FILE_EXTENSION }}"><span>{{ tr.classIndex|nowrap }}</span></a></li>
{% if classHierarchy.tree %}
<li{% if page.subhighlight=='classhierarchy' %} class="current"{% endif %}><a href="{{ page.relPath }}hierarchy{{ config.HTML_FILE_EXTENSION }}"><span>{{ tr.classHierarchy|nowrap }}</span></a></li>
{% endif %}
<li{% if page.subhighlight=='classmembers' %} class="current"{% endif %}><a href="{{ page.relPath }}functions{{ config.HTML_FILE_EXTENSION }}"><span>{{ tr.classMembers|nowrap }}</span></a></li>
{% endif %}
{# file subtabs #}

0 comments on commit f8a8691

Please sign in to comment.