summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2021-02-17 19:06:38 (GMT)
committerGitHub <noreply@github.com>2021-02-17 19:06:38 (GMT)
commit16c3a50ffa722cabc5dcad3e2069f5334fc90aa9 (patch)
tree16c62de6c471c3dadfd3171bb41f04f5bce7a191
parent66b9dbd1fa132d088d2155dc80c44e954541a241 (diff)
parent3d6df187044d03c28c5ed5d1be2f0a6b53f59b51 (diff)
downloadDoxygen-16c3a50ffa722cabc5dcad3e2069f5334fc90aa9.zip
Doxygen-16c3a50ffa722cabc5dcad3e2069f5334fc90aa9.tar.gz
Doxygen-16c3a50ffa722cabc5dcad3e2069f5334fc90aa9.tar.bz2
Merge pull request #8363 from albert-github/feature/issue_8362
issue #8362 Text of image repeated 4 times
-rw-r--r--src/markdown.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/markdown.cpp b/src/markdown.cpp
index 2bc8206..b9fad70 100644
--- a/src/markdown.cpp
+++ b/src/markdown.cpp
@@ -213,6 +213,26 @@ inline int isNewline(const char *data)
return 0;
}
+// escape double quotes in string
+static QCString escapeDoubleQuotes(const QCString &s)
+{
+ TRACE(s.data());
+ if (s.isEmpty()) return "";
+ GrowBuf growBuf;
+ const char *p=s;
+ char c,pc='\0';
+ while ((c=*p++))
+ {
+ switch (c)
+ {
+ case '"': if (pc!='\\') { growBuf.addChar('\\'); } growBuf.addChar(c); break;
+ default: growBuf.addChar(c); break;
+ }
+ pc=c;
+ }
+ growBuf.addChar(0);
+ return growBuf.get();
+}
// escape characters that have a special meaning later on.
static QCString escapeSpecialChars(const QCString &s)
{
@@ -775,13 +795,13 @@ void Markdown::writeMarkdownImage(const char *fmt, bool explicitTitle,
if (!explicitTitle && !content.isEmpty())
{
m_out.addStr(" \"");
- m_out.addStr(content);
+ m_out.addStr(escapeDoubleQuotes(content));
m_out.addStr("\"");
}
else if ((content.isEmpty() || explicitTitle) && !title.isEmpty())
{
m_out.addStr(" \"");
- m_out.addStr(title);
+ m_out.addStr(escapeDoubleQuotes(title));
m_out.addStr("\"");
}
else