Skip to content

Commit

Permalink
Expose TOC placeholder in XML output.
Browse files Browse the repository at this point in the history
Currently the XML output for a page was generated the same
independently of whether the \tableofcontents command was present in
the page source or not. Because of that, the users of the XML output
had no chance of knowing whether given page should have a TOC or not.

There's now a new <tableofcontents> element that gets added in case
the TOC was requested. As it is trivial to populate the TOC on user
side by simply enumerating the <sectN> elements, the element is empty
and acts just as a boolean.
  • Loading branch information
mosra committed Nov 29, 2017
1 parent bd2cf98 commit fe76097
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/xmlgen.cpp
Expand Up @@ -1825,6 +1825,10 @@ static void generateXMLForPage(PageDef *pd,FTextStream &ti,bool isExample)
}
}
writeInnerPages(pd->getSubPages(),t);
if(pd->showToc())
{
t << " <tableofcontents/>" << endl;
}
t << " <briefdescription>" << endl;
writeXMLDocBlock(t,pd->briefFile(),pd->briefLine(),pd,0,pd->briefDescription());
t << " </briefdescription>" << endl;
Expand Down
1 change: 1 addition & 0 deletions templates/xml/compound.xsd
Expand Up @@ -29,6 +29,7 @@
<xsd:element name="innergroup" type="refType" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="templateparamlist" type="templateparamlistType" minOccurs="0" />
<xsd:element name="sectiondef" type="sectiondefType" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="tableofcontents" minOccurs="0" maxOccurs="1" />
<xsd:element name="briefdescription" type="descriptionType" minOccurs="0" />
<xsd:element name="detaileddescription" type="descriptionType" minOccurs="0" />
<xsd:element name="inheritancegraph" type="graphType" minOccurs="0" />
Expand Down
1 change: 1 addition & 0 deletions testing/043/mypage.xml
Expand Up @@ -4,6 +4,7 @@
<compoundname>mypage</compoundname>
<title>Page Title</title>
<innerpage refid="another">Another Page</innerpage>
<tableofcontents/>
<briefdescription>
<para>Page brief description. </para>
</briefdescription>
Expand Down
2 changes: 2 additions & 0 deletions testing/043_page.dox
Expand Up @@ -4,6 +4,8 @@
/** \page mypage Page Title
* \brief Page brief description.
*
* @tableofcontents
*
* Text at page level. See \ref mysect for more.
* \section mysect Section Title.
* Text at section level. See \ref mysubsect for more.
Expand Down

0 comments on commit fe76097

Please sign in to comment.