diff options
author | Alexander Krotov <ilabdsf@gmail.com> | 2018-02-28 12:11:56 +0300 |
---|---|---|
committer | Alexander Krotov <ilabdsf@gmail.com> | 2018-02-28 12:11:56 +0300 |
commit | a7ac590b083f98bc6c98530077f0ed78e232bc0d (patch) | |
tree | bc7b0ad6e4290d8477651301cca5646bd0422787 | |
parent | 83ce0a789ddcdb7ab8eaa8c21f25af88aa5a7c67 (diff) | |
download | pandoc-a7ac590b083f98bc6c98530077f0ed78e232bc0d.tar.gz |
Muse reader: allow <quote> and other tags to be indented
-rw-r--r-- | src/Text/Pandoc/Readers/Muse.hs | 5 | ||||
-rw-r--r-- | test/Tests/Readers/Muse.hs | 6 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/Muse.hs b/src/Text/Pandoc/Readers/Muse.hs index 26da57883..d86c46aca 100644 --- a/src/Text/Pandoc/Readers/Muse.hs +++ b/src/Text/Pandoc/Readers/Muse.hs @@ -153,6 +153,7 @@ htmlElement tag = try $ do htmlBlock :: PandocMonad m => String -> MuseParser m (Attr, String) htmlBlock tag = try $ do + many spaceChar res <- htmlElement tag manyTill spaceChar eol return res @@ -166,7 +167,8 @@ htmlAttrToPandoc attrs = (ident, classes, keyvals) parseHtmlContent :: PandocMonad m => String -> MuseParser m (Attr, F Blocks) -parseHtmlContent tag = do +parseHtmlContent tag = try $ do + many spaceChar (TagOpen _ attr, _) <- htmlTag (~== TagOpen tag []) manyTill spaceChar eol content <- parseBlocksTill (manyTill spaceChar endtag) @@ -398,7 +400,6 @@ dropSpacePrefix lns = exampleTag :: PandocMonad m => MuseParser m (F Blocks) exampleTag = try $ do - many spaceChar (attr, contents) <- htmlBlock "example" return $ return $ B.codeBlockWith attr $ rchop $ intercalate "\n" $ dropSpacePrefix $ splitOn "\n" $ lchop contents diff --git a/test/Tests/Readers/Muse.hs b/test/Tests/Readers/Muse.hs index d951fca49..3537ab040 100644 --- a/test/Tests/Readers/Muse.hs +++ b/test/Tests/Readers/Muse.hs @@ -328,6 +328,12 @@ tests = , "</quote>" ] =?> blockQuote (para "foo" <> blockQuote (para "bar") <> para "baz") + , "Indented quote inside list" =: + T.unlines [ " - <quote>" + , " foo" + , " </quote>" + ] =?> + bulletList [ blockQuote (para "foo") ] , "Verse tag" =: T.unlines [ "<verse>" , "" |