Permalink
Browse files

Bug 756724 - Inline markdown links don't support reference targets th…

…at contain )
  • Loading branch information...
Dimitri van Heesch
Dimitri van Heesch committed Oct 18, 2015
1 parent 02454d9 commit 59a42f974f15fa0154317900ffd9b82babd985ad
Showing with 16 additions and 4 deletions.
  1. +16 −4 src/markdown.cpp
@@ -695,14 +695,26 @@ static int processLink(GrowBuf &out,const char *data,int,int size)
if (i<size && data[i]=='<') i++;
linkStart=i;
nl=0;
while (i<size && data[i]!='\'' && data[i]!='"' && data[i]!=')')
int braceCount=1;
while (i<size && data[i]!='\'' && data[i]!='"' && braceCount>0)
{
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 (i<size && data[i]!=')')
{
if (data[i]=='\n')
if (data[i]=='\n')
{
if (nl>1) return 0;
nl++;

0 comments on commit 59a42f9

Please sign in to comment.