diff options
author | albert-github <albert.tests@gmail.com> | 2019-04-05 11:12:44 (GMT) |
---|---|---|
committer | albert-github <albert.tests@gmail.com> | 2019-04-05 11:12:44 (GMT) |
commit | 6441903baba9afd3898fc57c4da14029498290b1 (patch) | |
tree | fc1869aff2a4695e0fccf0995aaf632e62399611 /src/util.cpp | |
parent | 16d025c8a08b485f5d43ade0986d716bd6aa06f8 (diff) | |
download | Doxygen-6441903baba9afd3898fc57c4da14029498290b1.zip Doxygen-6441903baba9afd3898fc57c4da14029498290b1.tar.gz Doxygen-6441903baba9afd3898fc57c4da14029498290b1.tar.bz2 |
Markdown file as internet link
See a link in case of a md file only as local link if it doesn't start with a supported protocol.
Example found was:
```
[Ansibullbot](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
```
Diffstat (limited to 'src/util.cpp')
-rw-r--r-- | src/util.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/util.cpp b/src/util.cpp index f92df68..fa3c55f 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -8452,16 +8452,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); } |