Skip to content

Commit

Permalink
Bug 756724 - Inline markdown links don't support reference targets th…
Browse files Browse the repository at this point in the history
…at contain )
  • Loading branch information
Dimitri van Heesch committed Oct 20, 2015
1 parent 02454d9 commit 59a42f9
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/markdown.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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++;
Expand Down

0 comments on commit 59a42f9

Please sign in to comment.