Commit f8a86910 authored by Dimitri van Heesch's avatar Dimitri van Heesch

Improved main page rendering via template engine

parent 5d266c5d
...@@ -2946,7 +2946,7 @@ class PageContext::Private : public DefinitionContext<PageContext::Private> ...@@ -2946,7 +2946,7 @@ class PageContext::Private : public DefinitionContext<PageContext::Private>
} }
TemplateVariant relPath() const TemplateVariant relPath() const
{ {
if (m_pageDef==Doxygen::mainPage) if (m_isMainPage)
{ {
return ""; return "";
} }
...@@ -2957,7 +2957,7 @@ class PageContext::Private : public DefinitionContext<PageContext::Private> ...@@ -2957,7 +2957,7 @@ class PageContext::Private : public DefinitionContext<PageContext::Private>
} }
TemplateVariant highlight() const TemplateVariant highlight() const
{ {
if (m_pageDef==Doxygen::mainPage) if (m_isMainPage)
{ {
return "main"; return "main";
} }
...@@ -8197,7 +8197,11 @@ void generateOutputViaTemplate() ...@@ -8197,7 +8197,11 @@ void generateOutputViaTemplate()
} }
else 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: //%% GlobalsIndex globalsIndex:
ctx->set("globalsIndex",globalsIndex.get()); ctx->set("globalsIndex",globalsIndex.get());
......
{% 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 ----- #} {# ---- copy fixed resources to the output ----- #}
...@@ -67,11 +67,9 @@ ...@@ -67,11 +67,9 @@
{# ----------- HTML DOCUMENTATION PAGES ------------ #} {# ----------- HTML DOCUMENTATION PAGES ------------ #}
{# write main page documentation #} {# write main page documentation #}
{% if mainPage %} {% with page=mainPage compound=mainPage isMainPage=True %}
{% with page=mainPage compound=mainPage %} {% create mainPage.fileName|append:config.HTML_FILE_EXTENSION from 'htmlpage.tpl' %}
{% create mainPage.fileName|append:config.HTML_FILE_EXTENSION from 'htmlpage.tpl' %} {% endwith %}
{% endwith %}
{% endif %}
{# write namespace documentation pages #} {# write namespace documentation pages #}
{% for compound in namespaceList %} {% for compound in namespaceList %}
...@@ -110,7 +108,7 @@ ...@@ -110,7 +108,7 @@
{# write related page documentation #} {# write related page documentation #}
{% for compound in pageList %} {% for compound in pageList %}
{% with page=compound %} {% with page=compound isMainPage=False %}
{% create compound.fileName|append:config.HTML_FILE_EXTENSION from 'htmlpage.tpl' %} {% create compound.fileName|append:config.HTML_FILE_EXTENSION from 'htmlpage.tpl' %}
{% endwith %} {% endwith %}
{% endfor %} {% endfor %}
...@@ -122,6 +120,8 @@ ...@@ -122,6 +120,8 @@
{% endwith %} {% endwith %}
{% endfor %} {% endfor %}
{# TODO: write example documentation #}
{# ----------- INDEXES ------------ #} {# ----------- INDEXES ------------ #}
{# --- related pages --- #} {# --- related pages --- #}
...@@ -179,7 +179,7 @@ ...@@ -179,7 +179,7 @@
{# TODO: write the class inheritance hierarchy #} {# TODO: write the class inheritance hierarchy #}
{% if classHierarchy.tree %} {% if classHierarchy.tree %}
{% with page=classHierarchy %} {% 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 %} {% endwith %}
{% endif %} {% endif %}
...@@ -229,4 +229,4 @@ ...@@ -229,4 +229,4 @@
{% create 'navtreedata.js' from 'htmljsnavtree.tpl' %} {% create 'navtreedata.js' from 'htmljsnavtree.tpl' %}
{% endif %} {% 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 @@ ...@@ -9,6 +9,48 @@
{% block content %} {% block content %}
<div class="contents"> <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 }} {{ compound.details }}
</div> </div>
{% endblock %} {% endblock %}
...@@ -4,27 +4,27 @@ ...@@ -4,27 +4,27 @@
{# main tab #} {# 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> <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 #} {# 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> <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 %} {% endif %}
{# modules tab #} {# 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> <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 %} {% endif %}
{# namespaces tab #} {# 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> <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 %} {% endif %}
{# classes tab #} {# 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> <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 %} {% endif %}
{# files tab #} {# 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> <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 %} {% endif %}
{# examples tab #} {# 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> <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 %} {% endif %}
{# search box #} {# search box #}
...@@ -80,7 +80,9 @@ ...@@ -80,7 +80,9 @@
{% if page.highlight=='classes' %} {% 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=='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> <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> <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> <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 %} {% endif %}
{# file subtabs #} {# file subtabs #}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment