From 65cc909fdee4dbc93ba0cf1c04ff64780caae57e Mon Sep 17 00:00:00 2001 From: Francesco Occhipinti Date: Sun, 18 Mar 2018 03:21:27 +0100 Subject: RST writer: strip whitespace within inlines, closes #4327 (#4329) + Whitespace is ignored at the beginning and end of emphasis, as per . + Export `stripLeadingTrailingSpace` from `Text.Pandoc.Writers.Shared`. --- src/Text/Pandoc/Writers/RST.hs | 4 +++- src/Text/Pandoc/Writers/Shared.hs | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src/Text/Pandoc') diff --git a/src/Text/Pandoc/Writers/RST.hs b/src/Text/Pandoc/Writers/RST.hs index 95cb46643..91bc9d66a 100644 --- a/src/Text/Pandoc/Writers/RST.hs +++ b/src/Text/Pandoc/Writers/RST.hs @@ -379,7 +379,9 @@ blockListToRST = blockListToRST' False -- | Convert list of Pandoc inline elements to RST. inlineListToRST :: PandocMonad m => [Inline] -> RST m Doc inlineListToRST lst = - mapM inlineToRST (removeSpaceAfterDisplayMath $ insertBS lst) >>= + mapM inlineToRST ((stripLeadingTrailingSpace . + removeSpaceAfterDisplayMath . + insertBS) lst) >>= return . hcat where -- remove spaces after displaymath, as they screw up indentation: removeSpaceAfterDisplayMath (Math DisplayMath x : zs) = diff --git a/src/Text/Pandoc/Writers/Shared.hs b/src/Text/Pandoc/Writers/Shared.hs index ae4cc5cc5..5c3469d4d 100644 --- a/src/Text/Pandoc/Writers/Shared.hs +++ b/src/Text/Pandoc/Writers/Shared.hs @@ -41,6 +41,7 @@ module Text.Pandoc.Writers.Shared ( , unsmartify , gridTable , metaValueToInlines + , stripLeadingTrailingSpace ) where import Control.Monad (zipWithM) -- cgit v1.2.3