summaryrefslogtreecommitdiffstats
path: root/src/markdown.cpp
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2016-05-26 20:02:40 (GMT)
committerDimitri van Heesch <dimitri@stack.nl>2016-05-26 20:02:40 (GMT)
commit5f9d80b2ce73a7e7fb0f4fc16f3ef5fee0cf8105 (patch)
treed52224717f14c588930d64370ce6f07b74a7744e /src/markdown.cpp
parentb00761b30a1d399f95adfe823937c05a64476155 (diff)
downloadDoxygen-5f9d80b2ce73a7e7fb0f4fc16f3ef5fee0cf8105.zip
Doxygen-5f9d80b2ce73a7e7fb0f4fc16f3ef5fee0cf8105.tar.gz
Doxygen-5f9d80b2ce73a7e7fb0f4fc16f3ef5fee0cf8105.tar.bz2
Bug 751416 - Markdown: > escaped within backticks
Diffstat (limited to 'src/markdown.cpp')
-rw-r--r--src/markdown.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/markdown.cpp b/src/markdown.cpp
index 5b0ede9..84e52ba 100644
--- a/src/markdown.cpp
+++ b/src/markdown.cpp
@@ -111,19 +111,21 @@ static void processInline(GrowBuf &out,const char *data,int size);
static QCString escapeSpecialChars(const QCString &s)
{
if (s.isEmpty()) return "";
+ bool insideQuote=FALSE;
GrowBuf growBuf;
const char *p=s;
- char c;
+ char c,pc='\0';
while ((c=*p++))
{
switch (c)
{
- case '<': growBuf.addStr("\\<"); break;
- case '>': growBuf.addStr("\\>"); break;
- case '\\': growBuf.addStr("\\\\"); break;
- case '@': growBuf.addStr("\\@"); break;
- default: growBuf.addChar(c); break;
+ case '"': if (pc!='\\') { insideQuote=!insideQuote; } growBuf.addChar(c); break;
+ case '<': if (!insideQuote) { growBuf.addChar('\\'); } growBuf.addChar('<'); break;
+ case '>': if (!insideQuote) { growBuf.addChar('\\'); } growBuf.addChar('>'); break;
+ case '@': if (!insideQuote) { growBuf.addChar('\\'); } growBuf.addChar('@'); break;
+ default: growBuf.addChar(c); break;
}
+ pc=c;
}
growBuf.addChar(0);
return growBuf.get();