git.iko.soy/typeable/pandoc
on master help sign in
MediaWiki reader: Ignore `<gallery>` tags.
commit5b29f0f5983e03607712faf36d296b7b06cd1e61 authorJohn MacFarlane <jgm@berkeley.edu> dateThu 13 Sep 2012, 14:55 (14 years ago) parent81bec85
1 file changed+6−5
src/Text/Pandoc/Readers/MediaWiki.hs+6−5
src/Text/Pandoc/Readers/MediaWiki.hs+6−5
@@ -34,7 +34,6 @@ _ support internal links http://www.mediawiki.org/wiki/Help:Links
3434_ support external links (partially implemented)
3535_ support images http://www.mediawiki.org/wiki/Help:Images
3636_ support tables http://www.mediawiki.org/wiki/Help:Tables
37−_ gallery tag?
3837-}
3938module Text.Pandoc.Readers.MediaWiki ( readMediaWiki ) where
4039
@@ -77,11 +76,12 @@ spaceChars = " \n\t"
7776sym :: String -> MWParser ()
7877sym s = () <$ try (string s)
7978
79+newBlockTags :: [String]
80+newBlockTags = ["haskell","syntaxhighlight","gallery"]
81+
8082isBlockTag' :: Tag String -> Bool
81−isBlockTag' tag@(TagOpen t _) = isBlockTag tag ||
82− t == "haskell" || t == "syntaxhighlight"
83−isBlockTag' tag@(TagClose t) = isBlockTag tag ||
84− t == "haskell" || t == "syntaxhighlight"
83+isBlockTag' tag@(TagOpen t _) = isBlockTag tag || t `elem` newBlockTags
84+isBlockTag' tag@(TagClose t) = isBlockTag tag || t `elem` newBlockTags
8585isBlockTag' tag = isBlockTag tag
8686
8787htmlComment :: MWParser ()
@@ -149,6 +149,7 @@ blockTag = do
149149 "syntaxhighlight" -> syntaxhighlight attrs
150150 "haskell" -> B.codeBlockWith ("",["haskell"],[]) . trimCode <$>
151151 charsInTags "haskell"
152+ "gallery" -> blocksInTags "gallery"
152153 "p" -> return mempty
153154 _ -> return $ B.rawBlock "html" raw
154155