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 ++++++++++++++++++++++++++++++++++++---------- test/command/853.md | 5 ++-- test/writer.html4 | 66 +++++++++++++++++++++++++++-------------- test/writer.html5 | 66 +++++++++++++++++++++++++++-------------- 4 files changed, 149 insertions(+), 61 deletions(-) (limited to 'test') 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.

" , "
" ] ] diff --git a/test/command/853.md b/test/command/853.md index bcc3b4654..518c6593b 100644 --- a/test/command/853.md +++ b/test/command/853.md @@ -12,8 +12,9 @@ class="citation">[CIT2002].

CIT2002
-

This is the citation. It's just like a footnote, except the label -is textual.

+
+

This is the citation. It's just like a footnote, except the label is +textual.

diff --git a/test/writer.html4 b/test/writer.html4 index e2adcf5bc..1e255fa70 100644 --- a/test/writer.html4 +++ b/test/writer.html4 @@ -376,47 +376,58 @@ back.

Tight using spaces:

apple
-
red fruit +
+red fruit
orange
-
orange fruit +
+orange fruit
banana
-
yellow fruit +
+yellow fruit

Tight using tabs:

apple
-
red fruit +
+red fruit
orange
-
orange fruit +
+orange fruit
banana
-
yellow fruit +
+yellow fruit

Loose:

apple
-

red fruit

+
+

red fruit

orange
-

orange fruit

+
+

orange fruit

banana
-

yellow fruit

+
+

yellow fruit

Multiple blocks with italics:

apple
-

red fruit

+
+

red fruit

contains seeds, crisp, pleasant to taste

orange
-

orange fruit

+
+

orange fruit

{ orange code block }

orange block quote

@@ -426,38 +437,49 @@ back.

Multiple definitions, tight:

apple
-
red fruit +
+red fruit
-
computer +
+computer
orange
-
orange fruit +
+orange fruit
-
bank +
+bank

Multiple definitions, loose:

apple
-

red fruit

+
+

red fruit

-

computer

+
+

computer

orange
-

orange fruit

+
+

orange fruit

-

bank

+
+

bank

Blank line after term, indented marker, alternate markers:

apple
-

red fruit

+
+

red fruit

-

computer

+
+

computer

orange
-

orange fruit

+
+

orange fruit

  1. sublist
  2. sublist
  3. diff --git a/test/writer.html5 b/test/writer.html5 index cdfcf042f..d8e89b3e2 100644 --- a/test/writer.html5 +++ b/test/writer.html5 @@ -379,47 +379,58 @@ back.

    Tight using spaces:

    apple
    -
    red fruit +
    +red fruit
    orange
    -
    orange fruit +
    +orange fruit
    banana
    -
    yellow fruit +
    +yellow fruit

    Tight using tabs:

    apple
    -
    red fruit +
    +red fruit
    orange
    -
    orange fruit +
    +orange fruit
    banana
    -
    yellow fruit +
    +yellow fruit

    Loose:

    apple
    -

    red fruit

    +
    +

    red fruit

    orange
    -

    orange fruit

    +
    +

    orange fruit

    banana
    -

    yellow fruit

    +
    +

    yellow fruit

    Multiple blocks with italics:

    apple
    -

    red fruit

    +
    +

    red fruit

    contains seeds, crisp, pleasant to taste

    orange
    -

    orange fruit

    +
    +

    orange fruit

    { orange code block }

    orange block quote

    @@ -429,38 +440,49 @@ back.

    Multiple definitions, tight:

    apple
    -
    red fruit +
    +red fruit
    -
    computer +
    +computer
    orange
    -
    orange fruit +
    +orange fruit
    -
    bank +
    +bank

    Multiple definitions, loose:

    apple
    -

    red fruit

    +
    +

    red fruit

    -

    computer

    +
    +

    computer

    orange
    -

    orange fruit

    +
    +

    orange fruit

    -

    bank

    +
    +

    bank

    Blank line after term, indented marker, alternate markers:

    apple
    -

    red fruit

    +
    +

    red fruit

    -

    computer

    +
    +

    computer

    orange
    -

    orange fruit

    +
    +

    orange fruit

    1. sublist
    2. sublist
    3. -- cgit v1.2.3