diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-03-08 12:47:39 +0100 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-03-08 12:47:39 +0100 |
commit | bcfb77e2ab832d97b66e0bd06c35a9a13be437da (patch) | |
tree | 62185141a31c50195d0a8178b8579a9972591be7 | |
parent | b6e7bfaf1d9fdec88aa81d7c7fa7431358706002 (diff) | |
download | pandoc-bcfb77e2ab832d97b66e0bd06c35a9a13be437da.tar.gz |
Markdown writer: Avoid spurious blanklines at end of document...
after tables and list, for example.
-rw-r--r-- | src/Text/Pandoc/Writers/Markdown.hs | 2 | ||||
-rw-r--r-- | test/command/2834.md | 3 | ||||
-rw-r--r-- | test/command/3337.md | 3 | ||||
-rw-r--r-- | test/command/3487.md | 2 | ||||
-rw-r--r-- | test/tables.markdown | 2 | ||||
-rw-r--r-- | test/tables.plain | 2 | ||||
-rw-r--r-- | test/writer.opml | 10 |
7 files changed, 6 insertions, 18 deletions
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs index 782d0d085..ab986208d 100644 --- a/src/Text/Pandoc/Writers/Markdown.hs +++ b/src/Text/Pandoc/Writers/Markdown.hs @@ -214,7 +214,7 @@ pandocToMarkdown opts (Pandoc meta blocks) = do body <- blockListToMarkdown opts blocks' notesAndRefs' <- notesAndRefs opts let render' :: Doc -> String - render' = render colwidth + render' = render colwidth . chomp let main = render' $ body <> notesAndRefs' let context = defField "toc" (render' toc) $ defField "body" main diff --git a/test/command/2834.md b/test/command/2834.md index e4c2b3da5..850c39254 100644 --- a/test/command/2834.md +++ b/test/command/2834.md @@ -26,7 +26,4 @@ Nested grid tables. | | ----------- | | | +------------------------------------------------------------------+ | +-----------------------------------------------------------------------+ - - - ``` diff --git a/test/command/3337.md b/test/command/3337.md index 8f6735f0f..7ba14dcbb 100644 --- a/test/command/3337.md +++ b/test/command/3337.md @@ -9,8 +9,5 @@ a 1 2 --- --- - - - ``` diff --git a/test/command/3487.md b/test/command/3487.md index 2f3e2f24a..1d475676f 100644 --- a/test/command/3487.md +++ b/test/command/3487.md @@ -8,6 +8,4 @@ Some text Some text - element - - ``` diff --git a/test/tables.markdown b/test/tables.markdown index 4b5754cf9..7f89bfc08 100644 --- a/test/tables.markdown +++ b/test/tables.markdown @@ -74,5 +74,3 @@ Multiline table without column headers: the blank line between rows. ----------- ---------- ------------ -------------------------- - - diff --git a/test/tables.plain b/test/tables.plain index 4c7ebbf82..e46317a6f 100644 --- a/test/tables.plain +++ b/test/tables.plain @@ -74,5 +74,3 @@ Multiline table without column headers: the blank line between rows. ----------- ---------- ------------ -------------------------- - - diff --git a/test/writer.opml b/test/writer.opml index 261f83426..0b621823e 100644 --- a/test/writer.opml +++ b/test/writer.opml @@ -31,18 +31,18 @@ <outline text="Code Blocks" _note="Code: ---- (should be four hyphens) sub status { print "working"; } this code block is indented by one tab And: this code block is indented by two tabs These should not be escaped: \$ \\ \> \[ \{ ------------------------------------------------------------------------"> </outline> <outline text="Lists"> - <outline text="Unordered" _note="Asterisks tight: - asterisk 1 - asterisk 2 - asterisk 3 Asterisks loose: - asterisk 1 - asterisk 2 - asterisk 3 Pluses tight: - Plus 1 - Plus 2 - Plus 3 Pluses loose: - Plus 1 - Plus 2 - Plus 3 Minuses tight: - Minus 1 - Minus 2 - Minus 3 Minuses loose: - Minus 1 - Minus 2 - Minus 3 "> + <outline text="Unordered" _note="Asterisks tight: - asterisk 1 - asterisk 2 - asterisk 3 Asterisks loose: - asterisk 1 - asterisk 2 - asterisk 3 Pluses tight: - Plus 1 - Plus 2 - Plus 3 Pluses loose: - Plus 1 - Plus 2 - Plus 3 Minuses tight: - Minus 1 - Minus 2 - Minus 3 Minuses loose: - Minus 1 - Minus 2 - Minus 3"> </outline> - <outline text="Ordered" _note="Tight: 1. First 2. Second 3. Third and: 1. One 2. Two 3. Three Loose using tabs: 1. First 2. Second 3. Third and using spaces: 1. One 2. Two 3. Three Multiple paragraphs: 1. Item 1, graf one. Item 1. graf two. The quick brown fox jumped over the lazy dog’s back. 2. Item 2. 3. Item 3. "> + <outline text="Ordered" _note="Tight: 1. First 2. Second 3. Third and: 1. One 2. Two 3. Three Loose using tabs: 1. First 2. Second 3. Third and using spaces: 1. One 2. Two 3. Three Multiple paragraphs: 1. Item 1, graf one. Item 1. graf two. The quick brown fox jumped over the lazy dog’s back. 2. Item 2. 3. Item 3."> </outline> - <outline text="Nested" _note="- Tab - Tab - Tab Here’s another: 1. First 2. Second: - Fee - Fie - Foe 3. Third Same thing but with paragraphs: 1. First 2. Second: - Fee - Fie - Foe 3. Third "> + <outline text="Nested" _note="- Tab - Tab - Tab Here’s another: 1. First 2. Second: - Fee - Fie - Foe 3. Third Same thing but with paragraphs: 1. First 2. Second: - Fee - Fie - Foe 3. Third"> </outline> - <outline text="Tabs and spaces" _note="- this is a list item indented with tabs - this is a list item indented with spaces - this is an example list item indented with tabs - this is an example list item indented with spaces "> + <outline text="Tabs and spaces" _note="- this is a list item indented with tabs - this is a list item indented with spaces - this is an example list item indented with tabs - this is an example list item indented with spaces"> </outline> <outline text="Fancy list markers" _note="1. begins with 2 2. and now 3 with a continuation 1. sublist with roman numerals, starting with 4 2. more items 1. a subsublist 2. a subsublist Nesting: 1. Upper Alpha 1. Upper Roman. 1. Decimal start with 6 1. Lower alpha with paren Autonumbering: 1. Autonumber. 2. More. 1. Nested. Should not be a list item: M.A. 2007 B. Williams ------------------------------------------------------------------------"> </outline> </outline> -<outline text="Definition Lists" _note="Tight using spaces: apple red fruit orange orange fruit banana yellow fruit Tight using tabs: apple red fruit orange orange fruit banana yellow fruit Loose: apple red fruit orange orange fruit banana yellow fruit Multiple blocks with italics: *apple* red fruit contains seeds, crisp, pleasant to taste *orange* orange fruit { orange code block } > orange block quote Multiple definitions, tight: apple red fruit computer orange orange fruit bank Multiple definitions, loose: apple red fruit computer orange orange fruit bank Blank line after term, indented marker, alternate markers: apple red fruit computer orange orange fruit 1. sublist 2. sublist "> +<outline text="Definition Lists" _note="Tight using spaces: apple red fruit orange orange fruit banana yellow fruit Tight using tabs: apple red fruit orange orange fruit banana yellow fruit Loose: apple red fruit orange orange fruit banana yellow fruit Multiple blocks with italics: *apple* red fruit contains seeds, crisp, pleasant to taste *orange* orange fruit { orange code block } > orange block quote Multiple definitions, tight: apple red fruit computer orange orange fruit bank Multiple definitions, loose: apple red fruit computer orange orange fruit bank Blank line after term, indented marker, alternate markers: apple red fruit computer orange orange fruit 1. sublist 2. sublist"> </outline> <outline text="HTML Blocks" _note="Simple block on one line: foo And nested without indentation: foo bar Interpreted markdown in a table: This is *emphasized* And this is **strong** Here’s a simple block: foo This should be a code block, though: <div> foo </div> As should this: <div>foo</div> Now, nested: foo This should just be an HTML comment: Multiline: Code block: <!-- Comment --> Just plain comment, with trailing spaces on the line: Code: <hr /> Hr’s: ------------------------------------------------------------------------"> </outline> |