Added tests for mediawiki lists.
This commit is contained in:
parent
a76c6df826
commit
def768cd1f
3 changed files with 107 additions and 3 deletions
|
@ -44,7 +44,6 @@ _ raw mediawiki:
|
|||
_ templates or anything in {{}} (can be postprocessed)
|
||||
_ category links
|
||||
_ gallery tag?
|
||||
_ tests for native lists
|
||||
-}
|
||||
module Text.Pandoc.Readers.MediaWiki ( readMediaWiki ) where
|
||||
|
||||
|
@ -308,7 +307,9 @@ url = do
|
|||
return $ B.link src "" (B.str orig)
|
||||
|
||||
nowiki :: MWParser Inlines
|
||||
nowiki = B.text <$> charsInTags "nowiki"
|
||||
nowiki = B.text . fromEntities <$> try
|
||||
(htmlTag (~== TagOpen "nowiki" []) *>
|
||||
manyTill anyChar (htmlTag (~== TagClose "nowiki")))
|
||||
|
||||
strikeout :: MWParser Inlines
|
||||
strikeout = B.strikeout <$> (inlinesInTags "strike" <|> inlinesInTags "del")
|
||||
|
|
|
@ -71,4 +71,62 @@ Pandoc (Meta {docTitle = [], docAuthors = [], docDate = []})
|
|||
,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/","")]]
|
||||
,Para [Link [Str "http://johnmacfarlane.net/pandoc/"] ("http://johnmacfarlane.net/pandoc/","")]
|
||||
,Header 2 [Str "lists"]
|
||||
,BulletList
|
||||
[[Plain [Str "Start",Space,Str "each",Space,Str "line"]]
|
||||
,[Plain [Str "with",Space,Str "an",Space,Str "asterisk",Space,Str "(*)."]
|
||||
,BulletList
|
||||
[[Plain [Str "More",Space,Str "asterisks",Space,Str "gives",Space,Str "deeper"]
|
||||
,BulletList
|
||||
[[Plain [Str "and",Space,Str "deeper",Space,Str "levels."]]]]]]
|
||||
,[Plain [Str "Line",Space,Str "breaks",LineBreak,Str "don't",Space,Str "break",Space,Str "levels."]
|
||||
,BulletList
|
||||
[[BulletList
|
||||
[[Plain [Str "But",Space,Str "jumping",Space,Str "levels",Space,Str "creates",Space,Str "empty",Space,Str "space."]]]]]]]
|
||||
,Para [Str "Any",Space,Str "other",Space,Str "start",Space,Str "ends",Space,Str "the",Space,Str "list."]
|
||||
,OrderedList (1,DefaultStyle,DefaultDelim)
|
||||
[[Plain [Str "Start",Space,Str "each",Space,Str "line"]]
|
||||
,[Plain [Str "with",Space,Str "a",Space,Str "number",Space,Str "sign",Space,Str "(#)."]
|
||||
,OrderedList (1,DefaultStyle,DefaultDelim)
|
||||
[[Plain [Str "More",Space,Str "number",Space,Str "signs",Space,Str "gives",Space,Str "deeper"]
|
||||
,OrderedList (1,DefaultStyle,DefaultDelim)
|
||||
[[Plain [Str "and",Space,Str "deeper"]]
|
||||
,[Plain [Str "levels."]]]]]]
|
||||
,[Plain [Str "Line",Space,Str "breaks",LineBreak,Str "don't",Space,Str "break",Space,Str "levels."]
|
||||
,OrderedList (1,DefaultStyle,DefaultDelim)
|
||||
[[OrderedList (1,DefaultStyle,DefaultDelim)
|
||||
[[Plain [Str "But",Space,Str "jumping",Space,Str "levels",Space,Str "creates",Space,Str "empty",Space,Str "space."]]]]]]
|
||||
,[Plain [Str "Blank",Space,Str "lines"]]]
|
||||
,OrderedList (1,DefaultStyle,DefaultDelim)
|
||||
[[Plain [Str "end",Space,Str "the",Space,Str "list",Space,Str "and",Space,Str "start",Space,Str "another."]]]
|
||||
,Para [Str "Any",Space,Str "other",Space,Str "start",Space,Str "also",Space,Str "ends",Space,Str "the",Space,Str "list."]
|
||||
,DefinitionList
|
||||
[([Str "item",Space,Str "1"],
|
||||
[[Plain [Str "definition",Space,Str "1"]]])
|
||||
,([Str "item",Space,Str "2"],
|
||||
[[Plain [Str "definition",Space,Str "2-1"]]
|
||||
,[Plain [Str "definition",Space,Str "2-2"]]])]
|
||||
,OrderedList (1,DefaultStyle,DefaultDelim)
|
||||
[[Plain [Str "one"]]
|
||||
,[Plain [Str "two"]
|
||||
,BulletList
|
||||
[[Plain [Str "two",Space,Str "point",Space,Str "one"]]
|
||||
,[Plain [Str "two",Space,Str "point",Space,Str "two"]]]]
|
||||
,[Plain [Str "three"]
|
||||
,DefinitionList
|
||||
[([Str "three",Space,Str "item",Space,Str "one"],
|
||||
[[Plain [Str "three",Space,Str "def",Space,Str "one"]]])]]
|
||||
,[Plain [Str "four"]
|
||||
,DefinitionList
|
||||
[([],
|
||||
[[Plain [Str "four",Space,Str "def",Space,Str "one"]]
|
||||
,[Plain [Str "this",Space,Str "looks",Space,Str "like",Space,Str "a",Space,Str "continuation"]]
|
||||
,[Plain [Str "and",Space,Str "is",Space,Str "often",Space,Str "used"]]
|
||||
,[Plain [Str "instead",LineBreak,Str "of",Space,Str "<br/>"]]])]]
|
||||
,[Plain [Str "five"]
|
||||
,OrderedList (1,DefaultStyle,DefaultDelim)
|
||||
[[Plain [Str "five",Space,Str "sub",Space,Str "1"]
|
||||
,OrderedList (1,DefaultStyle,DefaultDelim)
|
||||
[[Plain [Str "five",Space,Str "sub",Space,Str "1",Space,Str "sub",Space,Str "1"]]]]
|
||||
,[Plain [Str "five",Space,Str "sub",Space,Str "2"]]]]]]
|
||||
|
|
|
@ -143,4 +143,49 @@ Nother paragraph.
|
|||
|
||||
http://johnmacfarlane.net/pandoc/
|
||||
|
||||
== lists ==
|
||||
|
||||
* Start each line
|
||||
* with an asterisk (*).
|
||||
** More asterisks gives deeper
|
||||
*** and deeper levels.
|
||||
* Line breaks<br/>don't break levels.
|
||||
*** But jumping levels creates empty space.
|
||||
Any other start ends the list.
|
||||
|
||||
# Start each line
|
||||
# with a number sign (#).
|
||||
## More number signs gives deeper
|
||||
### and deeper
|
||||
### levels.
|
||||
# Line breaks<br/>don't break levels.
|
||||
### But jumping levels creates empty space.
|
||||
# Blank lines
|
||||
|
||||
# end the list and start another.
|
||||
Any other start also
|
||||
ends the list.
|
||||
|
||||
;item 1
|
||||
: definition 1
|
||||
;item 2
|
||||
: definition 2-1
|
||||
: definition 2-2
|
||||
|
||||
# one
|
||||
# two
|
||||
#* two point one
|
||||
#* two point two
|
||||
# three
|
||||
#; three item one
|
||||
#: three def one
|
||||
# four
|
||||
#: four def one
|
||||
#: this looks like a continuation
|
||||
#: and is often used
|
||||
#: instead<br/>of <nowiki><br/></nowiki>
|
||||
# five
|
||||
## five sub 1
|
||||
### five sub 1 sub 1
|
||||
## five sub 2
|
||||
|
||||
|
|
Loading…
Reference in a new issue