Skip to content

Commit abf9ae2

Browse files
committed
issue doxygen#11001 \copydoc does not respect section hierarchy in table of contents
When linking to pages / sections prefer the version with the "prefix" (i.e. local version) but when no match is found also try the one without "prefix" (i.e. global version).
1 parent 783550e commit abf9ae2

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/docnode.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,11 @@ DocRef::DocRef(DocParser *parser,DocNodeVariant *parent,const QCString &target,c
711711
m_relPath = parser->context.relPath;
712712
auto lang = parser->context.lang;
713713
const SectionInfo *sec = SectionManager::instance().find(parser->context.prefix+target);
714+
if (sec==nullptr && !parser->context.prefix.isEmpty())
715+
{
716+
sec = SectionManager::instance().find(target);
717+
}
718+
714719
if (sec==nullptr && getLanguageFromFileName(target)==SrcLangExt::Markdown) // lookup as markdown file
715720
{
716721
sec = SectionManager::instance().find(markdownFileNameToId(target));

src/util.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3298,6 +3298,13 @@ bool resolveLink(/* in */ const QCString &scName,
32983298
AUTO_TRACE_EXIT("section");
32993299
return TRUE;
33003300
}
3301+
else if ((si=SectionManager::instance().find(linkRef)))
3302+
{
3303+
*resContext=si->definition();
3304+
resAnchor = si->label();
3305+
AUTO_TRACE_EXIT("section");
3306+
return TRUE;
3307+
}
33013308
else if ((pd=Doxygen::exampleLinkedMap->find(linkRef))) // link to an example
33023309
{
33033310
*resContext=pd;

0 commit comments

Comments
 (0)