git.iko.soy/typeable/pandoc
on master help sign in
Muse reader: parse <div> tag (#3888)
commitc09b586147d607f645a639a47c7781e8d8655e20 authorAlexander <ilabdsf@gmail.com> dateTue 5 Sep 2017, 07:22 (9 years ago) parent2637df2
2 files changed+15
src/Text/Pandoc/Readers/Muse.hs+7 test/Tests/Readers/Muse.hs+8
src/Text/Pandoc/Readers/Muse.hs+7
@@ -179,6 +179,7 @@ blockElements = choice [ comment
179179 , centerTag
180180 , rightTag
181181 , quoteTag
182+ , divTag
182183 , verseTag
183184 , lineBlock
184185 , bulletList
@@ -245,6 +246,12 @@ rightTag = blockTag id "right"
245246quoteTag :: PandocMonad m => MuseParser m (F Blocks)
246247quoteTag = withQuoteContext InDoubleQuote $ blockTag B.blockQuote "quote"
247248
249+-- <div> tag is supported by Emacs Muse, but not Amusewiki 2.025
250+divTag :: PandocMonad m => MuseParser m (F Blocks)
251+divTag = do
252+ (attrs, content) <- parseHtmlContentWithAttrs "div" block
253+ return $ (B.divWith attrs) <$> mconcat content
254+
248255verseLine :: PandocMonad m => MuseParser m String
249256verseLine = do
250257 line <- anyLine <|> many1Till anyChar eof
test/Tests/Readers/Muse.hs+8
@@ -145,6 +145,14 @@ tests =
145145 , " with a continuation"
146146 ] =?>
147147 blockQuote (para "This is a quotation with a continuation")
148+ , testGroup "Div"
149+ [ "Div without id" =:
150+ "<div>Foo bar</div>" =?>
151+ divWith nullAttr (para "Foo bar")
152+ , "Div with id" =:
153+ "<div id=\"foo\">Foo bar</div>" =?>
154+ divWith ("foo", [], []) (para "Foo bar")
155+ ]
148156 , "Verse" =:
149157 T.unlines [ "> This is"
150158 , "> First stanza"