aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2016-08-19 21:14:52 +0200
committerAlbert Krewinkel <albert@zeitkraut.de>2016-10-10 21:12:47 +0200
commitbb48f2edc4843cc01388e0c2db7e857e7393ccf9 (patch)
tree7012cb6ed0cb9cd595bae0f00139bec9f0455b07
parentf4b7ab125e0eb034b4f90448f093d4c4a2284589 (diff)
downloadpandoc-bb48f2edc4843cc01388e0c2db7e857e7393ccf9.tar.gz
Org reader: trim verse lines properly
An empty verse line should not result in `Str ""` but in `mempty`.
-rw-r--r--src/Text/Pandoc/Readers/Org/Blocks.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/Org/Blocks.hs b/src/Text/Pandoc/Readers/Org/Blocks.hs
index 8961f73f1..82c3a6cbe 100644
--- a/src/Text/Pandoc/Readers/Org/Blocks.hs
+++ b/src/Text/Pandoc/Readers/Org/Blocks.hs
@@ -435,9 +435,11 @@ verseBlock blockType = try $ do
parseVerseLine :: String -> OrgParser (F Inlines)
parseVerseLine cs = do
let (initialSpaces, indentedLine) = span isSpace cs
- let nbspIndent = B.str $ map (const '\160') initialSpaces
+ let nbspIndent = if null initialSpaces
+ then mempty
+ else B.str $ map (const '\160') initialSpaces
line <- parseFromString inlines (indentedLine ++ "\n")
- return (pure nbspIndent <> line)
+ return (trimInlinesF $ pure nbspIndent <> line)
-- | Read a code block and the associated results block if present. Which of
-- boths blocks is included in the output is determined using the "exports"