summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Shared.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-03-10 20:44:49 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2017-03-10 20:45:21 +0100
commitba78b75146d9d02de64b400a78402aac884f0644 (patch)
treec2070c52e429b4ca97c29e2a9231025c88c47129 /src/Text/Pandoc/Shared.hs
parenta197dc9d3fa578d223ab07884906351cced646c9 (diff)
Removed normalizeSpaces from Text.Pandoc.Shared.
Rewrote functions in RST reader and writer to avoid the need for it. Closes #1530.
Diffstat (limited to 'src/Text/Pandoc/Shared.hs')
-rw-r--r--src/Text/Pandoc/Shared.hs20
1 files changed, 0 insertions, 20 deletions
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs
index 2eacbcc1c..3b9ae7501 100644
--- a/src/Text/Pandoc/Shared.hs
+++ b/src/Text/Pandoc/Shared.hs
@@ -53,7 +53,6 @@ module Text.Pandoc.Shared (
normalizeDate,
-- * Pandoc block and inline list processing
orderedListMarkers,
- normalizeSpaces,
extractSpaces,
removeFormatting,
deNote,
@@ -354,25 +353,6 @@ orderedListMarkers (start, numstyle, numdelim) =
TwoParens -> "(" ++ str ++ ")"
in map inDelim nums
--- | Normalize a list of inline elements: remove leading and trailing
--- @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 [] = []
- cleanup (Space:rest) = case dropWhile isSpaceOrEmpty rest of
- [] -> []
- (x:xs) -> Space : x : cleanup xs
- cleanup ((Str ""):rest) = cleanup rest
- cleanup (x:rest) = x : cleanup rest
-
-isSpaceOrEmpty :: Inline -> Bool
-isSpaceOrEmpty Space = True
-isSpaceOrEmpty SoftBreak = True
-isSpaceOrEmpty LineBreak = True
-isSpaceOrEmpty (Str "") = True
-isSpaceOrEmpty _ = False
-
-- | Extract the leading and trailing spaces from inside an inline element
-- and place them outside the element. SoftBreaks count as Spaces for
-- these purposes.