Skip to content

Commit f6fb142

Browse files
committed
issue #10388 Can't link to a tagfile page in DoxygenLayout?
Adjusting method for the layout file analogous to the methods used in the msc / dot file generators. During the working on this issue also a small problem was found (external links didn't work) was found for msc graphs.
1 parent f023089 commit f6fb142

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

src/layout.cpp

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
#include "config.h"
3131
#include "xml.h"
3232
#include "resourcemgr.h"
33+
#include "docparser.h"
34+
#include "docnode.h"
3335
#include "debug.h"
3436

3537
inline QCString compileOptions(const QCString &def)
@@ -145,20 +147,26 @@ QCString LayoutNavEntry::url() const
145147
}
146148
else if (url.startsWith("@ref ") || url.startsWith("\\ref "))
147149
{
148-
const Definition *d = 0;
149-
QCString anchor;
150-
bool found=FALSE;
151-
if (resolveLink(QCString(),url.mid(5).stripWhiteSpace(),TRUE,&d,anchor))
150+
bool found=false;
151+
QCString relPath = "";
152+
QCString context = QCString();
153+
auto parser { createDocParser() };
154+
auto dfAst { createRef( *parser.get(), url.mid(5).stripWhiteSpace(), context ) };
155+
auto dfAstImpl = dynamic_cast<const DocNodeAST*>(dfAst.get());
156+
const DocRef *df = std::get_if<DocRef>(&dfAstImpl->root);
157+
if (!df->file().isEmpty() || !df->anchor().isEmpty())
152158
{
153-
if (d && d->isLinkable())
159+
found = true;
160+
url=externalRef(relPath,df->ref(),TRUE);
161+
if (!df->file().isEmpty())
154162
{
155-
url = d->getOutputFileBase();
156-
addHtmlExtensionIfMissing(url);
157-
if (!anchor.isEmpty())
158-
{
159-
url+="#"+anchor;
160-
}
161-
found=TRUE;
163+
QCString fn = df->file();
164+
addHtmlExtensionIfMissing(fn);
165+
url += fn;
166+
}
167+
if (!df->anchor().isEmpty())
168+
{
169+
url += "#" + df->anchor();
162170
}
163171
}
164172
if (!found)

src/msc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ static bool convertMapFile(TextStream &t,const QCString &mapName,const QCString
7373
auto dfAst { createRef( *parser.get(), url, context, srcFile, srcLine) };
7474
auto dfAstImpl = dynamic_cast<const DocNodeAST*>(dfAst.get());
7575
const DocRef *df = std::get_if<DocRef>(&dfAstImpl->root);
76-
t << externalRef(relPath,df->ref(),TRUE);
7776
if (!df->file().isEmpty() || !df->anchor().isEmpty())
7877
{
7978
link = true;
8079
t << "<area href=\"";
80+
t << externalRef(relPath,df->ref(),TRUE);
8181
}
8282
if (!df->file().isEmpty())
8383
{

0 commit comments

Comments
 (0)