summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoralbert-github <albert.tests@gmail.com>2018-08-24 08:56:38 (GMT)
committeralbert-github <albert.tests@gmail.com>2018-08-24 08:56:38 (GMT)
commit1f849a16671e1c9afff4ee30a5b5a33d271e8684 (patch)
tree61a428413af2b6b0d89b3467d83365427f427b31 /src
parent94a52469b177703d3e0d94bed6c4a48bddba18cb (diff)
downloadDoxygen-1f849a16671e1c9afff4ee30a5b5a33d271e8684.zip
Doxygen-1f849a16671e1c9afff4ee30a5b5a33d271e8684.tar.gz
Doxygen-1f849a16671e1c9afff4ee30a5b5a33d271e8684.tar.bz2
Issue_6456 Using # in links causes errors in PDF generation
- The # sign in an URL needs to be escaped as longtabu reads the table body as the argument to a command, so the self-escaping mechanism of \href cannot work (from https://tex.stackexchange.com/questions/447461/having-a-hash-sign-in-href-in-a-longtabu-cell) - a regression regarding the change from `\tt` to `\texttt` (needed `{ ... }` as `\href` has 2 arguments )
Diffstat (limited to 'src')
-rw-r--r--src/latexdocvisitor.cpp14
-rw-r--r--src/latexgen.cpp4
-rw-r--r--src/util.cpp19
-rw-r--r--src/util.h1
4 files changed, 30 insertions, 8 deletions
diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp
index d2c4c5d..76e3a55 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 *)
@@ -1245,17 +1246,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 474d368..6d399c5 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 b387a84..5fc8822 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -6964,6 +6964,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)
{
diff --git a/src/util.h b/src/util.h
index a9eee67..3626574 100644
--- a/src/util.h
+++ b/src/util.h
@@ -346,6 +346,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);