diff options
author | John MacFarlane <jgm@berkeley.edu> | 2018-09-19 14:49:46 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2018-09-19 14:53:29 -0700 |
commit | 136bf901aa088eaf4e5c996c71e0a36c171f1587 (patch) | |
tree | 84a45f3c0c0ec0eefa8f7ae7b245a940c6f45b7f /test/Tests | |
parent | dba5c8d4e39c0bedf2a46191ad393bf84620bee5 (diff) | |
download | pandoc-136bf901aa088eaf4e5c996c71e0a36c171f1587.tar.gz |
Markdown reader: distinguish autolinks in the AST.
With this change, autolinks are parsed as Links with
the `uri` class. (The same is true for bare links, if
the `autolink_bare_uris` extension is enabled.) Email
autolinks are parsed as Links with the `email` class.
This allows the distinction to be represented in the
URI.
Formerly the `uri` class was added to autolinks by
the HTML writer, but it had to guess what was an autolink
and could not distinguish `[http://example.com](http://example.com)`
from `<http://example.com>`. It also incorrectly recognized
`[pandoc](pandoc)` as an autolink. Now the HTML writer
simply passes through the `uri` attribute if it is present,
but does not add anything.
The Textile writer has been modified so that the `uri`
class is not explicitly added for autolinks, even if it
is present.
Closes #4913.
Diffstat (limited to 'test/Tests')
-rw-r--r-- | test/Tests/Readers/Markdown.hs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/test/Tests/Readers/Markdown.hs b/test/Tests/Readers/Markdown.hs index bc8e55615..be89e708e 100644 --- a/test/Tests/Readers/Markdown.hs +++ b/test/Tests/Readers/Markdown.hs @@ -39,7 +39,7 @@ testBareLink (inp, ils) = (unpack inp) (inp, doc $ para ils) autolink :: String -> Inlines -autolink = autolinkWith nullAttr +autolink = autolinkWith ("",["uri"],[]) autolinkWith :: Attr -> String -> Inlines autolinkWith attr s = linkWith attr s "" (str s) @@ -72,10 +72,12 @@ bareLinkTests = , ("http://en.wikipedia.org/wiki/Sprite_(computer_graphics)", autolink "http://en.wikipedia.org/wiki/Sprite_(computer_graphics)") , ("http://en.wikipedia.org/wiki/Sprite_[computer_graphics]", - link "http://en.wikipedia.org/wiki/Sprite_%5Bcomputer_graphics%5D" "" + linkWith ("",["uri"],[]) + "http://en.wikipedia.org/wiki/Sprite_%5Bcomputer_graphics%5D" "" (str "http://en.wikipedia.org/wiki/Sprite_[computer_graphics]")) , ("http://en.wikipedia.org/wiki/Sprite_{computer_graphics}", - link "http://en.wikipedia.org/wiki/Sprite_%7Bcomputer_graphics%7D" "" + linkWith ("",["uri"],[]) + "http://en.wikipedia.org/wiki/Sprite_%7Bcomputer_graphics%7D" "" (str "http://en.wikipedia.org/wiki/Sprite_{computer_graphics}")) , ("http://example.com/Notification_Center-GitHub-20101108-140050.jpg", autolink "http://example.com/Notification_Center-GitHub-20101108-140050.jpg") |