diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2018-10-27 13:03:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-27 13:03:30 (GMT) |
commit | 7cb517eb3c4181c90dd6b366410d1ea3c0cbcb63 (patch) | |
tree | 76833aa88f6b9ec09ba8ca1ddf6877d76a87cf50 /src | |
parent | ecc99f5aa269a624848b9eda30a581067d801086 (diff) | |
parent | 1f849a16671e1c9afff4ee30a5b5a33d271e8684 (diff) | |
download | Doxygen-7cb517eb3c4181c90dd6b366410d1ea3c0cbcb63.zip Doxygen-7cb517eb3c4181c90dd6b366410d1ea3c0cbcb63.tar.gz Doxygen-7cb517eb3c4181c90dd6b366410d1ea3c0cbcb63.tar.bz2 |
Merge pull request #6460 from albert-github/feature/issue_6456
Issue_6456 Using # in links causes errors in PDF generation
Diffstat (limited to 'src')
-rw-r--r-- | src/latexdocvisitor.cpp | 14 | ||||
-rw-r--r-- | src/latexgen.cpp | 4 | ||||
-rw-r--r-- | src/util.cpp | 19 | ||||
-rw-r--r-- | src/util.h | 1 |
4 files changed, 30 insertions, 8 deletions
diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp index 452a481..51e53e9 100644 --- a/src/latexdocvisitor.cpp +++ b/src/latexdocvisitor.cpp @@ -215,13 +215,14 @@ void LatexDocVisitor::visit(DocURL *u) if (m_hide) return; if (Config_getBool(PDF_HYPERLINKS)) { + m_t << endl << "%% AME " << u->url() <<endl; m_t << "\\href{"; if (u->isEmail()) m_t << "mailto:"; - m_t << u->url() << "}"; + m_t << latexFilterURL(u->url()) << "}"; } - m_t << "\\texttt{ "; + m_t << "{\\texttt{ "; filter(u->url()); - m_t << "}"; + m_t << "}}"; } void LatexDocVisitor::visit(DocLineBreak *) @@ -1251,17 +1252,18 @@ void LatexDocVisitor::visitPre(DocHRef *href) if (m_hide) return; if (Config_getBool(PDF_HYPERLINKS)) { + m_t << endl << "%% AME " << href->url() <<endl; m_t << "\\href{"; - m_t << href->url(); + m_t << latexFilterURL(href->url()); m_t << "}"; } - m_t << "\\texttt{ "; + m_t << "{\\texttt{ "; } void LatexDocVisitor::visitPost(DocHRef *) { if (m_hide) return; - m_t << "}"; + m_t << "}}"; } void LatexDocVisitor::visitPre(DocHtmlHeader *header) diff --git a/src/latexgen.cpp b/src/latexgen.cpp index 50d4242..9f1372e 100644 --- a/src/latexgen.cpp +++ b/src/latexgen.cpp @@ -1369,12 +1369,12 @@ void LatexGenerator::startHtmlLink(const char *url) t << url; t << "}"; } - t << "\\texttt{ "; + t << "{\\texttt{ "; } void LatexGenerator::endHtmlLink() { - t << "}"; + t << "}}"; } //void LatexGenerator::writeMailLink(const char *url) diff --git a/src/util.cpp b/src/util.cpp index 7371026..c931214 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -7026,6 +7026,25 @@ QCString latexEscapePDFString(const char *s) return result.data(); } +QCString latexFilterURL(const char *s) +{ + QGString result; + FTextStream t(&result); + const char *p=s; + char c; + while ((c=*p++)) + { + switch (c) + { + case '#': t << "\\#"; break; + default: + t << c; + break; + } + } + return result.data(); +} + QCString rtfFormatBmkStr(const char *name) { @@ -348,6 +348,7 @@ void filterLatexString(FTextStream &t,const char *str, QCString latexEscapeLabelName(const char *s,bool insideTabbing); QCString latexEscapeIndexChars(const char *s,bool insideTabbing); QCString latexEscapePDFString(const char *s); +QCString latexFilterURL(const char *s); QCString rtfFormatBmkStr(const char *name); |