aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Readers/MediaWiki.hs8
-rw-r--r--tests/mediawiki-reader.native21
-rw-r--r--tests/mediawiki-reader.wiki47
3 files changed, 67 insertions, 9 deletions
diff --git a/src/Text/Pandoc/Readers/MediaWiki.hs b/src/Text/Pandoc/Readers/MediaWiki.hs
index e9d0fe718..ed96d6ccd 100644
--- a/src/Text/Pandoc/Readers/MediaWiki.hs
+++ b/src/Text/Pandoc/Readers/MediaWiki.hs
@@ -44,13 +44,7 @@ _ raw mediawiki:
_ templates or anything in {{}} (can be postprocessed)
_ category links
_ gallery tag?
-_ tests for sup, sub, del
-_ tests for pre, haskell, syntaxhighlight
-_ tests for code, tt, hask
-_ test for blockquote
_ tests for native lists
-_ tests for autolink urls
-_ tests for external links
-}
module Text.Pandoc.Readers.MediaWiki ( readMediaWiki ) where
@@ -175,7 +169,7 @@ syntaxhighlight = try $ do
let classes = maybe [] (:[]) mblang ++ maybe [] (const ["numberLines"]) mbline
let kvs = maybe [] (\x -> [("startFrom",x)]) mbstart
contents <- charsInTags "syntaxhighlight"
- return $ B.codeBlockWith ("",classes,kvs) contents
+ return $ B.codeBlockWith ("",classes,kvs) $ trimCode contents
haskell :: MWParser Blocks
haskell = B.codeBlockWith ("",["haskell"],[]) . trimCode <$>
diff --git a/tests/mediawiki-reader.native b/tests/mediawiki-reader.native
index e8f33c062..61dff0a6e 100644
--- a/tests/mediawiki-reader.native
+++ b/tests/mediawiki-reader.native
@@ -51,7 +51,24 @@ Pandoc (Meta {docTitle = [], docAuthors = [], docDate = []})
,Para [Str "bud"]
,Para [Str "another"]
,Header 2 [Str "raw",Space,Str "html"]
-,Para [Str "hi",Space,RawInline "html" "<span style=\"color:red\">",Emph [Str "there"],RawInline "html" "</span>",Str "."]
+,Para [Str "hi",Space,RawInline "html" "<span style=\"color:red\">",Emph [Str "there"],RawInline "html" "</span>",Str ".",Space,RawInline "html" "<ins>",Str "inserted",RawInline "html" "</ins>"]
,RawBlock "html" "<div class=\"special\">"
,Para [Str "hi",Space,Emph [Str "there"]]
-,RawBlock "html" "</div>"]
+,RawBlock "html" "</div>"
+,Header 2 [Str "sup,",Space,Str "sub,",Space,Str "del"]
+,Para [Str "H",Subscript [Str "2"],Str "O",Space,Str "base",Superscript [Emph [Str "exponent"]],Space,Strikeout [Str "hello"]]
+,Header 2 [Str "inline",Space,Str "code"]
+,Para [Code ("",[],[]) "*\8594*",Space,Code ("",[],[]) "typed",Space,Code ("",["haskell"],[]) ">>="]
+,Header 2 [Str "code",Space,Str "blocks"]
+,CodeBlock ("",[],[]) "case xs of\n (_:_) -> reverse xs\n [] -> ['*']"
+,CodeBlock ("",["haskell"],[]) "case xs of\n (_:_) -> reverse xs\n [] -> ['*']"
+,CodeBlock ("",["ruby","numberLines"],[("startFrom","100")]) "widgets.each do |w|\n print w.price\nend"
+,Header 2 [Str "block",Space,Str "quotes"]
+,Para [Str "Regular",Space,Str "paragraph"]
+,BlockQuote
+ [Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "block",Space,Str "quote."]
+ ,Para [Str "With",Space,Str "two",Space,Str "paragraphs."]]
+,Para [Str "Nother",Space,Str "paragraph."]
+,Header 2 [Str "external",Space,Str "links"]
+,Para [Link [Emph [Str "Google"],Space,Str "search",Space,Str "engine"] ("http://google.com","")]
+,Para [Link [Str "http://johnmacfarlane.net/pandoc/"] ("http://johnmacfarlane.net/pandoc/","")]]
diff --git a/tests/mediawiki-reader.wiki b/tests/mediawiki-reader.wiki
index afee78007..b1f6b06c4 100644
--- a/tests/mediawiki-reader.wiki
+++ b/tests/mediawiki-reader.wiki
@@ -91,9 +91,56 @@ another
== raw html ==
hi <span style="color:red">''there''</span>.
+<ins>inserted</ins>
<div class="special">
hi ''there''
</div>
+== sup, sub, del ==
+
+H<sub>2</sub>O
+base<sup>''exponent''</sup>
+<del>hello</del>
+
+== inline code ==
+
+<code>*&rarr;*</code> <tt>typed</tt> <hask>&gt;&gt;=</hask>
+
+== code blocks ==
+
+<pre>
+case xs of
+ (_:_) -> reverse xs
+ [] -> ['*']
+</pre>
+
+<haskell>
+case xs of
+ (_:_) -> reverse xs
+ [] -> ['*']
+</haskell>
+
+<syntaxhighlight lang="ruby" line start=100>
+widgets.each do |w|
+ print w.price
+end
+</syntaxhighlight>
+
+== block quotes ==
+
+Regular paragraph
+<blockquote>
+This is a block quote.
+
+With two paragraphs.
+</blockquote>
+Nother paragraph.
+
+== external links ==
+
+[http://google.com ''Google'' search engine]
+
+http://johnmacfarlane.net/pandoc/
+