From 7f6bbfadf43ace8b8b75e787916ed35ae2e6b1e6 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 20 Oct 2014 20:26:08 -0700 Subject: Pretty: Make CR + BLANKLINE = BLANKLINE. This fixes an extra blank line we were getting at the end of markdown fragments (as well as rst, org, etc.) Closes #1705. --- src/Text/Pandoc/Pretty.hs | 3 +++ tests/tables.asciidoc | 1 - tests/tables.haddock | 1 - tests/tables.org | 1 - tests/tables.rst | 1 - tests/writer.opml | 10 +++++----- 6 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/Text/Pandoc/Pretty.hs b/src/Text/Pandoc/Pretty.hs index 1e72c2040..9ee7fe94a 100644 --- a/src/Text/Pandoc/Pretty.hs +++ b/src/Text/Pandoc/Pretty.hs @@ -286,6 +286,9 @@ renderList (BlankLines num : xs) = do | otherwise -> replicateM_ (1 + num - newlines st) (outp (-1) "\n") renderList xs +renderList (CarriageReturn : BlankLines m : xs) = + renderList (BlankLines m : xs) + renderList (CarriageReturn : xs) = do st <- get if newlines st > 0 || null xs diff --git a/tests/tables.asciidoc b/tests/tables.asciidoc index ba647866a..2a24544a3 100644 --- a/tests/tables.asciidoc +++ b/tests/tables.asciidoc @@ -65,4 +65,3 @@ Multiline table without column headers: |First |row |12.0 |Example of a row that spans multiple lines. |Second |row |5.0 |Here's another one. Note the blank line between rows. |======================================================================= - diff --git a/tests/tables.haddock b/tests/tables.haddock index 413ec97ad..f9efdc0de 100644 --- a/tests/tables.haddock +++ b/tests/tables.haddock @@ -74,4 +74,3 @@ Multiline table without column headers: > the blank line between > rows. > ----------- ---------- ------------ -------------------------- - diff --git a/tests/tables.org b/tests/tables.org index 8d9100d07..9eaf5e706 100644 --- a/tests/tables.org +++ b/tests/tables.org @@ -49,4 +49,3 @@ Multiline table without column headers: | First | row | 12.0 | Example of a row that spans multiple lines. | | Second | row | 5.0 | Here's another one. Note the blank line between rows. | - diff --git a/tests/tables.rst b/tests/tables.rst index e77f69d97..25d5932ea 100644 --- a/tests/tables.rst +++ b/tests/tables.rst @@ -88,4 +88,3 @@ Multiline table without column headers: | | | | the blank line between | | | | | rows. | +-------------+------------+--------------+----------------------------+ - diff --git a/tests/writer.opml b/tests/writer.opml index 54be4b671..840c3c6e1 100644 --- a/tests/writer.opml +++ b/tests/writer.opml @@ -18,7 +18,7 @@ - + @@ -55,18 +55,18 @@ - + - + - + - + -- cgit v1.2.3