summaryrefslogtreecommitdiff
path: root/test/Tests
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2022-02-06 23:05:20 +0100
committerGitHub <noreply@github.com>2022-02-06 23:05:20 +0100
commit876859f9e95ba2dd2de2f197caf53184700ec335 (patch)
tree4f3f80146088a66b7d6b4ac91a1781640bd5619b /test/Tests
parentfaf99ad356ab828958a7b48c55e8c23a97f1c36d (diff)
Docbook writer: Interpret links without contents as cross-references (#7360)
Links without text contents are converted to `<xref>` elements. DocBook processors will generate appropriate cross-reference text when presented with an xref element.
Diffstat (limited to 'test/Tests')
-rw-r--r--test/Tests/Writers/Docbook.hs20
1 files changed, 17 insertions, 3 deletions
diff --git a/test/Tests/Writers/Docbook.hs b/test/Tests/Writers/Docbook.hs
index f517f803a..a95140ac5 100644
--- a/test/Tests/Writers/Docbook.hs
+++ b/test/Tests/Writers/Docbook.hs
@@ -32,9 +32,11 @@ which is in turn shorthand for
-}
infix 4 =:
-(=:) :: (ToString a, ToPandoc a)
- => String -> (a, String) -> TestTree
+(=:), testDb4, testDb5 :: (ToString a, ToPandoc a)
+ => String -> (a, String) -> TestTree
(=:) = test docbook
+testDb4 = test docbook
+testDb5 = test docbook5
lineblock :: Blocks
lineblock = para ("some text" <> linebreak <>
@@ -47,7 +49,19 @@ lineblock_out = [ "<literallayout>some text"
]
tests :: [TestTree]
-tests = [ testGroup "line blocks"
+tests = [ testGroup "inline elements"
+ [ testGroup "links"
+ [ testDb4 "db4 external link" $ link "https://example.com" "" "Hello"
+ =?> "<ulink url=\"https://example.com\">Hello</ulink>"
+ , testDb5 "db5 external link" $ link "https://example.com" "" "Hello"
+ =?> "<link xlink:href=\"https://example.com\">Hello</link>"
+ , testDb5 "anchor" $ link "#foo" "" "Hello"
+ =?> "<link linkend=\"foo\">Hello</link>"
+ , testDb5 "automatic anchor" $ link "#foo" "" ""
+ =?> "<xref linkend=\"foo\"></xref>"
+ ]
+ ]
+ , testGroup "line blocks"
[ "none" =: para "This is a test"
=?> unlines
[ "<para>"