summaryrefslogtreecommitdiff
path: root/src/Tests/Readers
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2011-03-18 11:27:42 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2011-03-18 11:30:20 -0700
commit6beba76f61faa41c4351fa4eb54161c060315a23 (patch)
tree62cc4da5965e08f8630a25701769dbb8917532a1 /src/Tests/Readers
parentd1304e835670a3e025e0f1b5ca3d38dca1ee6d62 (diff)
Changed uri parser so it doesn't include trailing punctuation.
So, in RST, 'http://google.com.' should be parsed as a link to 'http://google.com' followed by a period. The parser is smart enough to recognize balanced parentheses, as often occur in wikipedia links: 'http://foo.bar/baz_(bam)'. Also added ()s to RST specialChars, so '(http://google.com)' will be parsed as a link in parens. Added test cases. Resolves Issue #291.
Diffstat (limited to 'src/Tests/Readers')
-rw-r--r--src/Tests/Readers/RST.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Tests/Readers/RST.hs b/src/Tests/Readers/RST.hs
index d67778f08..3ca4e42bf 100644
--- a/src/Tests/Readers/RST.hs
+++ b/src/Tests/Readers/RST.hs
@@ -45,5 +45,13 @@ tests = [ "field list" =:
, (str "Parameter i", [para "integer"])
, (str "Final", [para "item on two lines"])
])
+ , "URLs with following punctuation" =:
+ ("http://google.com, http://yahoo.com; http://foo.bar.baz.\n" ++
+ "http://foo.bar/baz_(bam) (http://foo.bar)") =?>
+ para (link "http://google.com" "" "http://google.com" +++ ", " +++
+ link "http://yahoo.com" "" "http://yahoo.com" +++ "; " +++
+ link "http://foo.bar.baz" "" "http://foo.bar.baz" +++ ". " +++
+ link "http://foo.bar/baz_(bam)" "" "http://foo.bar/baz_(bam)"
+ +++ " (" +++ link "http://foo.bar" "" "http://foo.bar" +++ ")")
]