Skip to content

Commit

Permalink
Improved main page rendering via template engine
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimitri van Heesch committed Dec 25, 2014
1 parent 5d266c5 commit f8a8691
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 18 deletions.
10 changes: 7 additions & 3 deletions src/context.cpp
Expand Up @@ -2946,7 +2946,7 @@ class PageContext::Private : public DefinitionContext<PageContext::Private>
}
TemplateVariant relPath() const
{
if (m_pageDef==Doxygen::mainPage)
if (m_isMainPage)
{
return "";
}
Expand All @@ -2957,7 +2957,7 @@ class PageContext::Private : public DefinitionContext<PageContext::Private>
}
TemplateVariant highlight() const
{
if (m_pageDef==Doxygen::mainPage)
if (m_isMainPage)
{
return "main";
}
Expand Down Expand Up @@ -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());
Expand Down
18 changes: 9 additions & 9 deletions 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 ----- #}

Expand Down Expand Up @@ -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 %}
Expand Down Expand Up @@ -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 %}
Expand All @@ -122,6 +120,8 @@
{% endwith %}
{% endfor %}

{# TODO: write example documentation #}

{# ----------- INDEXES ------------ #}

{# --- related pages --- #}
Expand Down Expand Up @@ -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 %}

Expand Down Expand Up @@ -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 %}
42 changes: 42 additions & 0 deletions templates/html/htmlpage.tpl
Expand Up @@ -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 %}
14 changes: 8 additions & 6 deletions templates/html/htmltabs.tpl
Expand Up @@ -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 #}
Expand Down Expand Up @@ -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 #}
Expand Down

0 comments on commit f8a8691

Please sign in to comment.