Skip to content

Commit

Permalink
issue #10388 Can't link to a tagfile page in DoxygenLayout?
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
albert-github committed Oct 28, 2023
1 parent f023089 commit f6fb142
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
32 changes: 20 additions & 12 deletions src/layout.cpp
Expand Up @@ -30,6 +30,8 @@
#include "config.h"
#include "xml.h"
#include "resourcemgr.h"
#include "docparser.h"
#include "docnode.h"
#include "debug.h"

inline QCString compileOptions(const QCString &def)
Expand Down Expand Up @@ -145,20 +147,26 @@ QCString LayoutNavEntry::url() const
}
else if (url.startsWith("@ref ") || url.startsWith("\\ref "))
{
const Definition *d = 0;
QCString anchor;
bool found=FALSE;
if (resolveLink(QCString(),url.mid(5).stripWhiteSpace(),TRUE,&d,anchor))
bool found=false;
QCString relPath = "";
QCString context = QCString();
auto parser { createDocParser() };
auto dfAst { createRef( *parser.get(), url.mid(5).stripWhiteSpace(), context ) };
auto dfAstImpl = dynamic_cast<const DocNodeAST*>(dfAst.get());
const DocRef *df = std::get_if<DocRef>(&dfAstImpl->root);
if (!df->file().isEmpty() || !df->anchor().isEmpty())
{
if (d && d->isLinkable())
found = true;
url=externalRef(relPath,df->ref(),TRUE);
if (!df->file().isEmpty())
{
url = d->getOutputFileBase();
addHtmlExtensionIfMissing(url);
if (!anchor.isEmpty())
{
url+="#"+anchor;
}
found=TRUE;
QCString fn = df->file();
addHtmlExtensionIfMissing(fn);
url += fn;
}
if (!df->anchor().isEmpty())
{
url += "#" + df->anchor();
}
}
if (!found)
Expand Down
2 changes: 1 addition & 1 deletion src/msc.cpp
Expand Up @@ -73,11 +73,11 @@ static bool convertMapFile(TextStream &t,const QCString &mapName,const QCString
auto dfAst { createRef( *parser.get(), url, context, srcFile, srcLine) };
auto dfAstImpl = dynamic_cast<const DocNodeAST*>(dfAst.get());
const DocRef *df = std::get_if<DocRef>(&dfAstImpl->root);
t << externalRef(relPath,df->ref(),TRUE);
if (!df->file().isEmpty() || !df->anchor().isEmpty())
{
link = true;
t << "<area href=\"";
t << externalRef(relPath,df->ref(),TRUE);
}
if (!df->file().isEmpty())
{
Expand Down

0 comments on commit f6fb142

Please sign in to comment.