git.iko.soy/typeable/pandoc
on master help sign in
Muse reader: allow verse to be indented
a812298Alexander Krotov
src/Text/Pandoc/Readers/Muse.hs+1
@@ -558,6 +558,7 @@ blanklineVerseLine = try $ do
558-- | Parse a line block indicated by @\'>\'@ characters.
558-- | Parse a line block indicated by @\'>\'@ characters.
559lineBlock :: PandocMonad m => MuseParser m (F Blocks)
559lineBlock :: PandocMonad m => MuseParser m (F Blocks)
560lineBlock = try $ do
560lineBlock = try $ do
561+ many spaceChar
561 col <- sourceColumn <$> getPosition
562 col <- sourceColumn <$> getPosition
562 lns <- (blanklineVerseLine <|> lineVerseLine) `sepBy1'` try (indentWith (col - 1))
563 lns <- (blanklineVerseLine <|> lineVerseLine) `sepBy1'` try (indentWith (col - 1))
563 return $ B.lineBlock <$> sequence lns
564 return $ B.lineBlock <$> sequence lns
test/Tests/Readers/Muse.hs+18
@@ -1153,6 +1153,24 @@ tests =
1153 definitionList [ ("First term", [ para "Definition of first term\nand its continuation." ])
1153 definitionList [ ("First term", [ para "Definition of first term\nand its continuation." ])
1154 , ("Second term", [ para "Definition of second term." ])
1154 , ("Second term", [ para "Definition of second term." ])
1155 ]
1155 ]
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+ ]
1156 , test emacsMuse "Multi-line definition lists from Emacs Muse manual"
1174 , test emacsMuse "Multi-line definition lists from Emacs Muse manual"
1157 (T.unlines
1175 (T.unlines
1158 [ "Term1 ::"
1176 [ "Term1 ::"