git.iko.soy/typeable/pandoc
on master help sign in
Muse reader: allow verse to be indented

Muse writer indents verse blocks in definition list more than necessary, so Muse reader should parse them.

commita8122987fc3301bc6c0b799312cc2f676bec8042 authorAlexander Krotov <ilabdsf@gmail.com> dateMon 16 Apr 2018, 15:08 (9 years ago) parentfb014e6
2 files changed+19
src/Text/Pandoc/Readers/Muse.hs+1 test/Tests/Readers/Muse.hs+18
src/Text/Pandoc/Readers/Muse.hs+1
@@ -558,6 +558,7 @@ blanklineVerseLine = try $ do
558558-- | Parse a line block indicated by @\'>\'@ characters.
559559lineBlock :: PandocMonad m => MuseParser m (F Blocks)
560560lineBlock = try $ do
561+ many spaceChar
561562 col <- sourceColumn <$> getPosition
562563 lns <- (blanklineVerseLine <|> lineVerseLine) `sepBy1'` try (indentWith (col - 1))
563564 return $ B.lineBlock <$> sequence lns
test/Tests/Readers/Muse.hs+18
@@ -1153,6 +1153,24 @@ tests =
11531153 definitionList [ ("First term", [ para "Definition of first term\nand its continuation." ])
11541154 , ("Second term", [ para "Definition of second term." ])
11551155 ]
1156+ , "Definition list with verse" =:
1157+ T.unlines
1158+ [ " First term :: Definition of first term"
1159+ , " > First verse"
1160+ , " > Second line of first verse"
1161+ , ""
1162+ , " > Second verse"
1163+ , " > Second line of second verse"
1164+ ] =?>
1165+ definitionList [ ("First term", [ para "Definition of first term" <>
1166+ lineBlock [ text "First verse"
1167+ , text "Second line of first verse"
1168+ ] <>
1169+ lineBlock [ text "Second verse"
1170+ , text "Second line of second verse"
1171+ ]
1172+ ])
1173+ ]
11561174 , test emacsMuse "Multi-line definition lists from Emacs Muse manual"
11571175 (T.unlines
11581176 [ "Term1 ::"