diff options
-rw-r--r-- | src/Text/Pandoc/Readers/Muse.hs | 11 | ||||
-rw-r--r-- | test/Tests/Readers/Muse.hs | 9 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Readers/Muse.hs b/src/Text/Pandoc/Readers/Muse.hs index 9f1ba1e6c..0a0e86df8 100644 --- a/src/Text/Pandoc/Readers/Muse.hs +++ b/src/Text/Pandoc/Readers/Muse.hs @@ -577,6 +577,7 @@ inlineList = [ endline , link , code , codeTag + , inlineLiteralTag , whitespace , str , symbol @@ -693,6 +694,16 @@ codeTag = do (attrs, content) <- parseHtmlContentWithAttrs "code" anyChar return $ return $ B.codeWith attrs $ fromEntities content +inlineLiteralTag :: PandocMonad m => MuseParser m (F Inlines) +inlineLiteralTag = do + guardDisabled Ext_amuse -- Text::Amuse does not support <literal> + (attrs, content) <- parseHtmlContentWithAttrs "literal" anyChar + return $ return $ rawInline (attrs, content) + where + -- FIXME: Emacs Muse inserts <literal> without style into all output formats, but we assume HTML + format (_, _, kvs) = fromMaybe "html" $ lookup "style" kvs + rawInline (attrs, content) = B.rawInline (format attrs) $ fromEntities content + str :: PandocMonad m => MuseParser m (F Inlines) str = fmap (return . B.str) (many1 alphaNum <|> count 1 characterReference) diff --git a/test/Tests/Readers/Muse.hs b/test/Tests/Readers/Muse.hs index e260e4bea..0202dfb6d 100644 --- a/test/Tests/Readers/Muse.hs +++ b/test/Tests/Readers/Muse.hs @@ -149,6 +149,15 @@ tests = , "No implicit links" =: "http://example.org/index.php?action=view&id=1" =?> para "http://example.org/index.php?action=view&id=1" ] + + , testGroup "Literal" + [ test emacsMuse "Inline literal" + ("Foo<literal style=\"html\">lit</literal>bar" =?> + para (text "Foo" <> rawInline "html" "lit" <> text "bar")) + , "No literal in Text::Amuse" =: + "Foo<literal style=\"html\">lit</literal>bar" =?> + para "Foo<literal style=\"html\">lit</literal>bar" + ] ] , testGroup "Blocks" |