diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/markdown.cpp | 2 | ||||
-rw-r--r-- | src/util.cpp | 12 | ||||
-rw-r--r-- | src/util.h | 2 |
3 files changed, 11 insertions, 5 deletions
diff --git a/src/markdown.cpp b/src/markdown.cpp index 6b5a894..f2ec22a 100644 --- a/src/markdown.cpp +++ b/src/markdown.cpp @@ -915,7 +915,7 @@ static int processLink(GrowBuf &out,const char *data,int,int size) { SrcLangExt lang = getLanguageFromFileName(link); int lp=-1; - if ((lp=link.find("@ref "))!=-1 || (lp=link.find("\\ref "))!=-1 || lang==SrcLangExt_Markdown) + if ((lp=link.find("@ref "))!=-1 || (lp=link.find("\\ref "))!=-1 || (lang==SrcLangExt_Markdown && !isURL(link))) // assume doxygen symbol link { if (lp==-1) // link to markdown page diff --git a/src/util.cpp b/src/util.cpp index 2654ccf..a6ae004 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -8454,16 +8454,20 @@ QCString getLanguageSpecificSeparator(SrcLangExt lang,bool classScope) return "::"; } } - +/** Checks whether the given url starts with a supported protocol */ +bool isURL(const QCString &url) +{ + QCString loc_url = url.stripWhiteSpace(); + return loc_url.left(5)=="http:" || loc_url.left(6)=="https:" || + loc_url.left(4)=="ftp:" || loc_url.left(5)=="file:"; +} /** Corrects URL \a url according to the relative path \a relPath. * Returns the corrected URL. For absolute URLs no correction will be done. */ QCString correctURL(const QCString &url,const QCString &relPath) { QCString result = url; - if (!relPath.isEmpty() && - url.left(5)!="http:" && url.left(6)!="https:" && - url.left(4)!="ftp:" && url.left(5)!="file:") + if (!relPath.isEmpty() && !isURL(url)) { result.prepend(relPath); } @@ -451,6 +451,8 @@ bool copyFile(const QCString &src,const QCString &dest); QCString extractBlock(const QCString text,const QCString marker); int lineBlock(const QCString text,const QCString marker); +bool isURL(const QCString &url); + QCString correctURL(const QCString &url,const QCString &relPath); QCString processMarkup(const QCString &s); |