From 7d193b2aadfed75b4c85a97f24ba5b36a3961fa9 Mon Sep 17 00:00:00 2001 From: Nokome Bentley Date: Tue, 6 Mar 2018 06:44:34 +1300 Subject: 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 `

` tags of `(#PCDATA | ...`. Any tag where `#PCDATA` children are possible should not have any indentation. The same is true for ``, ``, ``, `

\n @&\n

" - , "lang" =: codeWith ("", ["c"], []) "@&" =?> "

\n @&\n

" + [ "basic" =: code "@&" =?> "

@&

" + , "lang" =: codeWith ("", ["c"], []) "@&" =?> "

@&

" ] , testGroup "block code" [ "basic" =: codeBlock "@&" =?> "@&" @@ -44,7 +44,7 @@ tests = [ testGroup "inline code" ] , testGroup "inlines" [ "Emphasis" =: emph "emphasized" - =?> "

\n emphasized\n

" + =?> "

emphasized

" ] , "bullet list" =: bulletList [ plain $ text "first" , plain $ text "second" @@ -52,19 +52,13 @@ tests = [ testGroup "inline code" ] =?> "\n\ \ \n\ - \

\n\ - \ first\n\ - \

\n\ + \

first

\n\ \
\n\ \ \n\ - \

\n\ - \ second\n\ - \

\n\ + \

second

\n\ \
\n\ \ \n\ - \

\n\ - \ third\n\ - \

\n\ + \

third

\n\ \
\n\ \
" , testGroup "definition lists" @@ -72,24 +66,18 @@ tests = [ testGroup "inline code" [plain (text "hi there")])] =?> "\n\ \ \n\ - \ \n\ - \ testing\n\ - \ \n\ + \ testing\n\ \ \n\ - \

\n\ - \ hi there\n\ - \

\n\ + \

hi there

\n\ \
\n\ \
\n\ \
" ] , testGroup "math" [ "escape |" =: para (math "\\sigma|_{\\{x\\}}") =?> - "

\n\ - \ \n\ - \ \n\ - \ σ|{x}\n\ - \

" + "

\n\ + \\n\ + \σ|{x}

" ] , testGroup "headers" [ "unnumbered header" =: @@ -97,9 +85,7 @@ tests = [ testGroup "inline code" (text "Header 1" <> note (plain $ text "note")) =?> "\n\ \ Header 1<fn>\n\ - \ <p>\n\ - \ note\n\ - \ </p>\n\ + \ <p>note</p>\n\ \ </fn>\n\ \" , "unnumbered sub header" =: -- cgit v1.2.3