diff options
author | Nokome Bentley <me@noko.me> | 2018-03-06 06:44:34 +1300 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2018-03-05 09:44:34 -0800 |
commit | 7d193b2aadfed75b4c85a97f24ba5b36a3961fa9 (patch) | |
tree | f5bbfec79a03861b6037b2ebba3219edefadc8d0 /test/Tests | |
parent | 475f46fa7ca731429ffb3197e6e1d1d69258ba80 (diff) | |
download | pandoc-7d193b2aadfed75b4c85a97f24ba5b36a3961fa9.tar.gz |
Remove extraneous, significant whitespace in JATS writer output (#4335)
This patch fixes some cases where the JATS writer was introducing
semantically significant whitespace by indenting and wrapping tags.
Note that the JATS spec has a content model for `<p>` tags of `(#PCDATA | ...`.
Any tag where `#PCDATA` children are possible should not have any
indentation. The same is true for `<th>`, `<td>`, `<term>`, `<label>`.
Diffstat (limited to 'test/Tests')
-rw-r--r-- | test/Tests/Writers/JATS.hs | 38 |
1 files changed, 12 insertions, 26 deletions
diff --git a/test/Tests/Writers/JATS.hs b/test/Tests/Writers/JATS.hs index 572b16451..723c0e8a8 100644 --- a/test/Tests/Writers/JATS.hs +++ b/test/Tests/Writers/JATS.hs @@ -30,8 +30,8 @@ infix 4 =: tests :: [TestTree] tests = [ testGroup "inline code" - [ "basic" =: code "@&" =?> "<p>\n <monospace>@&</monospace>\n</p>" - , "lang" =: codeWith ("", ["c"], []) "@&" =?> "<p>\n <code language=\"c\">@&</code>\n</p>" + [ "basic" =: code "@&" =?> "<p><monospace>@&</monospace></p>" + , "lang" =: codeWith ("", ["c"], []) "@&" =?> "<p><code language=\"c\">@&</code></p>" ] , testGroup "block code" [ "basic" =: codeBlock "@&" =?> "<preformat>@&</preformat>" @@ -44,7 +44,7 @@ tests = [ testGroup "inline code" ] , testGroup "inlines" [ "Emphasis" =: emph "emphasized" - =?> "<p>\n <italic>emphasized</italic>\n</p>" + =?> "<p><italic>emphasized</italic></p>" ] , "bullet list" =: bulletList [ plain $ text "first" , plain $ text "second" @@ -52,19 +52,13 @@ tests = [ testGroup "inline code" ] =?> "<list list-type=\"bullet\">\n\ \ <list-item>\n\ - \ <p>\n\ - \ first\n\ - \ </p>\n\ + \ <p>first</p>\n\ \ </list-item>\n\ \ <list-item>\n\ - \ <p>\n\ - \ second\n\ - \ </p>\n\ + \ <p>second</p>\n\ \ </list-item>\n\ \ <list-item>\n\ - \ <p>\n\ - \ third\n\ - \ </p>\n\ + \ <p>third</p>\n\ \ </list-item>\n\ \</list>" , testGroup "definition lists" @@ -72,24 +66,18 @@ tests = [ testGroup "inline code" [plain (text "hi there")])] =?> "<def-list>\n\ \ <def-item>\n\ - \ <term>\n\ - \ <xref alt=\"testing\" rid=\"go\">testing</xref>\n\ - \ </term>\n\ + \ <term><xref alt=\"testing\" rid=\"go\">testing</xref></term>\n\ \ <def>\n\ - \ <p>\n\ - \ hi there\n\ - \ </p>\n\ + \ <p>hi there</p>\n\ \ </def>\n\ \ </def-item>\n\ \</def-list>" ] , testGroup "math" [ "escape |" =: para (math "\\sigma|_{\\{x\\}}") =?> - "<p>\n\ - \ <inline-formula><alternatives>\n\ - \ <tex-math><![CDATA[\\sigma|_{\\{x\\}}]]></tex-math>\n\ - \ <mml:math display=\"inline\" xmlns:mml=\"http://www.w3.org/1998/Math/MathML\"><mml:mrow><mml:mi>σ</mml:mi><mml:msub><mml:mo stretchy=\"false\" form=\"prefix\">|</mml:mo><mml:mrow><mml:mo stretchy=\"false\" form=\"prefix\">{</mml:mo><mml:mi>x</mml:mi><mml:mo stretchy=\"false\" form=\"postfix\">}</mml:mo></mml:mrow></mml:msub></mml:mrow></mml:math></alternatives></inline-formula>\n\ - \</p>" + "<p><inline-formula><alternatives>\n\ + \<tex-math><![CDATA[\\sigma|_{\\{x\\}}]]></tex-math>\n\ + \<mml:math display=\"inline\" xmlns:mml=\"http://www.w3.org/1998/Math/MathML\"><mml:mrow><mml:mi>σ</mml:mi><mml:msub><mml:mo stretchy=\"false\" form=\"prefix\">|</mml:mo><mml:mrow><mml:mo stretchy=\"false\" form=\"prefix\">{</mml:mo><mml:mi>x</mml:mi><mml:mo stretchy=\"false\" form=\"postfix\">}</mml:mo></mml:mrow></mml:msub></mml:mrow></mml:math></alternatives></inline-formula></p>" ] , testGroup "headers" [ "unnumbered header" =: @@ -97,9 +85,7 @@ tests = [ testGroup "inline code" (text "Header 1" <> note (plain $ text "note")) =?> "<sec id=\"foo\">\n\ \ <title>Header 1<fn>\n\ - \ <p>\n\ - \ note\n\ - \ </p>\n\ + \ <p>note</p>\n\ \ </fn></title>\n\ \</sec>" , "unnumbered sub header" =: |