aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlbert Krewinkel <tarleb@moltkeplatz.de>2014-04-30 11:16:01 +0200
committerAlbert Krewinkel <tarleb@moltkeplatz.de>2014-05-01 11:50:32 +0200
commit8726eebcd363ccb33ea8c297b004feca7ef37ceb (patch)
tree997287a359d9ea03e60eb850a5148c339e96df25 /tests
parenta22b3a218dece2cf9861c8c38ff239cd96ae0a06 (diff)
downloadpandoc-8726eebcd363ccb33ea8c297b004feca7ef37ceb.tar.gz
Org reader: Add support for custom link types
Org allows users to define their own custom link types. E.g., in a document with a lot of links to Wikipedia articles, one can define a custom wikipedia link-type via #+LINK: wp https://en.wikipedia.org/wiki/ This allows to write [[wp:Org_mode][Org-mode]] instead of the equivallent [[https://en.wikipedia.org/wiki/Org_mode][Org-mode]].
Diffstat (limited to 'tests')
-rw-r--r--tests/Tests/Readers/Org.hs26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/Tests/Readers/Org.hs b/tests/Tests/Readers/Org.hs
index 96747d148..78684f0f1 100644
--- a/tests/Tests/Readers/Org.hs
+++ b/tests/Tests/Readers/Org.hs
@@ -304,6 +304,32 @@ tests =
] =?>
(para (spanWith ("link-here", [], []) mempty <> "Target.") <>
para (emph ("See" <> space <> "here!")))
+
+ , "Link abbreviation" =:
+ unlines [ "#+LINK: wp https://en.wikipedia.org/wiki/%s"
+ , "[[wp:Org_mode][Wikipedia on Org-mode]]"
+ ] =?>
+ (para (link "https://en.wikipedia.org/wiki/Org_mode" ""
+ ("Wikipedia" <> space <> "on" <> space <> "Org-mode")))
+
+ , "Link abbreviation, defined after first use" =:
+ unlines [ "[[zl:non-sense][Non-sense articles]]"
+ , "#+LINK: zl http://zeitlens.com/tags/%s.html"
+ ] =?>
+ (para (link "http://zeitlens.com/tags/non-sense.html" ""
+ ("Non-sense" <> space <> "articles")))
+
+ , "Link abbreviation, URL encoded arguments" =:
+ unlines [ "#+link: expl http://example.com/%h/foo"
+ , "[[expl:Hello, World!][Moin!]]"
+ ] =?>
+ (para (link "http://example.com/Hello%2C%20World%21/foo" "" "Moin!"))
+
+ , "Link abbreviation, append arguments" =:
+ unlines [ "#+link: expl http://example.com/"
+ , "[[expl:foo][bar]]"
+ ] =?>
+ (para (link "http://example.com/foo" "" "bar"))
]
, testGroup "Basic Blocks" $