aboutsummaryrefslogtreecommitdiff
path: root/test/Tests/Writers
diff options
context:
space:
mode:
authorOle Martin Ruud <barskern@outlook.com>2019-10-25 07:27:49 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2019-10-24 22:27:49 -0700
commit45479114e88a351fc63bb8eff142bb10cfd2c661 (patch)
treec7942576b5f590b78bab5c74c88a6a843afa78bd /test/Tests/Writers
parent91c325c714050313429f6d553d7fa1bef15892a2 (diff)
downloadpandoc-45479114e88a351fc63bb8eff142bb10cfd2c661.tar.gz
HTML reader/writer: Better handling of <q> with cite attribute (#5837)
* HTML reader: Handle cite attribute for quotes. If a `<q>` tag has a `cite` attribute, we interpret it as a Quoted element with an inner Span. Closes #5798 * Refactor url canonicalization into a helper function * Modify HTML writer to handle quote with cite. [0]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/q
Diffstat (limited to 'test/Tests/Writers')
-rw-r--r--test/Tests/Writers/HTML.hs17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/Tests/Writers/HTML.hs b/test/Tests/Writers/HTML.hs
index de8b1ef17..94549e0d8 100644
--- a/test/Tests/Writers/HTML.hs
+++ b/test/Tests/Writers/HTML.hs
@@ -13,6 +13,11 @@ import Text.Pandoc.Builder
html :: (ToPandoc a) => a -> String
html = unpack . purely (writeHtml4String def{ writerWrapText = WrapNone }) . toPandoc
+htmlQTags :: (ToPandoc a) => a -> String
+htmlQTags = unpack
+ . purely (writeHtml4String def{ writerWrapText = WrapNone, writerHtmlQTags = True })
+ . toPandoc
+
{-
"my test" =: X =?> Y
@@ -48,4 +53,16 @@ tests = [ testGroup "inline code"
definitionList [(mempty, [para $ text "foo bar"])]
=?> "<dl><dt></dt><dd><p>foo bar</p></dd></dl>"
]
+ , testGroup "quotes"
+ [ "quote with cite attribute (without q-tags)" =:
+ doubleQuoted (spanWith ("", [], [("cite", "http://example.org")]) (str "examples"))
+ =?> "“<span cite=\"http://example.org\">examples</span>”"
+ , tQ "quote with cite attribute (with q-tags)" $
+ doubleQuoted (spanWith ("", [], [("cite", "http://example.org")]) (str "examples"))
+ =?> "<q cite=\"http://example.org\">examples</q>"
+ ]
]
+ where
+ tQ :: (ToString a, ToPandoc a)
+ => String -> (a, String) -> TestTree
+ tQ = test htmlQTags