git.iko.soy/typeable/pandoc
on master help sign in
added old-style test
commit7741cdbf04f93875e6cd2051a6778c2ca35b5e40 authorYan Pas <yanp.bugz@gmail.com> dateWed 17 Oct 2018, 00:21 (8 years ago) parentce27bf9
5 files changed+289−1
src/Text/Pandoc/Readers/Man.hs+1 test/Tests/Old.hs+4 test/Tests/Readers/Man.hs+1−1 test/man-reader.man+189 test/man-reader.native+94
src/Text/Pandoc/Readers/Man.hs+1
@@ -73,6 +73,7 @@ type Font = Set FontKind
7373
7474type RoffStr = (String, Font)
7575
76+-- TODO parse tables (see man tbl)
7677data ManToken = MStr RoffStr
7778 | MLine [RoffStr]
7879 | MMaybeLink String
test/Tests/Old.hs+4
@@ -171,6 +171,10 @@ tests = [ testGroup "markdown"
171171 , test "tables" ["-f", "native", "-t", "../data/sample.lua"]
172172 "tables.native" "tables.custom"
173173 ]
174+ , testGroup "man"
175+ [ test "reader" ["-r", "man", "-w", "native", "-s"]
176+ "man-reader.man" "man-reader.native"
177+ ]
174178 ]
175179
176180-- makes sure file is fully closed after reading
test/Tests/Readers/Man.hs+1−1
@@ -73,7 +73,7 @@ tests = [
7373 =?> orderedListWith (1,UpperAlpha,DefaultDelim) [plain $ str "first", plain $ str "second"]
7474 , "nested" =:
7575 ".IP\nfirst\n.RS\n.IP\n1a\n.IP\n1b\n.RE"
76− =?> fromList [BulletList [[Plain [Str "first"],BulletList [[Plain [Str "1a"]],[Plain [Str "1b"]]]]]]
76+ =?> bulletList [(plain $ str "first") <> (bulletList [plain $ str "1a", plain $ str "1b"])]
7777 ],
7878 testGroup "CodeBlocks" [
7979 "cb1"=:
test/man-reader.mannew file+189
@@ -0,0 +1,189 @@
1+.TH "Pandoc Man tests" "" "Oct 17, 2018" "" ""
2+.PP
3+This is a set of tests for pandoc.
4+.PP
5+ * * * * *
6+.SH Headers
7+.SH Level 1
8+.SS Level 2
9+
10+ * * * * *
11+.SH Paragraphs
12+.PP
13+Here's a regular paragraph.
14+.PP
15+Another paragraph
16+In Markdown 1.0.0 and earlier.
17+Version 8.
18+This line turns into a list item.
19+Because a hard\-wrapped line in the middle of a paragraph looked like a list
20+item.
21+.PP
22+There should be a hard line break
23+.PD 0
24+.P
25+.PD
26+here.
27+.PP
28+ * * * * *
29+.SH Block Quotes
30+Code in a block quote:
31+.IP
32+.nf
33+\f[C]
34+sub\ status\ {
35+\ \ \ \ print\ "working";
36+}
37+\f[]
38+.fi
39+.PP
40+A list:
41+.IP "1." 3
42+item one
43+.IP "2." 3
44+item two
45+.PP
46+.SH Code Blocks
47+.PP
48+Code:
49+.IP
50+.nf
51+\f[C]
52+\-\-\-\-\ (should\ be\ four\ hyphens)
53+
54+sub\ status\ {
55+\ \ \ \ print\ "working";
56+}
57+
58+\f[]
59+.fi
60+.PP
61+And:
62+.IP
63+.nf
64+\f[C]
65+\tthis\ code\ line is\ indented\ by\ one\ tab
66+
67+These\ should\ not\ be\ escaped:\ \ \\$\ \\\\\ \\>\ \\[\ \\{
68+\f[]
69+.fi
70+.PP
71+ * * * * *
72+.SH Lists
73+.SS Unordered
74+.PP
75+Asterisks:
76+.IP \[bu] 2
77+asterisk 1
78+.IP \[bu] 2
79+asterisk 2
80+.IP \[bu] 2
81+asterisk 3
82+.PP
83+.SS Ordered
84+.IP "1." 3
85+First
86+.IP "2." 3
87+Second
88+.IP "3." 3
89+Third
90+.PP
91+.SS Nested
92+.IP \[bu] 2
93+Tab
94+.RS 2
95+.IP \[bu] 2
96+Tab
97+.RS 2
98+.IP \[bu] 2
99+Tab
100+.RE
101+.RE
102+.PP
103+Here's another:
104+.IP "1." 3
105+First
106+.IP "2." 3
107+Second:
108+.RS 4
109+.IP \[bu] 2
110+Fee
111+.IP \[bu] 2
112+Fie
113+.IP \[bu] 2
114+Foe
115+.RE
116+.IP "3." 3
117+Third
118+.PP
119+Same thing:
120+.IP "1." 3
121+First
122+.IP "2." 3
123+Second:
124+.RS 4
125+.IP \[bu] 2
126+Fee
127+.IP \[bu] 2
128+Fie
129+.IP \[bu] 2
130+Foe
131+.RE
132+.IP "3." 3
133+Third
134+.SS different styles:
135+.IP "A." 3
136+Upper Alpha
137+.RS 4
138+.IP "I." 3
139+Upper Roman.
140+.RS 4
141+.IP "(6)" 4
142+Decimal start with 6
143+.RS 4
144+.IP "c)" 3
145+Lower alpha with paren
146+.RE
147+.RE
148+.RE
149+.PP
150+ * * * * *
151+.SH Special Characters
152+AT&T has an ampersand in their name.
153+.PP
154+4 < 5.
155+.PP
156+6 > 5.
157+.PP
158+Backslash: \\
159+.PP
160+Backtick: `
161+.PP
162+Asterisk: *
163+.PP
164+Underscore: _
165+.PP
166+Left brace: {
167+.PP
168+Right brace: }
169+.PP
170+Left bracket: [
171+.PP
172+Right bracket: ]
173+.PP
174+Left paren: (
175+.PP
176+Right paren: )
177+.PP
178+Greater\-than: >
179+.PP
180+Hash: #
181+.PP
182+Period: .
183+.PP
184+Bang: !
185+.PP
186+Plus: +
187+.PP
188+Minus: \-
189+.PP
test/man-reader.nativenew file+94
@@ -0,0 +1,94 @@
1+Pandoc (Meta {unMeta = fromList [("title",MetaString "Pandoc Man tests")]})
2+[Header 1 ("",[],[]) [Str "Pandoc Man tests"]
3+,Para [Str "This is a set of tests for pandoc."]
4+,Para [Str " * * * * *"]
5+,Header 2 ("",[],[]) [Str "Headers"]
6+,Header 2 ("",[],[]) [Str "Level",Space,Str "1"]
7+,Header 3 ("",[],[]) [Str "Level",Space,Str "2"]
8+,Para [Str " * * * * *"]
9+,Header 2 ("",[],[]) [Str "Paragraphs"]
10+,Para [Str "Here's a regular paragraph."]
11+,Para [Str "Another paragraph",Space,Str "In Markdown 1.0.0 and earlier.",Space,Str "Version 8.",Space,Str "This line turns into a list item.",Space,Str "Because a hard-wrapped line in the middle of a paragraph looked like a list",Space,Str "item."]
12+,Para [Str "There should be a hard line break"]
13+,Para [Str "here."]
14+,Para [Str " * * * * *"]
15+,Header 2 ("",[],[]) [Str "Block",Space,Str "Quotes"]
16+,Para [Str "Code in a block quote:"]
17+,CodeBlock ("",[],[]) "\nsub status {\n print \"working\";\n}\n"
18+,Para [Str "A list:"]
19+,OrderedList (1,Decimal,DefaultDelim)
20+ [[Plain [Str "item one"]]
21+ ,[Plain [Str "item two"]]]
22+,Header 2 ("",[],[]) [Str "Code",Space,Str "Blocks"]
23+,Para [Str "Code:"]
24+,CodeBlock ("",[],[]) "\n---- (should be four hyphens)\n\nsub status {\n print \"working\";\n}\n\n"
25+,Para [Str "And:"]
26+,CodeBlock ("",[],[]) "\n\tthis code line is indented by one tab\n\nThese should not be escaped: \\$ \\\\ \\> \\[ \\{\n"
27+,Para [Str " * * * * *"]
28+,Header 2 ("",[],[]) [Str "Lists"]
29+,Header 3 ("",[],[]) [Str "Unordered"]
30+,Para [Str "Asterisks:"]
31+,BulletList
32+ [[Plain [Str "",Space,Str "asterisk 1"]]
33+ ,[Plain [Str "",Space,Str "asterisk 2"]]
34+ ,[Plain [Str "",Space,Str "asterisk 3"]]]
35+,Header 3 ("",[],[]) [Str "Ordered"]
36+,OrderedList (1,Decimal,DefaultDelim)
37+ [[Plain [Str "First"]]
38+ ,[Plain [Str "Second"]]
39+ ,[Plain [Str "Third"]]]
40+,Header 3 ("",[],[]) [Str "Nested"]
41+,BulletList
42+ [[Plain [Str "",Space,Str "Tab"]
43+ ,BulletList
44+ [[Plain [Str "",Space,Str "Tab"]
45+ ,BulletList
46+ [[Plain [Str "",Space,Str "Tab"]]]]]]]
47+,Para [Str "Here's another:"]
48+,OrderedList (1,Decimal,DefaultDelim)
49+ [[Plain [Str "First"]]
50+ ,[Plain [Str "Second:"]
51+ ,BulletList
52+ [[Plain [Str "",Space,Str "Fee"]]
53+ ,[Plain [Str "",Space,Str "Fie"]]
54+ ,[Plain [Str "",Space,Str "Foe"]]]]
55+ ,[Plain [Str "Third"]]]
56+,Para [Str "Same thing:"]
57+,OrderedList (1,Decimal,DefaultDelim)
58+ [[Plain [Str "First"]]
59+ ,[Plain [Str "Second:"]
60+ ,BulletList
61+ [[Plain [Str "",Space,Str "Fee"]]
62+ ,[Plain [Str "",Space,Str "Fie"]]
63+ ,[Plain [Str "",Space,Str "Foe"]]]]
64+ ,[Plain [Str "Third"]]]
65+,Header 3 ("",[],[]) [Str "different",Space,Str "styles:"]
66+,OrderedList (1,UpperAlpha,DefaultDelim)
67+ [[Plain [Str "Upper Alpha"]
68+ ,OrderedList (1,UpperAlpha,DefaultDelim)
69+ [[Plain [Str "Upper Roman."]
70+ ,BulletList
71+ [[Plain [Str "(6)",Space,Str "Decimal start with 6"]
72+ ,OrderedList (1,LowerAlpha,DefaultDelim)
73+ [[Plain [Str "Lower alpha with paren"]]]]]]]]]
74+,Para [Str " * * * * *"]
75+,Header 2 ("",[],[]) [Str "Special",Space,Str "Characters"]
76+,Para [Str "AT&T has an ampersand in their name."]
77+,Para [Str "4 < 5."]
78+,Para [Str "6 > 5."]
79+,Para [Str "Backslash: \\"]
80+,Para [Str "Backtick: `"]
81+,Para [Str "Asterisk: *"]
82+,Para [Str "Underscore: _"]
83+,Para [Str "Left brace: {"]
84+,Para [Str "Right brace: }"]
85+,Para [Str "Left bracket: ["]
86+,Para [Str "Right bracket: ]"]
87+,Para [Str "Left paren: ("]
88+,Para [Str "Right paren: )"]
89+,Para [Str "Greater-than: >"]
90+,Para [Str "Hash: #"]
91+,Para [Str "Period: ."]
92+,Para [Str "Bang: !"]
93+,Para [Str "Plus: +"]
94+,Para [Str "Minus: -"]]