git.iko.soy/typeable/pandoc
on master help sign in
TWiki Reader: add basic syntax test
79f25fbAlexander Sulfrian
pandoc.cabal+1
@@ -182,6 +182,7 @@ Extra-Source-Files:
182 tests/epub/*.epub
182 tests/epub/*.epub
183 tests/epub/*.native
183 tests/epub/*.native
184 tests/txt2tags.t2t
184 tests/txt2tags.t2t
185+ tests/twiki-reader.twiki
185
186
186Source-repository head
187Source-repository head
187 type: git
188 type: git
tests/Tests/Old.hs+3
@@ -153,6 +153,9 @@ tests = [ testGroup "markdown"
153 , test "formatting" ["-r", "epub", "-w", "native"]
153 , test "formatting" ["-r", "epub", "-w", "native"]
154 "epub/formatting.epub" "epub/formatting.native"
154 "epub/formatting.epub" "epub/formatting.native"
155 ]
155 ]
156+ , testGroup "twiki"
157+ [ test "reader" ["-r", "twiki", "-w", "native", "-s"]
158+ "twiki-reader.twiki" "twiki-reader.native" ]
156 , testGroup "other writers" $ map (\f -> testGroup f $ writerTests f)
159 , testGroup "other writers" $ map (\f -> testGroup f $ writerTests f)
157 [ "opendocument" , "context" , "texinfo", "icml"
160 [ "opendocument" , "context" , "texinfo", "icml"
158 , "man" , "plain" , "rtf", "org", "asciidoc"
161 , "man" , "plain" , "rtf", "org", "asciidoc"
tests/twiki-reader.nativenew file+174
@@ -0,0 +1,174 @@
1+Pandoc (Meta {unMeta = fromList []})
2+[Header 1 ("header",[],[]) [Str "header"]
3+,Header 2 ("header-level-two",[],[]) [Str "header",Space,Str "level",Space,Str "two"]
4+,Header 3 ("header-level-3",[],[]) [Str "header",Space,Str "level",Space,Str "3"]
5+,Header 4 ("header-level-four",[],[]) [Str "header",Space,Emph [Str "level"],Space,Str "four"]
6+,Header 5 ("header-level-5",[],[]) [Str "header",Space,Str "level",Space,Str "5"]
7+,Header 6 ("header-level-6",[],[]) [Str "header",Space,Str "level",Space,Str "6"]
8+,Para [Str "---+++++++",Space,Str "not",Space,Str "a",Space,Str "header"]
9+,Para [Str "--++",Space,Str "not",Space,Str "a",Space,Str "header"]
10+,Header 1 ("emph-and-strong",[],[]) [Str "emph",Space,Str "and",Space,Str "strong"]
11+,Para [Emph [Str "emph"],Space,Strong [Str "strong"]]
12+,Para [Emph [Strong [Str "strong",Space,Str "and",Space,Str "emph"]]]
13+,Para [Strong [Emph [Str "emph",Space,Str "inside"],Space,Str "strong"]]
14+,Para [Strong [Str "strong",Space,Str "with",Space,Emph [Str "emph"]]]
15+,Para [Emph [Strong [Str "strong",Space,Str "inside"],Space,Str "emph"]]
16+,Header 1 ("horizontal-rule",[],[]) [Str "horizontal",Space,Str "rule"]
17+,Para [Str "top"]
18+,HorizontalRule
19+,Para [Str "bottom"]
20+,HorizontalRule
21+,Header 1 ("nop",[],[]) [Str "nop"]
22+,Para [Str "_not",Space,Str "emph_"]
23+,Header 1 ("entities",[],[]) [Str "entities"]
24+,Para [Str "hi",Space,Str "&",Space,Str "low"]
25+,Para [Str "hi",Space,Str "&",Space,Str "low"]
26+,Para [Str "G\246del"]
27+,Para [Str "\777\2730"]
28+,Header 1 ("comments",[],[]) [Str "comments"]
29+,Para [Str "inline",Space,Str "comment"]
30+,Para [Str "between",Space,Str "blocks"]
31+,Header 1 ("linebreaks",[],[]) [Str "linebreaks"]
32+,Para [Str "hi",LineBreak,Str "there"]
33+,Para [Str "hi",LineBreak,Space,Str "there"]
34+,Header 1 ("inline-code",[],[]) [Str "inline",Space,Str "code"]
35+,Para [Code ("",[],[]) "*\8594*",Space,Code ("",[],[]) "typed",Space,Code ("",["haskell"],[]) ">>="]
36+,Header 1 ("code-blocks",[],[]) [Str "code",Space,Str "blocks"]
37+,CodeBlock ("",[],[]) "case xs of\n (_:_) -> reverse xs\n [] -> ['*']"
38+,CodeBlock ("",["haskell"],[]) "case xs of\n (_:_) -> reverse xs\n [] -> ['*']"
39+,Header 1 ("block-quotes",[],[]) [Str "block",Space,Str "quotes"]
40+,Para [Str "Regular",Space,Str "paragraph"]
41+,BlockQuote
42+ [Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "block",Space,Str "quote."]
43+ ,Para [Str "With",Space,Str "two",Space,Str "paragraphs."]]
44+,Para [Str "Nother",Space,Str "paragraph."]
45+,Header 1 ("external-links",[],[]) [Str "external",Space,Str "links"]
46+,Para [Link [Emph [Str "Google"],Space,Str "search",Space,Str "engine"] ("http://google.com","")]
47+,Para [Link [Str "http://johnmacfarlane.net/pandoc/"] ("http://johnmacfarlane.net/pandoc/","")]
48+,Para [Link [Str "http://google.com"] ("http://google.com",""),Space,Link [Str "http://yahoo.com"] ("http://yahoo.com","")]
49+,Para [Link [Str "email",Space,Str "me"] ("mailto:info@example.org","")]
50+,Para [Str "http://google.com"]
51+,Para [Str "http://google.com"]
52+,Para [Str "http://google.com"]
53+,Para [Str "info@example.org"]
54+,Para [Str "info@example.org"]
55+,Para [Str "info@example.org"]
56+,Header 1 ("lists",[],[]) [Str "lists"]
57+,BulletList
58+ [[Plain [Str "Start",Space,Str "each",Space,Str "line"]]
59+ ,[Plain [Str "with",Space,Str "an",Space,Str "asterisk",Space,Str "(*)."]
60+ ,BulletList
61+ [[Plain [Str "More",Space,Str "asterisks",Space,Str "gives",Space,Str "deeper"]
62+ ,BulletList
63+ [[Plain [Str "and",Space,Str "deeper",Space,Str "levels."]]]]]]
64+ ,[Plain [Str "Line",Space,Str "breaks",LineBreak,Str "don't",Space,Str "break",Space,Str "levels."]]
65+ ,[Plain [Str "Continuations",Space,Str "are",Space,Str "also",Space,Str "possible"]
66+ ,BulletList
67+ [[Plain [Str "and",Space,Str "do",Space,Str "not",Space,Str "break",Space,Str "the",Space,Str "list",Space,Str "flow"]]]]
68+ ,[Plain [Str "Level",Space,Str "one"]]]
69+,Para [Str "Any",Space,Str "other",Space,Str "start",Space,Str "ends",Space,Str "the",Space,Str "list."]
70+,OrderedList (1,DefaultStyle,DefaultDelim)
71+ [[Plain [Str "Start",Space,Str "each",Space,Str "line"]]
72+ ,[Plain [Str "with",Space,Str "a",Space,Str "number",Space,Str "(1.)."]
73+ ,OrderedList (1,DefaultStyle,DefaultDelim)
74+ [[Plain [Str "More",Space,Str "number",Space,Str "signs",Space,Str "gives",Space,Str "deeper"]
75+ ,OrderedList (1,DefaultStyle,DefaultDelim)
76+ [[Plain [Str "and",Space,Str "deeper"]]
77+ ,[Plain [Str "levels."]]]]]]
78+ ,[Plain [Str "Line",Space,Str "breaks",LineBreak,Str "don't",Space,Str "break",Space,Str "levels."]]
79+ ,[Plain [Str "Blank",Space,Str "lines"]]]
80+,OrderedList (1,DefaultStyle,DefaultDelim)
81+ [[Plain [Str "end",Space,Str "the",Space,Str "list",Space,Str "and",Space,Str "start",Space,Str "another."]]]
82+,Para [Str "Any",Space,Str "other",Space,Str "start",Space,Str "also",Space,Str "ends",Space,Str "the",Space,Str "list."]
83+,DefinitionList
84+ [([Str "item",Space,Str "1"],
85+ [[Plain [Str "definition",Space,Str "1"]]])
86+ ,([Str "item",Space,Str "2"],
87+ [[Plain [Str "definition",Space,Str "2-1",Space,Str "definition",Space,Str "2-2"]]])
88+ ,([Str "item",Space,Emph [Str "3"]],
89+ [[Plain [Str "definition",Space,Emph [Str "3"]]]])]
90+,OrderedList (1,DefaultStyle,DefaultDelim)
91+ [[Plain [Str "one"]]
92+ ,[Plain [Str "two"]
93+ ,BulletList
94+ [[Plain [Str "two",Space,Str "point",Space,Str "one"]]
95+ ,[Plain [Str "two",Space,Str "point",Space,Str "two"]]]]
96+ ,[Plain [Str "three"]
97+ ,DefinitionList
98+ [([Str "three",Space,Str "item",Space,Str "one"],
99+ [[Plain [Str "three",Space,Str "def",Space,Str "one"]]])]]
100+ ,[Plain [Str "four"]
101+ ,DefinitionList
102+ [([Str "four",Space,Str "def",Space,Str "one"],
103+ [[Plain [Str "this",Space,Str "is",Space,Str "a",Space,Str "continuation"]]])]]
104+ ,[Plain [Str "five"]
105+ ,OrderedList (1,DefaultStyle,DefaultDelim)
106+ [[Plain [Str "five",Space,Str "sub",Space,Str "1"]
107+ ,OrderedList (1,DefaultStyle,DefaultDelim)
108+ [[Plain [Str "five",Space,Str "sub",Space,Str "1",Space,Str "sub",Space,Str "1"]]]]
109+ ,[Plain [Str "five",Space,Str "sub",Space,Str "2"]]]]]
110+,OrderedList (1,DefaultStyle,DefaultDelim)
111+ [[Plain [Str "other"]
112+ ,OrderedList (1,UpperRoman,DefaultDelim)
113+ [[Plain [Str "list"]]
114+ ,[Plain [Str "styles"]]]]
115+ ,[Plain [Str "are"]
116+ ,OrderedList (1,LowerRoman,DefaultDelim)
117+ [[Plain [Str "also"]]
118+ ,[Plain [Str "possible"]]]]
119+ ,[Plain [Str "all"]
120+ ,OrderedList (1,LowerAlpha,DefaultDelim)
121+ [[Plain [Str "the"]]
122+ ,[Plain [Str "different"]]
123+ ,[Plain [Str "styles"]]]]
124+ ,[Plain [Str "are"]
125+ ,OrderedList (1,UpperAlpha,DefaultDelim)
126+ [[Plain [Str "implemented"]]
127+ ,[Plain [Str "and"]]
128+ ,[Plain [Str "supported"]]]]]
129+,Header 1 ("tables",[],[]) [Str "tables"]
130+,Table [] [AlignDefault,AlignDefault] [0.0,0.0]
131+ [[]
132+ ,[]]
133+ [[[Plain [Str "Orange"]]
134+ ,[Plain [Str "Apple"]]]
135+ ,[[Plain [Str "Bread"]]
136+ ,[Plain [Str "Pie"]]]
137+ ,[[Plain [Str "Butter"]]
138+ ,[Plain [Str "Ice",Space,Str "cream"]]]]
139+,Table [] [AlignLeft,AlignLeft] [0.0,0.0]
140+ [[Plain [Str "Orange"]]
141+ ,[Plain [Str "Apple"]]]
142+ [[[Plain [Str "Bread"]]
143+ ,[Plain [Str "Pie"]]]
144+ ,[[Plain [Strong [Str "Butter"]]]
145+ ,[Plain [Str "Ice",Space,Str "cream"]]]]
146+,Table [] [AlignLeft,AlignLeft] [0.0,0.0]
147+ [[Plain [Str "Orange"]]
148+ ,[Plain [Str "Apple"]]]
149+ [[[Plain [Str "Bread",LineBreak,LineBreak,Str "and",Space,Str "cheese"]]
150+ ,[Plain [Str "Pie",LineBreak,LineBreak,Strong [Str "apple"],Space,Str "and",Space,Emph [Str "carrot"]]]]]
151+,Table [] [AlignDefault,AlignDefault,AlignDefault] [0.0,0.0,0.0]
152+ [[]
153+ ,[]
154+ ,[]]
155+ [[[Plain [Str "Orange"]]
156+ ,[Plain [Str "Apple"]]
157+ ,[Plain [Str "more"]]]
158+ ,[[Plain [Str "Bread"]]
159+ ,[Plain [Str "Pie"]]
160+ ,[Plain [Str "more"]]]
161+ ,[[Plain [Str "Butter"]]
162+ ,[Plain [Str "Ice",Space,Str "cream"]]
163+ ,[Plain [Str "and",Space,Str "more"]]]]
164+,Header 1 ("macros",[],[]) [Str "macros"]
165+,Para [Span ("",["twiki-macro","TEST"],[]) []]
166+,Para [Span ("",["twiki-macro","TEST"],[]) [Str ""]]
167+,Para [Span ("",["twiki-macro","TEST"],[]) [Str "content with spaces"]]
168+,Para [Span ("",["twiki-macro","TEST"],[]) [Str "content with spaces"]]
169+,Para [Span ("",["twiki-macro","TEST"],[("ARG1","test")]) [Str "content with spaces"]]
170+,Para [Span ("",["twiki-macro","TEST"],[]) [Str "content with spaces ARG1=test"]]
171+,Para [Span ("",["twiki-macro","TEST"],[("ARG1","test")]) [Str "content with spaces"]]
172+,Para [Span ("",["twiki-macro","TEST"],[("ARG1","test"),("ARG2","test2")]) [Str ""]]
173+,Para [Span ("",["twiki-macro","TEST"],[("ARG1","test"),("ARG2","test2")]) [Str ""]]
174+,Para [Span ("",["twiki-macro","TEST"],[("ARG1","test"),("ARG2","test2")]) [Str "multiline\ndoes also work"]]]
tests/twiki-reader.twikinew file+221
@@ -0,0 +1,221 @@
1+---+ header
2+
3+---++ header level two
4+
5+---+++ header level 3
6+
7+---++++ header _level_ four
8+
9+---+++++ header level 5
10+
11+---++++++ header level 6
12+
13+---+++++++ not a header
14+
15+ --++ not a header
16+
17+---+ emph and strong
18+
19+_emph_ *strong*
20+
21+__strong and emph__
22+
23+*<i>emph inside</i> strong*
24+
25+*strong with <i>emph</i>*
26+
27+_<b>strong inside</b> emph_
28+
29+---+ horizontal rule
30+
31+top
32+---
33+bottom
34+
35+---
36+
37+---+ nop
38+
39+<nop>_not emph_
40+
41+---+ entities
42+
43+hi & low
44+
45+hi &amp; low
46+
47+G&ouml;del
48+
49+&#777;&#xAAA;
50+
51+---+ comments
52+
53+inline <!-- secret --> comment
54+
55+<!-- secret -->
56+
57+between blocks
58+
59+ <!-- secret -->
60+
61+---+ linebreaks
62+
63+hi%BR%there
64+
65+hi%BR%
66+there
67+
68+---+ inline code
69+
70+<code>*→*</code> =typed= <code class="haskell">>>=</code>
71+
72+---+ code blocks
73+
74+<verbatim>
75+case xs of
76+ (_:_) -> reverse xs
77+ [] -> ['*']
78+</verbatim>
79+
80+<verbatim class="haskell">
81+case xs of
82+ (_:_) -> reverse xs
83+ [] -> ['*']
84+</verbatim>
85+
86+---+ block quotes
87+
88+Regular paragraph
89+<blockquote>
90+This is a block quote.
91+
92+With two paragraphs.
93+</blockquote>
94+Nother paragraph.
95+
96+---+ external links
97+
98+[[http://google.com][<i>Google</i> search engine]]
99+
100+http://johnmacfarlane.net/pandoc/
101+
102+[[http://google.com]] [[http://yahoo.com]]
103+
104+[[mailto:info@example.org][email me]]
105+
106+!http://google.com
107+
108+<nop>http://google.com
109+
110+<noautolink>
111+http://google.com
112+</noautolink>
113+
114+!info@example.org
115+
116+<nop>info@example.org
117+
118+<noautolink>
119+info@example.org
120+</noautolink>
121+
122+---+ lists
123+
124+ * Start each line
125+ * with an asterisk (*).
126+ * More asterisks gives deeper
127+ * and deeper levels.
128+ * Line breaks%BR%don't break levels.
129+ * Continuations
130+ are also possible
131+ * and do not break the list flow
132+ * Level one
133+Any other start ends the list.
134+
135+ 1. Start each line
136+ 1. with a number (1.).
137+ 1. More number signs gives deeper
138+ 1. and deeper
139+ 1. levels.
140+ 1. Line breaks%BR%don't break levels.
141+ 1. Blank lines
142+
143+ 1. end the list and start another.
144+Any other start also
145+ends the list.
146+
147+ $ item 1: definition 1
148+ $ item 2: definition 2-1
149+ definition 2-2
150+ $ item _3_: definition _3_
151+
152+ 1. one
153+ 1. two
154+ * two point one
155+ * two point two
156+ 1. three
157+ $ three item one: three def one
158+ 1. four
159+ $ four def one: this
160+ is a continuation
161+ 1. five
162+ 1. five sub 1
163+ 1. five sub 1 sub 1
164+ 1. five sub 2
165+
166+ 1. other
167+ I. list
168+ I. styles
169+ 1. are
170+ i. also
171+ i. possible
172+ 1. all
173+ a. the
174+ a. different
175+ a. styles
176+ 1. are
177+ A. implemented
178+ A. and
179+ A. supported
180+
181+---+ tables
182+
183+|Orange|Apple|
184+|Bread|Pie|
185+|Butter|Ice cream|
186+
187+|*Orange*|*Apple*|
188+|Bread|Pie|
189+|*Butter*|Ice cream|
190+
191+|*Orange*|*Apple*|
192+|Bread%BR%%BR%and cheese|Pie%BR%%BR%*apple* and <i>carrot</i>|
193+
194+| Orange | Apple | more |
195+| Bread | Pie | more |
196+| Butter | Ice cream | and more |
197+
198+---+ macros
199+
200+%TEST%
201+
202+%TEST{}%
203+
204+%TEST{content with spaces}%
205+
206+%TEST{"content with spaces"}%
207+
208+%TEST{"content with spaces" ARG1="test"}%
209+
210+%TEST{content with spaces ARG1=test}%
211+
212+%TEST{ARG1=test content with spaces}%
213+
214+%TEST{ARG1=test ARG2=test2}%
215+
216+%TEST{ARG1="test" ARG2="test2"}%
217+
218+%TEST{ARG1="test"
219+ARG2="test2"
220+multiline
221+does also work}%