From bb48f2edc4843cc01388e0c2db7e857e7393ccf9 Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Fri, 19 Aug 2016 21:14:52 +0200 Subject: Org reader: trim verse lines properly An empty verse line should not result in `Str ""` but in `mempty`. --- src/Text/Pandoc/Readers/Org/Blocks.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') 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" -- cgit v1.2.3