summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/RST.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/Readers/RST.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/Readers/RST.hs')
-rw-r--r--src/Text/Pandoc/Readers/RST.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs
index 0adc190c3..f27b02f25 100644
--- a/src/Text/Pandoc/Readers/RST.hs
+++ b/src/Text/Pandoc/Readers/RST.hs
@@ -141,6 +141,12 @@ metaFromDefList ds meta = adjustAuthors $ foldr f meta ds
splitAuthors x = x
splitAuthors' = map normalizeSpaces .
splitOnSemi . concatMap factorSemi
+ normalizeSpaces = reverse . dropWhile isSp . reverse .
+ dropWhile isSp
+ isSp Space = True
+ isSp SoftBreak = True
+ isSp LineBreak = True
+ isSp _ = False
splitOnSemi = splitBy (==Str ";")
factorSemi (Str []) = []
factorSemi (Str s) = case break (==';') s of