git.iko.soy/typeable/pandoc
on master help sign in
Muse reader: improve verse parsing

Now verse marked up with ">" (in contrast to <verse> tag) can be placed inside lists.

commit2eab8f465410db57a7df27631a83058f8f480d89 authorAlexander Krotov <ilabdsf@gmail.com> dateWed 14 Feb 2018, 13:41 (9 years ago) parente810a5c
2 files changed+13−1
src/Text/Pandoc/Readers/Muse.hs+2−1 test/Tests/Readers/Muse.hs+11
src/Text/Pandoc/Readers/Muse.hs+2−1
@@ -521,7 +521,8 @@ blanklineVerseLine = try $ do
521521
522522lineBlock :: PandocMonad m => MuseParser m (F Blocks)
523523lineBlock = try $ do
524− lns <- many1 (blanklineVerseLine <|> lineVerseLine)
524+ col <- sourceColumn <$> getPosition
525+ lns <- (blanklineVerseLine <|> lineVerseLine) `sepBy1'` try (indentWith (col - 1))
525526 return $ B.lineBlock <$> sequence lns
526527
527528--
test/Tests/Readers/Muse.hs+11
@@ -296,6 +296,17 @@ tests =
296296 , "\160\160\160is here"
297297 ]
298298 ]
299+ , "Verse in list" =: " - > foo" =?> bulletList [ lineBlock [ "foo" ] ]
300+ , "Multiline verse in list" =:
301+ T.unlines [ " - > foo"
302+ , " > bar"
303+ ] =?>
304+ bulletList [ lineBlock [ "foo", "bar" ] ]
305+ , "Paragraph after verse in list" =:
306+ T.unlines [ " - > foo"
307+ , " bar"
308+ ] =?>
309+ bulletList [ lineBlock [ "foo" ] <> para "bar" ]
299310 , "Empty quote tag" =:
300311 T.unlines [ "<quote>"
301312 , "</quote>"