From c09b586147d607f645a639a47c7781e8d8655e20 Mon Sep 17 00:00:00 2001 From: Alexander <ilabdsf@gmail.com> Date: Tue, 5 Sep 2017 07:22:40 +0300 Subject: [PATCH] Muse reader: parse <div> tag (#3888) --- src/Text/Pandoc/Readers/Muse.hs | 7 +++++++ test/Tests/Readers/Muse.hs | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/src/Text/Pandoc/Readers/Muse.hs b/src/Text/Pandoc/Readers/Muse.hs index a4512cdd7..1951a47af 100644 --- a/src/Text/Pandoc/Readers/Muse.hs +++ b/src/Text/Pandoc/Readers/Muse.hs @@ -179,6 +179,7 @@ blockElements = choice [ comment , centerTag , rightTag , quoteTag + , divTag , verseTag , lineBlock , bulletList @@ -245,6 +246,12 @@ rightTag = blockTag id "right" quoteTag :: PandocMonad m => MuseParser m (F Blocks) quoteTag = withQuoteContext InDoubleQuote $ blockTag B.blockQuote "quote" +-- <div> tag is supported by Emacs Muse, but not Amusewiki 2.025 +divTag :: PandocMonad m => MuseParser m (F Blocks) +divTag = do + (attrs, content) <- parseHtmlContentWithAttrs "div" block + return $ (B.divWith attrs) <$> mconcat content + verseLine :: PandocMonad m => MuseParser m String verseLine = do line <- anyLine <|> many1Till anyChar eof diff --git a/test/Tests/Readers/Muse.hs b/test/Tests/Readers/Muse.hs index 4e5e5b606..714736c7f 100644 --- a/test/Tests/Readers/Muse.hs +++ b/test/Tests/Readers/Muse.hs @@ -145,6 +145,14 @@ tests = , " with a continuation" ] =?> blockQuote (para "This is a quotation with a continuation") + , testGroup "Div" + [ "Div without id" =: + "<div>Foo bar</div>" =?> + divWith nullAttr (para "Foo bar") + , "Div with id" =: + "<div id=\"foo\">Foo bar</div>" =?> + divWith ("foo", [], []) (para "Foo bar") + ] , "Verse" =: T.unlines [ "> This is" , "> First stanza"