From 2ae75e23dd740e968245269d8765d5b5af3a5f35 Mon Sep 17 00:00:00 2001 From: rlpowell Date: Fri, 21 Jul 2017 01:09:54 -0700 Subject: Added TikiWiki reader (#3800) Added TikiWiki reader, including tests and documentation. It's probably not *complete*, but it works pretty well, handles all the basics (and some not-so-basics). --- test/Tests/Old.hs | 3 + test/tikiwiki-reader.native | 130 +++++++++++++++++++++++++++++++++++++ test/tikiwiki-reader.tikiwiki | 148 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 281 insertions(+) create mode 100644 test/tikiwiki-reader.native create mode 100644 test/tikiwiki-reader.tikiwiki (limited to 'test') diff --git a/test/Tests/Old.hs b/test/Tests/Old.hs index b807719bc..c4dd4d322 100644 --- a/test/Tests/Old.hs +++ b/test/Tests/Old.hs @@ -137,6 +137,9 @@ tests = [ testGroup "markdown" , testGroup "twiki" [ test "reader" ["-r", "twiki", "-w", "native", "-s"] "twiki-reader.twiki" "twiki-reader.native" ] + , testGroup "tikiwiki" + [ test "reader" ["-r", "tikiwiki", "-w", "native", "-s"] + "tikiwiki-reader.tikiwiki" "tikiwiki-reader.native" ] , testGroup "other writers" $ map (\f -> testGroup f $ writerTests f) [ "opendocument" , "context" , "texinfo", "icml", "tei" , "man" , "plain" , "rtf", "org", "asciidoc", "zimwiki" diff --git a/test/tikiwiki-reader.native b/test/tikiwiki-reader.native new file mode 100644 index 000000000..2ab053217 --- /dev/null +++ b/test/tikiwiki-reader.native @@ -0,0 +1,130 @@ +Pandoc (Meta {unMeta = fromList []}) +[Header 1 ("header",[],[]) [Str "header"] +,Header 2 ("header-level-two",[],[]) [Str "header",Space,Str "level",Space,Str "two"] +,Header 3 ("header-level-3",[],[]) [Str "header",Space,Str "level",Space,Str "3"] +,Header 4 ("header-_level_-four",[],[]) [Str "header",Space,Str "_level_",Space,Str "four"] +,Header 5 ("header-level-5",[],[]) [Str "header",Space,Str "level",Space,Str "5"] +,Header 6 ("header-level-6",[],[]) [Str "header",Space,Str "level",Space,Str "6"] +,Para [Str "!!!!!!!",Space,Str "not",Space,Str "a",Space,Str "header"] +,Para [Str "--++",Space,Str "not",Space,Str "a",Space,Str "header"] +,Header 1 ("emph-and-strong",[],[]) [Str "emph",Space,Str "and",Space,Str "strong"] +,Para [Emph [Str "emph"],Space,Strong [Str "strong"]] +,Para [Emph [Strong [Str "strong",Space,Str "and",Space,Str "emph",Space,Str "1"]]] +,Para [Strong [Emph [Str "strong",Space,Str "and",Space,Str "emph",Space,Str "2"]]] +,Para [Strong [Emph [Str "emph",Space,Str "inside"],Space,Str "strong"]] +,Para [Strong [Str "strong",Space,Str "with",Space,Emph [Str "emph"]]] +,Para [Emph [Strong [Str "strong",Space,Str "inside"],Space,Str "emph"]] +,Header 1 ("horizontal-rule",[],[]) [Str "horizontal",Space,Str "rule"] +,Para [Str "top"] +,HorizontalRule +,Para [Str "bottom"] +,HorizontalRule +,Header 1 ("nop",[],[]) [Str "nop"] +,Para [Str "__not emph__"] +,Header 1 ("entities",[],[]) [Str "entities"] +,Para [Str "hi",Space,Str "&",Space,Str "low"] +,Para [Str "hi",Space,Str "&",Space,Str "low"] +,Para [Str "G\246del"] +,Para [Str "\777\2730"] +,Header 1 ("linebreaks",[],[]) [Str "linebreaks"] +,Para [Str "hi",LineBreak,Str "there"] +,Para [Str "hi",LineBreak,Str "there"] +,Header 1 ("inline-code",[],[]) [Str "inline",Space,Str "code"] +,Para [Code ("",[],[]) "*\8594*",Space,Code ("",[],[]) "typed",Space,Code ("",[],[]) ">>="] +,Header 1 ("code-blocks",[],[]) [Str "code",Space,Str "blocks"] +,CodeBlock ("",[],[]) "\ncase xs of\n (_:_) -> reverse xs\n [] -> ['*']\n" +,CodeBlock ("",["haskell"],[("colors","haskell"),("ln","0")]) "\ncase xs of\n (_:_) -> reverse xs\n [] -> ['*']\n" +,Header 1 ("external-links",[],[]) [Str "external",Space,Str "links"] +,Para [Link ("",[],[]) [Emph [Str "Google"],Space,Str "search",Space,Str "engine"] ("http://google.com","")] +,Para [Link ("",[],[]) [Str "http://pandoc.org"] ("http://pandoc.org","")] +,Para [Link ("",[],[]) [Str "http://google.com"] ("http://google.com",""),Space,Link ("",[],[]) [Str "http://yahoo.com"] ("http://yahoo.com","")] +,Para [Link ("",[],[]) [Str "email",Space,Str "me"] ("mailto:info@example.org","")] +,Para [Str "http://google.com"] +,Para [Str "info@example.org"] +,Header 1 ("lists",[],[]) [Str "lists"] +,BulletList + [[Plain [Str "Start",Space,Str "each",Space,Str "line",Space]] + ,[Plain [Str "with",Space,Str "an",Space,Str "asterisk",Space,Str "(*).",Space] + ,BulletList + [[Plain [Str "More",Space,Str "asterisks",Space,Str "gives",Space,Str "deeper",Space] + ,BulletList + [[Plain [Str "and",Space,Str "deeper",Space,Str "levels.",Space]]]]]] + ,[Plain [Str "Line",Space,Str "breaks",LineBreak,Str "don't",Space,Str "break",Space,Str "levels.",Space]] + ,[Plain [Str "Continuations",Space,Str "are",Space,Str "also",Space,Str "possible",Space] + ,BulletList + [[Plain [Str "and",Space,Str "do",Space,Str "not",Space,Str "break",Space,Str "the",Space,Str "list",Space,Str "flow",Space]]]] + ,[Plain [Str "Level",Space,Str "one",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",Space]] + ,[Plain [Str "with",Space,Str "a",Space,Str "number",Space,Str "(1.).",Space] + ,OrderedList (1,DefaultStyle,DefaultDelim) + [[Plain [Str "More",Space,Str "number",Space,Str "signs",Space,Str "gives",Space,Str "deeper",Space] + ,OrderedList (1,DefaultStyle,DefaultDelim) + [[Plain [Str "and",Space,Str "deeper",Space]] + ,[Plain [Str "levels.",Space]]]]]] + ,[Plain [Str "Line",Space,Str "breaks",LineBreak,Str "don't",Space,Str "break",Space,Str "levels.",Space]] + ,[Plain [Str "Blank",Space,Str "lines",Space]]] +,OrderedList (1,DefaultStyle,DefaultDelim) + [[Plain [Str "end",Space,Str "the",Space,Str "list",Space,Str "and",Space,Str "start",Space,Str "another.",Space]]] +,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",Space]]]) + ,([Str "item",Space,Str "2"], + [[Plain [Str "definition",Space,Str "2-1",Space,Str "definition",Space,Str "2-2",Space]]]) + ,([Str "item",Space,Emph [Str "3"]], + [[Plain [Str "definition",Space,Emph [Str "3"],Space]]])] +,OrderedList (1,DefaultStyle,DefaultDelim) + [[Plain [Str "one",Space]] + ,[Plain [Str "two",Space] + ,BulletList + [[Plain [Str "two",Space,Str "point",Space,Str "one",Space]] + ,[Plain [Str "two",Space,Str "point",Space,Str "two",Space]]]] + ,[Plain [Str "three",Space]] + ,[Plain [Str "four",Space]] + ,[Plain [Str "five",Space] + ,OrderedList (1,DefaultStyle,DefaultDelim) + [[Plain [Str "five",Space,Str "sub",Space,Str "1",Space] + ,OrderedList (1,DefaultStyle,DefaultDelim) + [[Plain [Str "five",Space,Str "sub",Space,Str "1",Space,Str "sub",Space,Str "1",Space]]]] + ,[Plain [Str "five",Space,Str "sub",Space,Str "2",Space]]]]] +,Header 1 ("tables",[],[]) [Str "tables"] +,Table [] [AlignDefault,AlignDefault] [0.0,0.0] + [[Plain [Str ""]] + ,[Plain [Str ""]]] + [[[Plain [Str "Orange"]] + ,[Plain [Str "Apple"]]] + ,[[Plain [Str "Bread"]] + ,[Plain [Str "Pie"]]] + ,[[Plain [Str "Butter"]] + ,[Plain [Str "Ice",Space,Str "cream"]]]] +,Table [] [AlignDefault,AlignDefault] [0.0,0.0] + [[Plain [Str ""]] + ,[Plain [Str ""]]] + [[[Plain [Str "Orange"]] + ,[Plain [Str "Apple"]]] + ,[[Plain [Str "Bread"]] + ,[Plain [Str "Pie"]]] + ,[[Plain [Strong [Str "Butter"]]] + ,[Plain [Str "Ice",Space,Str "cream"]]]] +,Table [] [AlignDefault,AlignDefault] [0.0,0.0] + [[Plain [Str ""]] + ,[Plain [Str ""]]] + [[[Plain [Str "Orange"]] + ,[Plain [Str "Apple"]]] + ,[[Plain [Str "Bread",LineBreak,LineBreak,Str "and",Space,Str "cheese"]] + ,[Plain [Str "Pie",LineBreak,LineBreak,Strong [Str "apple"],Space,Str "and",Space,Emph [Str "carrot"],Space]]]] +,Table [] [AlignDefault,AlignDefault,AlignDefault] [0.0,0.0,0.0] + [[Plain [Str ""]] + ,[Plain [Str ""]] + ,[Plain [Str ""]]] + [[[Plain [Space,Str "Orange",Space]] + ,[Plain [Space,Str "Apple",Space]] + ,[Plain [Space,Str "more"]]] + ,[[Plain [Space,Str "Bread",Space]] + ,[Plain [Space,Str "Pie",Space]] + ,[Plain [Space,Str "more"]]] + ,[[Plain [Space,Str "Butter",Space]] + ,[Plain [Space,Str "Ice",Space,Str "cream",Space]] + ,[Plain [Space,Str "and",Space,Str "more",Space]]]]] diff --git a/test/tikiwiki-reader.tikiwiki b/test/tikiwiki-reader.tikiwiki new file mode 100644 index 000000000..d1971feb1 --- /dev/null +++ b/test/tikiwiki-reader.tikiwiki @@ -0,0 +1,148 @@ +! header + +!! header level two + +!!! header level 3 + +!!!! header _level_ four + +!!!!! header level 5 + +!!!!!! header level 6 + +!!!!!!! not a header + + --++ not a header + +! emph and strong + +''emph'' __strong__ + +''__strong and emph 1__'' + +__''strong and emph 2''__ + +__''emph inside'' strong__ + +__strong with ''emph''__ + +''__strong inside__ emph'' + +! horizontal rule + +top +---- +bottom + +---- + +! nop + +~np~__not emph__~/np~ + +! entities + +hi & low + +hi & low + +Gödel + +̉પ + +! linebreaks + +hi%%%there + +hi%%% +there + +! inline code + +-+*→*+- -+typed+- -+>>=+- + +! code blocks + +{CODE()} +case xs of + (_:_) -> reverse xs + [] -> ['*'] +{CODE} + +{CODE(colors="haskell" ln=0)} +case xs of + (_:_) -> reverse xs + [] -> ['*'] +{CODE} + +! external links + +[http://google.com|''Google'' search engine] + +[http://pandoc.org] + +[http://google.com] [http://yahoo.com] + +[mailto:info@example.org|email me] + +http://google.com + +info@example.org + +! lists + +* Start each line +* with an asterisk (*). +** More asterisks gives deeper +*** and deeper levels. +* Line breaks%%%don't break levels. +* Continuations ++ are also possible +** and do not break the list flow +* Level one +Any other start ends the list. + +# Start each line +# with a number (1.). +## More number signs gives deeper +### and deeper +### levels. +# Line breaks%%%don't break levels. +# 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 +;item ''3'': definition ''3'' + +# one +# two +** two point one +** two point two +# three +# four +# five +## five sub 1 +### five sub 1 sub 1 +## five sub 2 + +! tables + +||Orange|Apple +Bread|Pie +Butter|Ice cream|| + +||Orange|Apple +Bread|Pie +__Butter__|Ice cream|| + +||Orange|Apple +Bread%%%%%%and cheese|Pie%%%%%%__apple__ and ''carrot'' || + +|| Orange | Apple | more + Bread | Pie | more + Butter | Ice cream | and more || -- cgit v1.2.3