diff options
author | albert-github <albert.tests@gmail.com> | 2018-07-12 12:15:33 (GMT) |
---|---|---|
committer | albert-github <albert.tests@gmail.com> | 2018-07-12 12:15:33 (GMT) |
commit | 5b735d5118581e3bca686f79de341b8b2e76691f (patch) | |
tree | 4448208ebb60ef4fdc3a41b83774565d532ab1c0 /src/xmlgen.cpp | |
parent | ba30b13cfd4910a5913f080a039fc429ec8a7e3f (diff) | |
download | Doxygen-5b735d5118581e3bca686f79de341b8b2e76691f.zip Doxygen-5b735d5118581e3bca686f79de341b8b2e76691f.tar.gz Doxygen-5b735d5118581e3bca686f79de341b8b2e76691f.tar.bz2 |
Enable in page table of contents for XML and add maximum level to in page table of contents
- add the in page table of contents for XML
- add the possibility to have maximum levels in the in page table of contents (possible per output type and per in page table of contents. Default is show all)
Diffstat (limited to 'src/xmlgen.cpp')
-rw-r--r-- | src/xmlgen.cpp | 59 |
1 files changed, 56 insertions, 3 deletions
diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp index 63fc8ad..02756d3 100644 --- a/src/xmlgen.cpp +++ b/src/xmlgen.cpp @@ -1838,9 +1838,62 @@ static void generateXMLForPage(PageDef *pd,FTextStream &ti,bool isExample) } } writeInnerPages(pd->getSubPages(),t); - if(pd->showToc()) - { - t << " <tableofcontents/>" << endl; + if (PageDef::isLocalToc(pd->showToc(), Definition::Xml)) + { + t << " <tableofcontents>" << endl; + SectionDict *sectionDict = pd->getSectionDict(); + SDict<SectionInfo>::Iterator li(*sectionDict); + SectionInfo *si; + int level=1,l; + bool inLi[5]={ FALSE, FALSE, FALSE, FALSE }; + int maxLevel = (pd -> showTocLevel())[Definition::Xml]; + for (li.toFirst();(si=li.current());++li) + { + if (si->type==SectionInfo::Section || + si->type==SectionInfo::Subsection || + si->type==SectionInfo::Subsubsection || + si->type==SectionInfo::Paragraph) + { + //printf(" level=%d title=%s\n",level,si->title.data()); + int nextLevel = (int)si->type; + if (nextLevel>level) + { + for (l=level;l<nextLevel;l++) + { + if (l < maxLevel) t << " <tableofcontents>" << endl; + } + } + else if (nextLevel<level) + { + for (l=level;l>nextLevel;l--) + { + if (l <= maxLevel && inLi[l]) t << " </tocsect>" << endl; + inLi[l]=FALSE; + if (l <= maxLevel) t << " </tableofcontents>" << endl; + } + } + if (l <= maxLevel && inLi[nextLevel]) t << " </tocsect>" << endl; + if (nextLevel <= maxLevel) + { + QCString titleDoc = convertToXML(si->title); + t << " <tocsect>" << endl; + t << " <name>" << (si->title.isEmpty()?si->label:titleDoc) << "</name>" << endl; + t << " <reference>" << convertToXML(pageName) << "_1" << convertToXML(si -> label) << "</reference>" << endl; + } + inLi[nextLevel]=TRUE; + level = nextLevel; + } + } + while (level>1 && level <= maxLevel) + { + if (inLi[level]) t << " </tocsect>" << endl; + inLi[level]=FALSE; + t << " </tableofcontents>" << endl; + level--; + } + if (level <= maxLevel && inLi[level]) t << " </tocsect>" << endl; + inLi[level]=FALSE; + t << " </tableofcontents>" << endl; } t << " <briefdescription>" << endl; writeXMLDocBlock(t,pd->briefFile(),pd->briefLine(),pd,0,pd->briefDescription()); |