diff options
-rw-r--r-- | src/Text/Pandoc/Readers/MediaWiki.hs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/MediaWiki.hs b/src/Text/Pandoc/Readers/MediaWiki.hs index 5e742470c..3c44650c2 100644 --- a/src/Text/Pandoc/Readers/MediaWiki.hs +++ b/src/Text/Pandoc/Readers/MediaWiki.hs @@ -37,10 +37,8 @@ _ 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 -_ raw mediawiki: - _ templates or anything in {{}} (can be postprocessed) - _ category links _ gallery tag? +_ tests for templates (should be -> raw mediawiki) -} module Text.Pandoc.Readers.MediaWiki ( readMediaWiki ) where @@ -75,7 +73,7 @@ type MWParser = Parser [Char] ParserState -- specialChars :: [Char] -specialChars = "'[]<=&*" +specialChars = "'[]<=&*{}" spaceChars :: [Char] spaceChars = " \n\t" @@ -132,11 +130,19 @@ block = mempty <$ skipMany1 blankline <|> blockTag <|> pTag <|> blockHtml + <|> rawMediaWiki <|> para para :: MWParser Blocks para = B.para . trimInlines . mconcat <$> many1 inline +rawMediaWiki :: MWParser Blocks +rawMediaWiki = B.rawBlock "mediawiki" <$> doublebrackets + where doublebrackets = try $ do + string "{{" + contents <- manyTill anyChar (try $ string "}}") + return $ "{{" ++ contents ++ "}}" + blockTag :: MWParser Blocks blockTag = do (TagOpen t attrs, raw) <- htmlTag (\x -> isBlockTag' x && isTagOpen x) |