diff options
-rw-r--r-- | src/Text/Pandoc/Readers/Muse.hs | 10 | ||||
-rw-r--r-- | test/Tests/Readers/Muse.hs | 3 |
2 files changed, 11 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 diff --git a/test/Tests/Readers/Muse.hs b/test/Tests/Readers/Muse.hs index 45dd6bc34..3dc9b0917 100644 --- a/test/Tests/Readers/Muse.hs +++ b/test/Tests/Readers/Muse.hs @@ -210,6 +210,9 @@ tests = [ test emacsMuse "Inline literal" ("Foo<literal style=\"html\">lit</literal>bar" =?> para (text "Foo" <> rawInline "html" "lit" <> text "bar")) + , test emacsMuse "Single inline literal in paragraph" + ("<literal style=\"html\">lit</literal>" =?> + para (rawInline "html" "lit")) ] ] |