git.iko.soy/typeable/pandoc
on master help sign in
Textile reader: disallow empty URL in explicit link.

Closes #3036.

commit27762affe3edd13ccb62a5450166b28fe73d15e6 authorJohn MacFarlane <jgm@berkeley.edu> dateFri 22 Jul 2016, 15:45 (10 years ago) parent266caf7
3 files changed+4−1
src/Text/Pandoc/Readers/Textile.hs+1−1 tests/textile-reader.native+1 tests/textile-reader.textile+2
src/Text/Pandoc/Readers/Textile.hs+1−1
@@ -594,7 +594,7 @@ link = try $ do
594594 then char ']'
595595 else lookAhead $ space <|>
596596 try (oneOf "!.,;:" *> (space <|> newline))
597− url <- manyTill nonspaceChar stop
597+ url <- many1Till nonspaceChar stop
598598 let name' = if B.toList name == [Str "$"] then B.str url else name
599599 return $ if attr == nullAttr
600600 then B.link url "" name'
tests/textile-reader.native+1
@@ -96,6 +96,7 @@ Pandoc (Meta {unMeta = fromList []})
9696,Header 2 ("explicit",[],[]) [Str "Explicit"]
9797,Para [Str "Just",Space,Str "a",Space,Link ("",[],[]) [Str "url"] ("http://www.url.com","")]
9898,Para [Link ("",[],[]) [Str "Email",Space,Str "link"] ("mailto:nobody@nowhere.net","")]
99+,Para [Str "\"not",Space,Str "a",Space,Str "link\":",Space,Str "foo"]
99100,Para [Str "Automatic",Space,Str "linking",Space,Str "to",Space,Link ("",[],[]) [Str "http://www.example.com"] ("http://www.example.com",""),Str "."]
100101,Para [Link ("",[],[]) [Str "Example"] ("http://www.example.com/",""),Str ":",Space,Str "Example",Space,Str "of",Space,Str "a",Space,Str "link",Space,Str "followed",Space,Str "by",Space,Str "a",Space,Str "colon."]
101102,Para [Str "A",Space,Str "link",Link ("",[],[]) [Str "with",Space,Str "brackets"] ("http://www.example.com",""),Str "and",Space,Str "no",Space,Str "spaces."]
tests/textile-reader.textile+2
@@ -174,6 +174,8 @@ Just a "url":http://www.url.com
174174
175175"Email link":mailto:nobody@nowhere.net
176176
177+"not a link": foo
178+
177179Automatic linking to "$":http://www.example.com.
178180
179181"Example":http://www.example.com/: Example of a link followed by a colon.