From c4f6e6cb57e4fdda9ad59ff7220988810583ec60 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 21 Dec 2021 22:53:22 -0800 Subject: HTML writer: make line breaks more consistent. - With `--wrap=none`, we now output line breaks between block-level elements. Previously they were omitted entirely, so the whole document was on one line, unless there were literal line breaks in pre sections. This makes the HTML writer's behavior more consistent with that of other writers. - Put newline after `
`. - Put newlines after block-level elements in footnote section. --- test/Tests/Writers/HTML.hs | 73 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 58 insertions(+), 15 deletions(-) (limited to 'test/Tests/Writers') diff --git a/test/Tests/Writers/HTML.hs b/test/Tests/Writers/HTML.hs index 50775b171..a81badae8 100644 --- a/test/Tests/Writers/HTML.hs +++ b/test/Tests/Writers/HTML.hs @@ -2,6 +2,7 @@ module Tests.Writers.HTML (tests) where import Data.Text (unpack) +import qualified Data.Text as T import Test.Tasty import Tests.Helpers import Text.Pandoc @@ -68,7 +69,7 @@ tests = , testGroup "blocks" [ "definition list with empty
" =: definitionList [(mempty, [para $ text "foo bar"])] - =?> "

foo bar

" + =?> "
\n
\n
\n

foo bar

\n
\n
" , "heading with disallowed attributes" =: headerWith ("", [], [("invalid","1"), ("lang", "en")]) 1 "test" =?> @@ -108,37 +109,66 @@ tests = [ test (htmlWithOpts def{writerReferenceLocation=EndOfDocument}) "at the end of a document" $ noteTestDoc =?> - concat + T.unlines [ "

Page title

" , "

First section

" , "

This is a footnote.1 And this is a link.

" - , "

A note inside a block quote.2

A second paragraph.

" + , "
" + , "

A note inside a block quote.2

" + , "

A second paragraph.

" + , "
" , "

Second section

" , "

Some more text.

" - , "

  1. Down here.↩︎

  2. The second note.↩︎

" + , "
" + , "
" + , "
    " + , "
  1. Down here.↩︎

  2. " + , "
  3. The second note.↩︎

  4. " + , "
" + , "
" ] , test (htmlWithOpts def{writerReferenceLocation=EndOfBlock}) "at the end of a block" $ noteTestDoc =?> - concat + T.unlines [ "

Page title

" , "

First section

" , "

This is a footnote.1 And this is a link.

" - , "
  1. Down here.↩︎

" - , "

A note inside a block quote.2

A second paragraph.

" - , "
  1. The second note.↩︎

" + , "
" + , "
    " + , "
  1. Down here.↩︎

  2. " + , "
" + , "
" + , "
" + , "

A note inside a block quote.2

" + , "

A second paragraph.

" + , "
" + , "
" + , "
    " + , "
  1. The second note.↩︎

  2. " + , "
" + , "
" , "

Second section

" , "

Some more text.

" ] , test (htmlWithOpts def{writerReferenceLocation=EndOfSection}) "at the end of a section" $ noteTestDoc =?> - concat + T.unlines [ "

Page title

" , "

First section

" , "

This is a footnote.1 And this is a link.

" - , "

A note inside a block quote.2

A second paragraph.

" - , "

  1. Down here.↩︎

  2. The second note.↩︎

" + , "
" + , "

A note inside a block quote.2

" + , "

A second paragraph.

" + , "
" + , "
" + , "
" + , "
    " + , "
  1. Down here.↩︎

  2. " + , "
  3. The second note.↩︎

  4. " + , "
" + , "
" , "

Second section

" , "

Some more text.

" ] @@ -147,15 +177,28 @@ tests = noteTestDoc =?> -- Footnotes are rendered _after_ their section (in this case after the level2 section -- that contains it). - concat + T.unlines [ "
" , "

Page title

" , "
" , "

First section

" - , "

This is a footnote.1 And this is a link.

A note inside a block quote.2

A second paragraph.

" + , "

This is a footnote.1 And this is a link.

" + , "
" + , "

A note inside a block quote.2

" + , "

A second paragraph.

" + , "
" + , "
" + , "
" + , "
" + , "
    " + , "
  1. Down here.↩︎

  2. " + , "
  3. The second note.↩︎

  4. " + , "
" + , "
" + , "
" + , "

Second section

" + , "

Some more text.

" , "
" - , "

  1. Down here.↩︎

  2. The second note.↩︎

" - , "

Second section

Some more text.

" , "
" ] ] -- cgit v1.2.3