Markdown reader: Better handle quote characters in inline links.
This was previously failing to be recognized as a link: [Test](http://en.wikipedia.org/wiki/Ward's_method) Closes #1534.
This commit is contained in:
parent
5524b5286b
commit
8bf39cf6d6
3 changed files with 9 additions and 4 deletions
|
@ -1635,8 +1635,10 @@ source :: MarkdownParser (String, String)
|
||||||
source = do
|
source = do
|
||||||
char '('
|
char '('
|
||||||
skipSpaces
|
skipSpaces
|
||||||
let urlChunk = try $ notFollowedBy (oneOf "\"')") >>
|
let urlChunk =
|
||||||
(parenthesizedChars <|> count 1 litChar)
|
try parenthesizedChars
|
||||||
|
<|> (notFollowedBy (oneOf " )") >> (count 1 litChar))
|
||||||
|
<|> try (many1 spaceChar <* notFollowedBy (oneOf "\"')"))
|
||||||
let sourceURL = (unwords . words . concat) <$> many urlChunk
|
let sourceURL = (unwords . words . concat) <$> many urlChunk
|
||||||
let betweenAngles = try $
|
let betweenAngles = try $
|
||||||
char '<' >> manyTill litChar (char '>')
|
char '<' >> manyTill litChar (char '>')
|
||||||
|
|
|
@ -5,9 +5,10 @@
|
||||||
,Plain [RawInline (Format "tex") "\\placeformula "]
|
,Plain [RawInline (Format "tex") "\\placeformula "]
|
||||||
,RawBlock (Format "context") "\\startformula\n L_{1} = L_{2}\n \\stopformula"
|
,RawBlock (Format "context") "\\startformula\n L_{1} = L_{2}\n \\stopformula"
|
||||||
,RawBlock (Format "context") "\\start[a2]\n\\start[a2]\n\\stop[a2]\n\\stop[a2]"
|
,RawBlock (Format "context") "\\start[a2]\n\\start[a2]\n\\stop[a2]\n\\stop[a2]"
|
||||||
,Header 2 ("urls-with-spaces",[],[]) [Str "URLs",Space,Str "with",Space,Str "spaces"]
|
,Header 2 ("urls-with-spaces-and-punctuation",[],[]) [Str "URLs",Space,Str "with",Space,Str "spaces",Space,Str "and",Space,Str "punctuation"]
|
||||||
,Para [Link [Str "foo"] ("/bar%20and%20baz",""),Space,Link [Str "foo"] ("/bar%20and%20baz",""),Space,Link [Str "foo"] ("/bar%20and%20baz",""),Space,Link [Str "foo"] ("bar%20baz","title")]
|
,Para [Link [Str "foo"] ("/bar%20and%20baz",""),Space,Link [Str "foo"] ("/bar%20and%20baz",""),Space,Link [Str "foo"] ("/bar%20and%20baz",""),Space,Link [Str "foo"] ("bar%20baz","title")]
|
||||||
,Para [Link [Str "baz"] ("/foo%20foo",""),Space,Link [Str "bam"] ("/foo%20fee",""),Space,Link [Str "bork"] ("/foo/zee%20zob","title")]
|
,Para [Link [Str "baz"] ("/foo%20foo",""),Space,Link [Str "bam"] ("/foo%20fee",""),Space,Link [Str "bork"] ("/foo/zee%20zob","title")]
|
||||||
|
,Para [Link [Str "Ward\8217s",Space,Str "method."] ("http://en.wikipedia.org/wiki/Ward's_method","")]
|
||||||
,Header 2 ("horizontal-rules-with-spaces-at-end",[],[]) [Str "Horizontal",Space,Str "rules",Space,Str "with",Space,Str "spaces",Space,Str "at",Space,Str "end"]
|
,Header 2 ("horizontal-rules-with-spaces-at-end",[],[]) [Str "Horizontal",Space,Str "rules",Space,Str "with",Space,Str "spaces",Space,Str "at",Space,Str "end"]
|
||||||
,HorizontalRule
|
,HorizontalRule
|
||||||
,HorizontalRule
|
,HorizontalRule
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
\stop[a2]
|
\stop[a2]
|
||||||
\stop[a2]
|
\stop[a2]
|
||||||
|
|
||||||
## URLs with spaces
|
## URLs with spaces and punctuation
|
||||||
|
|
||||||
[foo](/bar and baz)
|
[foo](/bar and baz)
|
||||||
[foo](/bar
|
[foo](/bar
|
||||||
|
@ -42,6 +42,8 @@
|
||||||
[bam]: /foo fee
|
[bam]: /foo fee
|
||||||
[bork]: /foo/zee zob (title)
|
[bork]: /foo/zee zob (title)
|
||||||
|
|
||||||
|
[Ward's method.](http://en.wikipedia.org/wiki/Ward's_method)
|
||||||
|
|
||||||
## Horizontal rules with spaces at end
|
## Horizontal rules with spaces at end
|
||||||
|
|
||||||
* * * * *
|
* * * * *
|
||||||
|
|
Loading…
Add table
Reference in a new issue