aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOphir Lifshitz <hangfromthefloor@gmail.com>2015-07-23 02:31:03 -0400
committerOphir Lifshitz <hangfromthefloor@gmail.com>2015-07-23 02:31:03 -0400
commit0c7d0757d6d69403fdcf5bc0fba2e6c0dfbf8b6e (patch)
treef4e30764d78f99e8822ab181bed25219f270ebe1
parent42c139d302a682339faaab011ffa8ebca2d93a2a (diff)
downloadpandoc-0c7d0757d6d69403fdcf5bc0fba2e6c0dfbf8b6e.tar.gz
Markdown Reader: Add implicit header ref tests for headers with spaces
-rw-r--r--tests/Tests/Readers/Markdown.hs20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/Tests/Readers/Markdown.hs b/tests/Tests/Readers/Markdown.hs
index a5425ffb3..78891ab54 100644
--- a/tests/Tests/Readers/Markdown.hs
+++ b/tests/Tests/Readers/Markdown.hs
@@ -225,6 +225,26 @@ tests = [ testGroup "inline code"
"# [hi]\n"
=?> headerWith ("hi",[],[]) 1 "[hi]"
]
+ , testGroup "Implicit header references"
+ [ "ATX header without trailing #s" =:
+ "# Header\n[header]\n\n[header ]\n\n[ header]" =?>
+ headerWith ("header",[],[]) 1 "Header"
+ <> para (link "#header" "" (text "header"))
+ <> para (text "[header" <> space <> text "]")
+ <> para (text "[" <> space <> text "header]")
+ , "ATX header with trailing #s" =:
+ "# Foo bar #\n[foo bar]\n\n[foo bar ]\n\n[ foo bar]" =?>
+ headerWith ("foo-bar",[],[]) 1 "Foo bar"
+ <> para (link "#foo-bar" "" (text "foo bar"))
+ <> para (text "[foo bar" <> space <> text "]")
+ <> para (text "[" <> space <> text "foo bar]")
+ , "setext header" =:
+ " Header \n=\n\n[header]\n\n[header ]\n\n[ header]" =?>
+ headerWith ("header",[],[]) 1 "Header"
+ <> para (link "#header" "" (text "header"))
+ <> para (text "[header" <> space <> text "]")
+ <> para (text "[" <> space <> text "header]")
+ ]
, testGroup "smart punctuation"
[ test markdownSmart "quote before ellipses"
("'...hi'"