##// END OF EJS Templates
test-minirst: don't test on invalid reST input...
Martin Geisler -
r9736:26d3ade6 default
parent child Browse files
Show More
@@ -1,153 +1,138 b''
1 1 #!/usr/bin/env python
2 2
3 3 from mercurial import minirst
4 4
5 5 def debugformat(title, text, width):
6 6 print "%s formatted to fit within %d characters:" % (title, width)
7 7 print "-" * 70
8 8 print minirst.format(text, width)
9 9 print "-" * 70
10 10 print
11 11
12 12 paragraphs = """
13 13 This is some text in the first paragraph.
14 14
15 An indented paragraph
16 with just two lines.
17
18
19 The third paragraph. It is followed by some
20 random lines with spurious spaces.
15 A small indented paragraph.
16 It is followed by some lines
17 containing random whitespace.
21 18
22 19
23 20
24
25
26 No indention
27 here, despite
28 the uneven left
29 margin.
30
31 Only the
32 left-most line
33 (this line!)
34 is significant
35 for the indentation
36
21 The third and final paragraph.
37 22 """
38 23
39 24 debugformat('paragraphs', paragraphs, 60)
40 25 debugformat('paragraphs', paragraphs, 30)
41 26
42 27
43 28 definitions = """
44 29 A Term
45 30 Definition. The indented
46 31 lines make up the definition.
47 32 Another Term
48 33 Another definition. The final line in the
49 34 definition determines the indentation, so
50 35 this will be indented with four spaces.
51 36
52 37 A Nested/Indented Term
53 38 Definition.
54 39 """
55 40
56 41 debugformat('definitions', definitions, 60)
57 42 debugformat('definitions', definitions, 30)
58 43
59 44
60 45 literals = r"""
61 46 The fully minimized form is the most
62 47 convenient form::
63 48
64 49 Hello
65 50 literal
66 51 world
67 52
68 53 In the partially minimized form a paragraph
69 54 simply ends with space-double-colon. ::
70 55
71 56 ////////////////////////////////////////
72 57 long un-wrapped line in a literal block
73 58 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
74 59
75 60 ::
76 61
77 62 This literal block is started with '::',
78 63 the so-called expanded form. The paragraph
79 64 with '::' disappears in the final output.
80 65 """
81 66
82 67 debugformat('literals', literals, 60)
83 68 debugformat('literals', literals, 30)
84 69
85 70
86 71 lists = """
87 72 - This is the first list item.
88 73
89 74 Second paragraph in the first list item.
90 75
91 76 - List items need not be separated
92 77 by a blank line.
93 78 - And will be rendered without
94 79 one in any case.
95 80
96 81 We can have indented lists:
97 82
98 83 - This is an indented list item
99 84
100 85 - Another indented list item::
101 86
102 87 - A literal block in the middle
103 88 of an indented list.
104 89
105 90 (The above is not a list item since we are in the literal block.)
106 91
107 92 ::
108 93
109 94 Literal block with no indentation (apart from
110 95 the two spaces added to all literal blocks).
111 96 """
112 97
113 98 debugformat('lists', lists, 60)
114 99 debugformat('lists', lists, 30)
115 100
116 101
117 102 options = """
118 103 There is support for simple option lists,
119 104 but only with long options:
120 105
121 106 --all Output all.
122 107 --both Output both (this description is
123 108 quite long).
124 109 --long Output all day long.
125 110
126 111 --par This option has two paragraphs in its description.
127 112 This is the first.
128 113
129 114 This is the second. Blank lines may be omitted between
130 115 options (as above) or left in (as here).
131 116
132 117 The next paragraph looks like an option list, but lacks the two-space
133 118 marker after the option. It is treated as a normal paragraph:
134 119
135 120 --foo bar baz
136 121 """
137 122
138 123 debugformat('options', options, 60)
139 124 debugformat('options', options, 30)
140 125
141 126
142 127 fields = """
143 128 Field lists give a simple two-column layout:
144 129
145 130 :key: The whitespace following the key is
146 131 significant for the wrapping of this text.
147 132 :another key: More text.
148 133 The indentation on the following
149 134 lines is not significant.
150 135 """
151 136
152 137 debugformat('fields', fields, 60)
153 138 debugformat('fields', fields, 30)
@@ -1,239 +1,227 b''
1 1 paragraphs formatted to fit within 60 characters:
2 2 ----------------------------------------------------------------------
3 3 This is some text in the first paragraph.
4 4
5 An indented paragraph with just two lines.
6
7 The third paragraph. It is followed by some random lines
8 with spurious spaces.
5 A small indented paragraph. It is followed by some lines
6 containing random whitespace.
9 7
10 No indention here, despite the uneven left margin.
11
12 Only the left-most line (this line!) is significant for
13 the indentation
8 The third and final paragraph.
14 9 ----------------------------------------------------------------------
15 10
16 11 paragraphs formatted to fit within 30 characters:
17 12 ----------------------------------------------------------------------
18 13 This is some text in the first
19 14 paragraph.
20 15
21 An indented paragraph with
22 just two lines.
23
24 The third paragraph. It is
25 followed by some random lines
26 with spurious spaces.
16 A small indented paragraph.
17 It is followed by some lines
18 containing random
19 whitespace.
27 20
28 No indention here, despite the
29 uneven left margin.
30
31 Only the left-most line
32 (this line!) is significant
33 for the indentation
21 The third and final paragraph.
34 22 ----------------------------------------------------------------------
35 23
36 24 definitions formatted to fit within 60 characters:
37 25 ----------------------------------------------------------------------
38 26 A Term
39 27 Definition. The indented lines make up the definition.
40 28 Another Term
41 29 Another definition. The final line in the definition
42 30 determines the indentation, so this will be indented
43 31 with four spaces.
44 32 A Nested/Indented Term
45 33 Definition.
46 34 ----------------------------------------------------------------------
47 35
48 36 definitions formatted to fit within 30 characters:
49 37 ----------------------------------------------------------------------
50 38 A Term
51 39 Definition. The indented
52 40 lines make up the
53 41 definition.
54 42 Another Term
55 43 Another definition. The
56 44 final line in the
57 45 definition determines the
58 46 indentation, so this will
59 47 be indented with four
60 48 spaces.
61 49 A Nested/Indented Term
62 50 Definition.
63 51 ----------------------------------------------------------------------
64 52
65 53 literals formatted to fit within 60 characters:
66 54 ----------------------------------------------------------------------
67 55 The fully minimized form is the most convenient form:
68 56
69 57 Hello
70 58 literal
71 59 world
72 60
73 61 In the partially minimized form a paragraph simply ends with
74 62 space-double-colon.
75 63
76 64 ////////////////////////////////////////
77 65 long un-wrapped line in a literal block
78 66 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
79 67
80 68 This literal block is started with '::',
81 69 the so-called expanded form. The paragraph
82 70 with '::' disappears in the final output.
83 71 ----------------------------------------------------------------------
84 72
85 73 literals formatted to fit within 30 characters:
86 74 ----------------------------------------------------------------------
87 75 The fully minimized form is
88 76 the most convenient form:
89 77
90 78 Hello
91 79 literal
92 80 world
93 81
94 82 In the partially minimized
95 83 form a paragraph simply ends
96 84 with space-double-colon.
97 85
98 86 ////////////////////////////////////////
99 87 long un-wrapped line in a literal block
100 88 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
101 89
102 90 This literal block is started with '::',
103 91 the so-called expanded form. The paragraph
104 92 with '::' disappears in the final output.
105 93 ----------------------------------------------------------------------
106 94
107 95 lists formatted to fit within 60 characters:
108 96 ----------------------------------------------------------------------
109 97 - This is the first list item.
110 98
111 99 Second paragraph in the first list item.
112 100
113 101 - List items need not be separated by a blank line.
114 102 - And will be rendered without one in any case.
115 103
116 104 We can have indented lists:
117 105
118 106 - This is an indented list item
119 107 - Another indented list item:
120 108
121 109 - A literal block in the middle
122 110 of an indented list.
123 111
124 112 (The above is not a list item since we are in the literal block.)
125 113
126 114 Literal block with no indentation (apart from
127 115 the two spaces added to all literal blocks).
128 116 ----------------------------------------------------------------------
129 117
130 118 lists formatted to fit within 30 characters:
131 119 ----------------------------------------------------------------------
132 120 - This is the first list item.
133 121
134 122 Second paragraph in the
135 123 first list item.
136 124
137 125 - List items need not be
138 126 separated by a blank line.
139 127 - And will be rendered without
140 128 one in any case.
141 129
142 130 We can have indented lists:
143 131
144 132 - This is an indented list
145 133 item
146 134 - Another indented list
147 135 item:
148 136
149 137 - A literal block in the middle
150 138 of an indented list.
151 139
152 140 (The above is not a list item since we are in the literal block.)
153 141
154 142 Literal block with no indentation (apart from
155 143 the two spaces added to all literal blocks).
156 144 ----------------------------------------------------------------------
157 145
158 146 options formatted to fit within 60 characters:
159 147 ----------------------------------------------------------------------
160 148 There is support for simple option lists, but only with long
161 149 options:
162 150
163 151 --all Output all.
164 152 --both Output both (this description is quite long).
165 153 --long Output all day long.
166 154 --par This option has two paragraphs in its
167 155 description. This is the first.
168 156
169 157 This is the second. Blank lines may be omitted
170 158 between options (as above) or left in (as here).
171 159
172 160 The next paragraph looks like an option list, but lacks the
173 161 two-space marker after the option. It is treated as a normal
174 162 paragraph:
175 163
176 164 --foo bar baz
177 165 ----------------------------------------------------------------------
178 166
179 167 options formatted to fit within 30 characters:
180 168 ----------------------------------------------------------------------
181 169 There is support for simple
182 170 option lists, but only with
183 171 long options:
184 172
185 173 --all Output all.
186 174 --both Output both (this
187 175 description is
188 176 quite long).
189 177 --long Output all day
190 178 long.
191 179 --par This option has two
192 180 paragraphs in its
193 181 description. This
194 182 is the first.
195 183
196 184 This is the second.
197 185 Blank lines may be
198 186 omitted between
199 187 options (as above)
200 188 or left in (as
201 189 here).
202 190
203 191 The next paragraph looks like
204 192 an option list, but lacks the
205 193 two-space marker after the
206 194 option. It is treated as a
207 195 normal paragraph:
208 196
209 197 --foo bar baz
210 198 ----------------------------------------------------------------------
211 199
212 200 fields formatted to fit within 60 characters:
213 201 ----------------------------------------------------------------------
214 202 Field lists give a simple two-column layout:
215 203
216 204 key The whitespace following the key is
217 205 significant for the wrapping of this text.
218 206 another key More text. The indentation on the following
219 207 lines is not significant.
220 208 ----------------------------------------------------------------------
221 209
222 210 fields formatted to fit within 30 characters:
223 211 ----------------------------------------------------------------------
224 212 Field lists give a simple two-
225 213 column layout:
226 214
227 215 key The whitespace
228 216 following the
229 217 key is
230 218 significant for
231 219 the wrapping of
232 220 this text.
233 221 another key More text. The
234 222 indentation on
235 223 the following
236 224 lines is not
237 225 significant.
238 226 ----------------------------------------------------------------------
239 227
General Comments 0
You need to be logged in to leave comments. Login now