From 59a42f974f15fa0154317900ffd9b82babd985ad Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sun, 18 Oct 2015 11:54:51 +0200 Subject: Bug 756724 - Inline markdown links don't support reference targets that contain ) --- src/markdown.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/markdown.cpp b/src/markdown.cpp index 02d1416..9ff139c 100644 --- a/src/markdown.cpp +++ b/src/markdown.cpp @@ -695,14 +695,26 @@ static int processLink(GrowBuf &out,const char *data,int,int size) if (i0) { - if (data[i]=='\n') + if (data[i]=='\n') // unexpected EOL { nl++; if (nl>1) return 0; } - i++; + else if (data[i]=='(') + { + braceCount++; + } + else if (data[i]==')') + { + braceCount--; + } + if (braceCount>0) + { + i++; + } } if (i>=size || data[i]=='\n') return 0; convertStringFragment(link,data+linkStart,i-linkStart); @@ -720,7 +732,7 @@ static int processLink(GrowBuf &out,const char *data,int,int size) nl=0; while (i1) return 0; nl++; -- cgit v0.12