More mediawiki reader tests.
This commit is contained in:
parent
b19aee4e1e
commit
a76c6df826
3 changed files with 67 additions and 9 deletions
|
@ -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 <$>
|
||||
|
|
|
@ -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/","")]]
|
||||
|
|
|
@ -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>*→*</code> <tt>typed</tt> <hask>>>=</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/
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue