summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralbert-github <albert.tests@gmail.com>2020-04-06 17:23:40 (GMT)
committerGitHub <noreply@github.com>2020-04-06 17:23:40 (GMT)
commit307a912cc0e4e080c49e4b47f2c8f5a7ffb605ba (patch)
treef605a16f010335c23ec6759ec65c9bf9f17a60dd
parent4b5a3c19573ae5e9a6e6ade8aca9fbe9f307bbd2 (diff)
downloadDoxygen-307a912cc0e4e080c49e4b47f2c8f5a7ffb605ba.zip
Doxygen-307a912cc0e4e080c49e4b47f2c8f5a7ffb605ba.tar.gz
Doxygen-307a912cc0e4e080c49e4b47f2c8f5a7ffb605ba.tar.bz2
Relative markdown file reference (#7032)
In case we have a relative reference to a local markdown file this file is not found when the relative path starts e.g. with `..` So when we have a file: ``` docs\tutorial\security.md ``` and this references the file: ``` ../api/browser-window.md ``` through the markdown syntax: ``` [`BrowserWindow`](../api/browser-window.md) ``` then the link was not found and a warning was given.
-rw-r--r--src/markdown.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/markdown.cpp b/src/markdown.cpp
index 2e67145..612b878 100644
--- a/src/markdown.cpp
+++ b/src/markdown.cpp
@@ -915,6 +915,20 @@ static int processLink(GrowBuf &out,const char *data,int,int size)
if (lp==-1) // link to markdown page
{
out.addStr("@ref ");
+ if (!(portable_isAbsolutePath(link) || isURL(link)))
+ {
+ QFileInfo forg(link);
+ if (!(forg.exists() && forg.isReadable()))
+ {
+ QFileInfo fi(g_fileName);
+ QCString mdFile = g_fileName.left(g_fileName.length()-fi.fileName().length()) + link;
+ QFileInfo fmd(mdFile);
+ if (fmd.exists() && fmd.isReadable())
+ {
+ link = fmd.absFilePath().data();
+ }
+ }
+ }
}
out.addStr(link);
out.addStr(" \"");