Permalink
Browse files

Bug 751416 - Markdown: > escaped within backticks

  • Loading branch information...
Dimitri van Heesch
Dimitri van Heesch committed May 26, 2016
1 parent b00761b commit 5f9d80b2ce73a7e7fb0f4fc16f3ef5fee0cf8105
Showing with 8 additions and 6 deletions.
  1. +8 −6 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();

0 comments on commit 5f9d80b

Please sign in to comment.