From 5b29f0f5983e03607712faf36d296b7b06cd1e61 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 13 Sep 2012 14:55:33 -0700 Subject: MediaWiki reader: Ignore `` tags. --- src/Text/Pandoc/Readers/MediaWiki.hs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/Text/Pandoc') diff --git a/src/Text/Pandoc/Readers/MediaWiki.hs b/src/Text/Pandoc/Readers/MediaWiki.hs index 2a3399a0c..7e8e606e5 100644 --- a/src/Text/Pandoc/Readers/MediaWiki.hs +++ b/src/Text/Pandoc/Readers/MediaWiki.hs @@ -34,7 +34,6 @@ _ support internal links http://www.mediawiki.org/wiki/Help:Links _ support external links (partially implemented) _ support images http://www.mediawiki.org/wiki/Help:Images _ support tables http://www.mediawiki.org/wiki/Help:Tables -_ gallery tag? -} module Text.Pandoc.Readers.MediaWiki ( readMediaWiki ) where @@ -77,11 +76,12 @@ spaceChars = " \n\t" sym :: String -> MWParser () sym s = () <$ try (string s) +newBlockTags :: [String] +newBlockTags = ["haskell","syntaxhighlight","gallery"] + isBlockTag' :: Tag String -> Bool -isBlockTag' tag@(TagOpen t _) = isBlockTag tag || - t == "haskell" || t == "syntaxhighlight" -isBlockTag' tag@(TagClose t) = isBlockTag tag || - t == "haskell" || t == "syntaxhighlight" +isBlockTag' tag@(TagOpen t _) = isBlockTag tag || t `elem` newBlockTags +isBlockTag' tag@(TagClose t) = isBlockTag tag || t `elem` newBlockTags isBlockTag' tag = isBlockTag tag htmlComment :: MWParser () @@ -149,6 +149,7 @@ blockTag = do "syntaxhighlight" -> syntaxhighlight attrs "haskell" -> B.codeBlockWith ("",["haskell"],[]) . trimCode <$> charsInTags "haskell" + "gallery" -> blocksInTags "gallery" "p" -> return mempty _ -> return $ B.rawBlock "html" raw -- cgit v1.2.3