Muse reader: do not produce empty Str element for unindented verse lines

This commit is contained in:
Alexander Krotov 2018-03-07 14:21:31 +03:00
parent 54a6b75510
commit 4d2bf177fc
2 changed files with 4 additions and 2 deletions

View file

@ -506,9 +506,10 @@ emacsNoteBlock = try $ do
lineVerseLine :: PandocMonad m => MuseParser m (F Inlines)
lineVerseLine = try $ do
string "> "
indent <- B.str <$> many (char ' ' >> pure '\160')
indent <- many (char ' ' >> pure '\160')
let indentEl = if null indent then mempty else B.str indent
rest <- manyTill (choice inlineList) eol
return $ trimInlinesF $ mconcat (pure indent : rest)
return $ trimInlinesF $ mconcat (pure indentEl : rest)
blanklineVerseLine :: PandocMonad m => MuseParser m (F Inlines)
blanklineVerseLine = try $ do

View file

@ -296,6 +296,7 @@ tests =
]
]
, "Verse in list" =: " - > foo" =?> bulletList [ lineBlock [ "foo" ] ]
, "Verse line starting with emphasis" =: "> *foo* bar" =?> lineBlock [ emph "foo" <> text " bar" ]
, "Multiline verse in list" =:
T.unlines [ " - > foo"
, " > bar"