Permalink
Browse files

Fixed issue escaping ndashes (\--) and mdashes (\---)

  • Loading branch information...
Dimitri van Heesch
Dimitri van Heesch committed Feb 7, 2016
1 parent 0fead52 commit ef56187f733d946e4df130d9783eadea41ec1c97
Showing with 14 additions and 16 deletions.
  1. +11 −16 src/markdown.cpp
  2. +1 −0 testing/055/md_055_markdown.xml
  3. +2 −0 testing/055_markdown.md
@@ -1018,26 +1018,21 @@ static int processSpecialCommand(GrowBuf &out, const char *data, int offset, int
if (size>1 && data[0]=='\\')
{
char c=data[1];
if (c=='[' || c==']' || c=='*' || /* c=='+' || c=='-' || c=='.' || */
c=='!' || c=='(' || c==')' || c=='`' || c=='_')
if (c=='[' || c==']' || c=='*' || c=='!' || c=='(' || c==')' || c=='`' || c=='_')
{
if (c=='-' && size>3 && data[2]=='-' && data[3]=='-') // \---
{
out.addStr(&data[1],3);
return 4;
}
else if (c=='-' && size>2 && data[2]=='-') // \--
{
out.addStr(&data[1],2);
return 3;
}
else if (c=='-') // \-
{
out.addChar(c);
}
out.addChar(data[1]);
return 2;
}
else if (c=='-' && size>3 && data[2]=='-' && data[3]=='-') // \---
{
out.addStr(&data[1],3);
return 4;
}
else if (c=='-' && size>2 && data[2]=='-') // \--
{
out.addStr(&data[1],2);
return 3;
}
}
return 0;
}
@@ -23,6 +23,7 @@
<para>
<ulink url="http://example.com/last-line">Upper-cased reference link on last line</ulink>
</para>
<para>Dash - NDash <ndash/> MDash <mdash/> EDash - ENDash -- EMDash --- E3Dash --- </para>
</detaileddescription>
</compounddef>
</doxygen>
@@ -20,3 +20,5 @@ More text
[Upper-cased reference link on last line][U]
[U]: http://example.com/last-line
Dash - NDash -- MDash --- EDash \- ENDash \-- EMDash \--- E3Dash \-\-\-

0 comments on commit ef56187

Please sign in to comment.