aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorAlexander Krotov <ilabdsf@gmail.com>2018-03-25 17:27:54 +0300
committerAlexander Krotov <ilabdsf@gmail.com>2018-03-25 18:31:28 +0300
commitc6232d0f7d4aa18db4870b1fdb8ba701822e2889 (patch)
tree5c9fc361437b055df56b675bc925f16dbe3646e1 /src/Text
parent2582de5384c80369a0bf5dcefba641505e1ca7be (diff)
downloadpandoc-c6232d0f7d4aa18db4870b1fdb8ba701822e2889.tar.gz
Muse reader: require block <literal> tags to be on separate lines
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Readers/Muse.hs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/Muse.hs b/src/Text/Pandoc/Readers/Muse.hs
index c9157b7d3..d40e74c96 100644
--- a/src/Text/Pandoc/Readers/Muse.hs
+++ b/src/Text/Pandoc/Readers/Muse.hs
@@ -404,9 +404,15 @@ exampleTag = try $ do
return $ return $ B.codeBlockWith attr $ rchop $ intercalate "\n" $ dropSpacePrefix $ splitOn "\n" $ lchop contents
literalTag :: PandocMonad m => MuseParser m (F Blocks)
-literalTag =
- (return . rawBlock) <$> htmlBlock "literal"
+literalTag = try $ do
+ many spaceChar
+ (TagOpen _ attr, _) <- htmlTag (~== TagOpen "literal" [])
+ manyTill spaceChar eol
+ content <- manyTill anyChar endtag
+ manyTill spaceChar eol
+ return $ return $ rawBlock (htmlAttrToPandoc attr, content)
where
+ endtag = void $ htmlTag (~== TagClose "literal")
-- FIXME: Emacs Muse inserts <literal> without style into all output formats, but we assume HTML
format (_, _, kvs) = fromMaybe "html" $ lookup "style" kvs
rawBlock (attrs, content) = B.rawBlock (format attrs) $ rchop $ intercalate "\n" $ dropSpacePrefix $ splitOn "\n" $ lchop content