summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2016-10-17 19:49:17 (GMT)
committerDimitri van Heesch <dimitri@stack.nl>2016-10-17 19:49:17 (GMT)
commita95c07ecc0a2f1205883d8420a8280c5701c901c (patch)
treedc575a38b398f42e0adb629854681ef1413b5e6b /src
parent985faf287233badf65fa33d21bde17afa6970d60 (diff)
downloadDoxygen-a95c07ecc0a2f1205883d8420a8280c5701c901c.zip
Doxygen-a95c07ecc0a2f1205883d8420a8280c5701c901c.tar.gz
Doxygen-a95c07ecc0a2f1205883d8420a8280c5701c901c.tar.bz2
Bug 772574 - __xxx__ not interpreted as markdown when xxx begins with a non-word character (e.g. __-1__)
Diffstat (limited to 'src')
-rw-r--r--src/markdown.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/markdown.cpp b/src/markdown.cpp
index d63e149..22e0d50 100644
--- a/src/markdown.cpp
+++ b/src/markdown.cpp
@@ -59,6 +59,11 @@
(data[i]>='0' && data[i]<='9') || \
(((unsigned char)data[i])>=0x80)) // unicode characters
+#define extraChar(i) \
+ (data[i]=='-' || data[i]=='+' || data[i]=='!' || \
+ data[i]=='?' || data[i]=='$' || data[i]=='@' || \
+ data[i]=='&' || data[i]=='*' || data[i]=='%')
+
// is character at position i in data allowed before an emphasis section
#define isOpenEmphChar(i) \
(data[i]=='\n' || data[i]==' ' || data[i]=='\'' || data[i]=='<' || \
@@ -592,8 +597,8 @@ static int processHtmlTag(GrowBuf &out,const char *data,int offset,int size)
static int processEmphasis(GrowBuf &out,const char *data,int offset,int size)
{
if ((offset>0 && !isOpenEmphChar(-1)) || // invalid char before * or _
- (size>1 && data[0]!=data[1] && !(isIdChar(1) || data[1]=='[')) || // invalid char after * or _
- (size>2 && data[0]==data[1] && !(isIdChar(2) || data[2]=='['))) // invalid char after ** or __
+ (size>1 && data[0]!=data[1] && !(isIdChar(1) || extraChar(1) || data[1]=='[')) || // invalid char after * or _
+ (size>2 && data[0]==data[1] && !(isIdChar(2) || extraChar(2) || data[2]=='['))) // invalid char after ** or __
{
return 0;
}