Skip to content

Commit

Permalink
bug_711041 Undocumented "enum" values in TOC of qhp files causes tag-…
Browse files Browse the repository at this point in the history
…mismatch and corrupt TOC.

The problem regarding the extra `</section> in the case of a `user` section in the doxyfile coul dbe solved by means of better calculating the "diff", though this lead to bad index sequences in the qhp navtree.
To solve the bad tree entries, for the enum values, a function `closeContentsItem` is introduced.
(in `layout_default.xml` some white space at the end of the line is removed.)
  • Loading branch information
albert-github committed Jan 13, 2022
1 parent 0eaf320 commit 909c0d2
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 13 deletions.
1 change: 1 addition & 0 deletions src/docsets.h
Expand Up @@ -48,6 +48,7 @@ class DocSets : public IndexIntf
bool addToNavIndex,
const Definition *def
);
void closeContentsItem() {}
void addIndexItem(const Definition *context,const MemberDef *md,
const QCString &sectionAnchor,const QCString &title);
void addIndexFile(const QCString &name);
Expand Down
1 change: 1 addition & 0 deletions src/eclipsehelp.h
Expand Up @@ -51,6 +51,7 @@ class EclipseHelp : public IndexIntf
virtual void addContentsItem(bool isDir, const QCString &name, const QCString &ref,
const QCString &file, const QCString &anchor,bool separateIndex,bool addToNavIndex,
const Definition *def);
virtual void closeContentsItem() {}
virtual void addIndexItem(const Definition *context,const MemberDef *md,
const QCString &sectionAnchor,const QCString &title);
virtual void addIndexFile(const QCString &name);
Expand Down
1 change: 1 addition & 0 deletions src/ftvhelp.h
Expand Up @@ -50,6 +50,7 @@ class FTVHelp : public IndexIntf
bool separateIndex,
bool addToNavIndex,
const Definition *def);
void closeContentsItem() {}
void addIndexItem(const Definition *,const MemberDef *,const QCString &,const QCString &) {}
void addIndexFile(const QCString &) {}
void addImageFile(const QCString &) {}
Expand Down
1 change: 1 addition & 0 deletions src/htmlhelp.h
Expand Up @@ -73,6 +73,7 @@ class HtmlHelp : public IndexIntf
bool separateIndex,
bool addToNavIndex,
const Definition *def);
void closeContentsItem() {}
void addIndexItem(const Definition *context,const MemberDef *md,
const QCString &sectionAnchor, const QCString &title);
void addIndexFile(const QCString &name);
Expand Down
4 changes: 4 additions & 0 deletions src/index.cpp
Expand Up @@ -3834,6 +3834,10 @@ static void writeGroupTreeNode(OutputList &ol, const GroupDef *gd, int level, FT
}
Doxygen::indexList->decContentsDepth();
}
if (md->isVisible() && !md->isAnonymous())
{
Doxygen::indexList->closeContentsItem();
}
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/index.h
Expand Up @@ -40,6 +40,7 @@ class IndexIntf
virtual void addContentsItem(bool isDir, const QCString &name, const QCString &ref,
const QCString &file, const QCString &anchor, bool separateIndex,
bool addToNavIndex,const Definition *def) = 0;
virtual void closeContentsItem() = 0;
virtual void addIndexItem(const Definition *context,const MemberDef *md,
const QCString &sectionAnchor,const QCString &title) = 0;
virtual void addIndexFile(const QCString &name) = 0;
Expand Down Expand Up @@ -98,6 +99,8 @@ class IndexList : public IndexIntf
const QCString &file, const QCString &anchor,bool separateIndex=FALSE,bool addToNavIndex=FALSE,
const Definition *def=0)
{ if (m_enabled) foreach(&IndexIntf::addContentsItem,isDir,name,ref,file,anchor,separateIndex,addToNavIndex,def); }
void closeContentsItem()
{ if (m_enabled) foreach(&IndexIntf::closeContentsItem); }
void addIndexItem(const Definition *context,const MemberDef *md,const QCString &sectionAnchor=QCString(),const QCString &title=QCString())
{ if (m_enabled) foreach(&IndexIntf::addIndexItem,context,md,sectionAnchor,title); }
void addIndexFile(const QCString &name)
Expand Down
4 changes: 3 additions & 1 deletion src/markdown.cpp
Expand Up @@ -3540,7 +3540,9 @@ void MarkdownOutlineParser::parseInput(const QCString &fileName,
docs = docs.left(labelStartPos)+ // part before label
newLabel+ // new label
docs.mid(labelEndPos,lineLen-labelEndPos-1)+ // part between orgLabel and \n
"\\ilinebr @anchor "+orgLabel+"\n"+ // add original anchor
"\\ilinebr @ianchor "+orgLabel+ // add original anchor
docs.mid(labelEndPos,lineLen-labelEndPos-1)+ // part between orgLabel and \n
"\n"+
docs.right(docs.length()-match.length()); // add remainder of docs
}
}
Expand Down
15 changes: 8 additions & 7 deletions src/qhp.cpp
Expand Up @@ -193,6 +193,12 @@ void Qhp::decContentsDepth()
m_sectionLevel--;
}

void Qhp::closeContentsItem()
{
handlePrevSection();
m_toc.close("section");
m_openCount--;
}
void Qhp::addContentsItem(bool /*isDir*/, const QCString & name,
const QCString & /*ref*/, const QCString & file,
const QCString &anchor, bool /* separateIndex */,
Expand All @@ -205,7 +211,7 @@ void Qhp::addContentsItem(bool /*isDir*/, const QCString & name,
QCString f = file;
if (!f.isEmpty() && f.at(0)=='^') return; // absolute URL not supported

int diff = m_prevSectionLevel - m_sectionLevel;
int diff = m_prevSectionLevel - m_sectionLevel - 1;

handlePrevSection();
setPrevSection(name, f, anchor, m_sectionLevel);
Expand Down Expand Up @@ -310,13 +316,8 @@ void Qhp::handlePrevSection()
</toc>
*/

if (m_prevSectionTitle.isNull())
{
m_prevSectionTitle=" "; // should not happen...
}

// We skip "Main Page" as our extra root is pointing to that
if (!((m_prevSectionLevel==1) && (m_prevSectionTitle==getFullProjectName())))
if (!((m_prevSectionLevel==1) && (m_prevSectionTitle==getFullProjectName())) && !m_prevSectionTitle.isNull())
{
QCString finalRef = makeRef(m_prevSectionBaseName, m_prevSectionAnchor);

Expand Down
1 change: 1 addition & 0 deletions src/qhp.h
Expand Up @@ -37,6 +37,7 @@ class Qhp : public IndexIntf
const Definition *def);
void addIndexItem(const Definition *context, const MemberDef *md,
const QCString &sectionAnchor, const QCString &title);
void closeContentsItem();
void addIndexFile(const QCString & name);
void addImageFile(const QCString & name);
void addStyleSheetFile(const QCString & name);
Expand Down
10 changes: 5 additions & 5 deletions templates/general/layout_default.xml
Expand Up @@ -13,29 +13,29 @@
</tab>
<tab type="interfaces" visible="yes" title="">
<tab type="interfacelist" visible="yes" title="" intro=""/>
<tab type="interfaceindex" visible="$ALPHABETICAL_INDEX" title=""/>
<tab type="interfaceindex" visible="$ALPHABETICAL_INDEX" title=""/>
<tab type="interfacehierarchy" visible="yes" title="" intro=""/>
</tab>
<tab type="classes" visible="yes" title="">
<tab type="classlist" visible="yes" title="" intro=""/>
<tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/>
<tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/>
<tab type="hierarchy" visible="yes" title="" intro=""/>
<tab type="classmembers" visible="yes" title="" intro=""/>
</tab>
<tab type="structs" visible="yes" title="">
<tab type="structlist" visible="yes" title="" intro=""/>
<tab type="structindex" visible="$ALPHABETICAL_INDEX" title=""/>
<tab type="structindex" visible="$ALPHABETICAL_INDEX" title=""/>
</tab>
<tab type="exceptions" visible="yes" title="">
<tab type="exceptionlist" visible="yes" title="" intro=""/>
<tab type="exceptionindex" visible="$ALPHABETICAL_INDEX" title=""/>
<tab type="exceptionindex" visible="$ALPHABETICAL_INDEX" title=""/>
<tab type="exceptionhierarchy" visible="yes" title="" intro=""/>
</tab>
<tab type="files" visible="yes" title="">
<tab type="filelist" visible="yes" title="" intro=""/>
<tab type="globals" visible="yes" title="" intro=""/>
</tab>
<tab type="examples" visible="yes" title="" intro=""/>
<tab type="examples" visible="yes" title="" intro=""/>
</navindex>

<!-- Layout definition for a class page -->
Expand Down

0 comments on commit 909c0d2

Please sign in to comment.