summaryrefslogtreecommitdiffstats
path: root/src/util.cpp
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2019-05-12 17:46:20 (GMT)
committerGitHub <noreply@github.com>2019-05-12 17:46:20 (GMT)
commit8ba8b5df87cbd70f8c912b84dc2403189bcda4a5 (patch)
tree04d45f695fa8db9e05bc0fb90ece4803a27585c7 /src/util.cpp
parentbcc8da62ab46c3dbbf08c2c16e6b4dfb6b64b2cb (diff)
parent919b65b72a70d944602a65395951de9b9fa23f07 (diff)
downloadDoxygen-8ba8b5df87cbd70f8c912b84dc2403189bcda4a5.zip
Doxygen-8ba8b5df87cbd70f8c912b84dc2403189bcda4a5.tar.gz
Doxygen-8ba8b5df87cbd70f8c912b84dc2403189bcda4a5.tar.bz2
Merge pull request #6913 from albert-github/feature/url_to_md_file
Markdown file as internet link
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp12
1 files changed, 8 insertions, 4 deletions
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);
}