diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2018-07-22 13:34:57 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2018-07-22 13:34:57 (GMT) |
commit | 982fce9e021e5359ec2572cbbb815a47bc822e70 (patch) | |
tree | 24d8fc538734f725ebb718ff720b4e8b61d9720d /src/definition.cpp | |
parent | 5c4ee43f13433a0c1de63805cc139b61e9a4d872 (diff) | |
parent | 956342ae0b2e09f5e398778c255006f9d26e7b52 (diff) | |
download | Doxygen-982fce9e021e5359ec2572cbbb815a47bc822e70.zip Doxygen-982fce9e021e5359ec2572cbbb815a47bc822e70.tar.gz Doxygen-982fce9e021e5359ec2572cbbb815a47bc822e70.tar.bz2 |
Merge branch 'feature/bug_tableofcontents_latex' of https://github.com/albert-github/doxygen into albert-github-feature/bug_tableofcontents_latex
Diffstat (limited to 'src/definition.cpp')
-rw-r--r-- | src/definition.cpp | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/src/definition.cpp b/src/definition.cpp index 92baf0c..f44c403 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -41,6 +41,7 @@ #include "namespacedef.h" #include "filedef.h" #include "dirdef.h" +#include "pagedef.h" #define START_MARKER 0x4445465B // DEF[ #define END_MARKER 0x4445465D // DEF] @@ -1613,10 +1614,13 @@ void Definition::writeNavigationPath(OutputList &ol) const } // TODO: move to htmlgen -void Definition::writeToc(OutputList &ol) +void Definition::writeToc(OutputList &ol, int localToc, int *localTocLevel) { SectionDict *sectionDict = m_impl->sectionDict; if (sectionDict==0) return; + if (PageDef::isLocalToc(localToc, Definition::Html)) + { + int maxLevel = localTocLevel[Definition::Html]; ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); ol.writeString("<div class=\"toc\">"); @@ -1643,42 +1647,59 @@ void Definition::writeToc(OutputList &ol) { for (l=level;l<nextLevel;l++) { - ol.writeString("<ul>"); + if (l < maxLevel) ol.writeString("<ul>"); } } else if (nextLevel<level) { for (l=level;l>nextLevel;l--) { - if (inLi[l]) ol.writeString("</li>\n"); + if (l <= maxLevel && inLi[l]) ol.writeString("</li>\n"); inLi[l]=FALSE; - ol.writeString("</ul>\n"); + if (l <= maxLevel) ol.writeString("</ul>\n"); } } cs[0]='0'+nextLevel; - if (inLi[nextLevel]) ol.writeString("</li>\n"); + if (nextLevel <= maxLevel && inLi[nextLevel]) ol.writeString("</li>\n"); QCString titleDoc = convertToHtml(si->title); - ol.writeString("<li class=\"level"+QCString(cs)+"\"><a href=\"#"+si->label+"\">"+(si->title.isEmpty()?si->label:titleDoc)+"</a>"); + if (nextLevel <= maxLevel) ol.writeString("<li class=\"level"+QCString(cs)+"\"><a href=\"#"+si->label+"\">"+(si->title.isEmpty()?si->label:titleDoc)+"</a>"); inLi[nextLevel]=TRUE; level = nextLevel; } } - while (level>1) + while (level>1 && level <= maxLevel) { if (inLi[level]) ol.writeString("</li>\n"); inLi[level]=FALSE; ol.writeString("</ul>\n"); level--; } - if (inLi[level]) ol.writeString("</li>\n"); + if (level <= maxLevel && inLi[level]) ol.writeString("</li>\n"); inLi[level]=FALSE; ol.writeString("</ul>\n"); ol.writeString("</div>\n"); ol.popGeneratorState(); + } + + if (PageDef::isLocalToc(localToc, Definition::Latex)) + { + char tmp[100]; + ol.pushGeneratorState(); + ol.disableAllBut(OutputGenerator::Latex); + sprintf(tmp,"\\etocsetnexttocdepth{%d}\n",localTocLevel[Definition::Latex]); + ol.writeString(tmp); + + ol.writeString("\\localtableofcontents\n"); + ol.popGeneratorState(); + } } //---------------------------------------------------------------------------------------- +SectionDict * Definition::getSectionDict(void) +{ + return m_impl->sectionDict; +} QCString Definition::symbolName() const { |