git.iko.soy/typeable/pandoc
on master help sign in
Muse reader: add support for <biblio> and <play> tags
ebbd441Alexander Krotov
src/Text/Pandoc/Readers/Muse.hs+15−2
@@ -36,8 +36,7 @@ TODO:
36- Org tables
36- Org tables
37- table.el tables
37- table.el tables
38- Images with attributes (floating and width)
38- Images with attributes (floating and width)
39−- Citations and <biblio>
39+- <cite> tag
40−- <play> environment
41-}
40-}
42module Text.Pandoc.Readers.Muse (readMuse) where
41module Text.Pandoc.Readers.Muse (readMuse) where
43
42
@@ -322,6 +321,8 @@ blockElements = do
322 , rightTag
321 , rightTag
323 , quoteTag
322 , quoteTag
324 , divTag
323 , divTag
324+ , biblioTag
325+ , playTag
325 , verseTag
326 , verseTag
326 , lineBlock
327 , lineBlock
327 , table
328 , table
@@ -413,6 +414,18 @@ divTag = do
413 (attrs, content) <- parseHtmlContent "div"
414 (attrs, content) <- parseHtmlContent "div"
414 return $ B.divWith attrs <$> content
415 return $ B.divWith attrs <$> content
415
416
417+-- <biblio> tag is supported by Amusewiki only
418+biblioTag :: PandocMonad m => MuseParser m (F Blocks)
419+biblioTag = do
420+ guardEnabled Ext_amuse
421+ fmap (B.divWith ("", ["biblio"], [])) . snd <$> parseHtmlContent "biblio"
422+
423+-- <play> tag is supported by Amusewiki only
424+playTag :: PandocMonad m => MuseParser m (F Blocks)
425+playTag = do
426+ guardEnabled Ext_amuse
427+ fmap (B.divWith ("", ["play"], [])) . snd <$> parseHtmlContent "play"
428+
416verseLine :: PandocMonad m => MuseParser m (F Inlines)
429verseLine :: PandocMonad m => MuseParser m (F Inlines)
417verseLine = do
430verseLine = do
418 indent <- (B.str <$> many1 (char ' ' >> pure '\160')) <|> pure mempty
431 indent <- (B.str <$> many1 (char ' ' >> pure '\160')) <|> pure mempty
test/Tests/Readers/Muse.hs+17
@@ -281,6 +281,23 @@ tests =
281 ] =?>
281 ] =?>
282 divWith ("foo", [], []) (para "Foo bar")
282 divWith ("foo", [], []) (para "Foo bar")
283 ]
283 ]
284+ , "Biblio" =:
285+ T.unlines [ "<biblio>"
286+ , ""
287+ , "Author, *Title*, description"
288+ , ""
289+ , "Another author, *Another title*, another description"
290+ , ""
291+ , "</biblio>"
292+ ] =?>
293+ divWith ("", ["biblio"], []) (para (text "Author, " <> emph "Title" <> ", description") <>
294+ para (text "Another author, " <> emph "Another title" <> text ", another description"))
295+ , "Play" =:
296+ T.unlines [ "<play>"
297+ , "Foo bar"
298+ , "</play>"
299+ ] =?>
300+ divWith ("", ["play"], []) (para "Foo bar")
284 , "Verse" =:
301 , "Verse" =:
285 T.unlines [ "> This is"
302 T.unlines [ "> This is"
286 , "> First stanza"
303 , "> First stanza"