diff options
author | Jan Tojnar <jtojnar@gmail.com> | 2020-12-07 07:28:39 +0100 |
---|---|---|
committer | Jan Tojnar <jtojnar@gmail.com> | 2020-12-07 07:28:39 +0100 |
commit | 70c7c5703afcbd1cbf2a80c2be515e038abcd419 (patch) | |
tree | 02ac02004ac34304d68fe1d50b67efc38939b36e /test | |
parent | 16ef87745702f69d5aa948fbe6d2101577dee8f4 (diff) | |
download | pandoc-70c7c5703afcbd1cbf2a80c2be515e038abcd419.tar.gz |
Docbook writer: Handle admonition titles from Markdown reader
Docbook reader produces a `Div` with `title` class for `<title>` element
within an “admonition” element. Markdown writer then turns this
into a fenced div with `title` class attribute. Since fenced divs
are block elements, their content is recognized as a paragraph
by the Markdown reader. This is an issue for Docbook writer because
it would produce an invalid DocBook document from such AST –
the `<title>` element can only contain “inline” elements.
Let’s handle this invalid special case separately by unwrapping
the paragraph before creating the `<title>` element.
Diffstat (limited to 'test')
-rw-r--r-- | test/Tests/Writers/Docbook.hs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/Tests/Writers/Docbook.hs b/test/Tests/Writers/Docbook.hs index 1d53dcfe7..621c1280b 100644 --- a/test/Tests/Writers/Docbook.hs +++ b/test/Tests/Writers/Docbook.hs @@ -93,6 +93,20 @@ tests = [ testGroup "line blocks" , " </para>" , "</attention>" ] + , "admonition-with-title-in-para" =: + divWith ("foo", ["attention"], []) ( + divWith ("foo", ["title"], []) + (para "This is title") <> + para "This is a test" + ) + =?> unlines + [ "<attention id=\"foo\">" + , " <title>This is title</title>" + , " <para>" + , " This is a test" + , " </para>" + , "</attention>" + ] , "single-child" =: divWith ("foo", [], []) (para "This is a test") =?> unlines |