git.iko.soy/typeable/pandoc
on master help sign in
Muse reader: allow <quote> and other tags to be indented
commita7ac590b083f98bc6c98530077f0ed78e232bc0d authorAlexander Krotov <ilabdsf@gmail.com> dateWed 28 Feb 2018, 12:11 (9 years ago) parent83ce0a7
2 files changed+9−2
src/Text/Pandoc/Readers/Muse.hs+3−2 test/Tests/Readers/Muse.hs+6
src/Text/Pandoc/Readers/Muse.hs+3−2
@@ -153,6 +153,7 @@ htmlElement tag = try $ do
153153
154154htmlBlock :: PandocMonad m => String -> MuseParser m (Attr, String)
155155htmlBlock tag = try $ do
156+ many spaceChar
156157 res <- htmlElement tag
157158 manyTill spaceChar eol
158159 return res
@@ -166,7 +167,8 @@ htmlAttrToPandoc attrs = (ident, classes, keyvals)
166167
167168parseHtmlContent :: PandocMonad m
168169 => String -> MuseParser m (Attr, F Blocks)
169−parseHtmlContent tag = do
170+parseHtmlContent tag = try $ do
171+ many spaceChar
170172 (TagOpen _ attr, _) <- htmlTag (~== TagOpen tag [])
171173 manyTill spaceChar eol
172174 content <- parseBlocksTill (manyTill spaceChar endtag)
@@ -398,7 +400,6 @@ dropSpacePrefix lns =
398400
399401exampleTag :: PandocMonad m => MuseParser m (F Blocks)
400402exampleTag = try $ do
401− many spaceChar
402403 (attr, contents) <- htmlBlock "example"
403404 return $ return $ B.codeBlockWith attr $ rchop $ intercalate "\n" $ dropSpacePrefix $ splitOn "\n" $ lchop contents
404405
test/Tests/Readers/Muse.hs+6
@@ -328,6 +328,12 @@ tests =
328328 , "</quote>"
329329 ] =?>
330330 blockQuote (para "foo" <> blockQuote (para "bar") <> para "baz")
331+ , "Indented quote inside list" =:
332+ T.unlines [ " - <quote>"
333+ , " foo"
334+ , " </quote>"
335+ ] =?>
336+ bulletList [ blockQuote (para "foo") ]
331337 , "Verse tag" =:
332338 T.unlines [ "<verse>"
333339 , ""