aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-03-10 20:21:17 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2017-03-10 20:33:14 +0100
commit9862d7c359ce4f9e5f89c4ee5131e0f051c134d2 (patch)
tree6ff75afdfb87db37069411dfa9a33d477bb31192 /src
parentd037c5019d51b9fc64690f5e73158c1dd683012b (diff)
downloadpandoc-9862d7c359ce4f9e5f89c4ee5131e0f051c134d2.tar.gz
Shared.normalizeSpaces: strip off leading/trailing line breaks...
...not just spaces.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Shared.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs
index 19d915b11..2eacbcc1c 100644
--- a/src/Text/Pandoc/Shared.hs
+++ b/src/Text/Pandoc/Shared.hs
@@ -355,8 +355,8 @@ orderedListMarkers (start, numstyle, numdelim) =
in map inDelim nums
-- | Normalize a list of inline elements: remove leading and trailing
--- @Space@ elements, collapse double @Space@s into singles, and
--- remove empty Str elements.
+-- @Space@, @LineBreak@, and @SoftBreak@ elements, collapse double
+-- @Space@s into singles, and remove empty @Str@ elements.
normalizeSpaces :: [Inline] -> [Inline]
normalizeSpaces = cleanup . dropWhile isSpaceOrEmpty
where cleanup [] = []
@@ -368,6 +368,8 @@ normalizeSpaces = cleanup . dropWhile isSpaceOrEmpty
isSpaceOrEmpty :: Inline -> Bool
isSpaceOrEmpty Space = True
+isSpaceOrEmpty SoftBreak = True
+isSpaceOrEmpty LineBreak = True
isSpaceOrEmpty (Str "") = True
isSpaceOrEmpty _ = False