git.iko.soy/typeable/pandoc
on master help sign in
Org reader: trim verse lines properly

An empty verse line should not result in `Str ""` but in `mempty`.

commitbb48f2edc4843cc01388e0c2db7e857e7393ccf9 authorAlbert Krewinkel <albert@zeitkraut.de> dateFri 19 Aug 2016, 21:14 (10 years ago) parentf4b7ab1
1 file changed+4−2
src/Text/Pandoc/Readers/Org/Blocks.hs+4−2
src/Text/Pandoc/Readers/Org/Blocks.hs+4−2
@@ -435,9 +435,11 @@ verseBlock blockType = try $ do
435435 parseVerseLine :: String -> OrgParser (F Inlines)
436436 parseVerseLine cs = do
437437 let (initialSpaces, indentedLine) = span isSpace cs
438− let nbspIndent = B.str $ map (const '\160') initialSpaces
438+ let nbspIndent = if null initialSpaces
439+ then mempty
440+ else B.str $ map (const '\160') initialSpaces
439441 line <- parseFromString inlines (indentedLine ++ "\n")
440− return (pure nbspIndent <> line)
442+ return (trimInlinesF $ pure nbspIndent <> line)
441443
442444-- | Read a code block and the associated results block if present. Which of
443445-- boths blocks is included in the output is determined using the "exports"