@@ -37,10 +37,8 @@ _ support internal links http://www.mediawiki.org/wiki/Help:Links
37_ support external links (partially implemented)
37_ support external links (partially implemented)
38_ support images http://www.mediawiki.org/wiki/Help:Images
38_ support images http://www.mediawiki.org/wiki/Help:Images
39_ support tables http://www.mediawiki.org/wiki/Help:Tables
39_ support tables http://www.mediawiki.org/wiki/Help:Tables
41− _ templates or anything in {{}} (can be postprocessed)
43_ gallery tag?
40_ gallery tag?
41+_ tests for templates (should be -> raw mediawiki)
45module Text.Pandoc.Readers.MediaWiki ( readMediaWiki ) where
43module Text.Pandoc.Readers.MediaWiki ( readMediaWiki ) where
@@ -75,7 +73,7 @@ type MWParser = Parser [Char] ParserState
77specialChars :: [Char]
75specialChars :: [Char]
78−specialChars = "'[]<=&*"
76+specialChars = "'[]<=&*{}"
80spaceChars :: [Char]
78spaceChars :: [Char]
81spaceChars = " \n\t"
79spaceChars = " \n\t"
@@ -132,11 +130,19 @@ block = mempty <$ skipMany1 blankline
132 <|> blockTag
130 <|> blockTag
134 <|> blockHtml
132 <|> blockHtml
137para :: MWParser Blocks
136para :: MWParser Blocks
138para = B.para . trimInlines . mconcat <$> many1 inline
137para = B.para . trimInlines . mconcat <$> many1 inline
139+rawMediaWiki :: MWParser Blocks
140+rawMediaWiki = B.rawBlock "mediawiki" <$> doublebrackets
141+ where doublebrackets = try $ do
143+ contents <- manyTill anyChar (try $ string "}}")
144+ return $ "{{" ++ contents ++ "}}"
140blockTag :: MWParser Blocks
146blockTag :: MWParser Blocks
141blockTag = do
147blockTag = do
142 (TagOpen t attrs, raw) <- htmlTag (\x -> isBlockTag' x && isTagOpen x)
148 (TagOpen t attrs, raw) <- htmlTag (\x -> isBlockTag' x && isTagOpen x)