wikitext 0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/ary.h +99 -0
- data/ext/depend +22 -0
- data/ext/extconf.rb +23 -0
- data/ext/parser.c +2174 -0
- data/ext/parser.h +31 -0
- data/ext/str.h +135 -0
- data/ext/token.c +109 -0
- data/ext/token.h +95 -0
- data/ext/wikitext.c +60 -0
- data/ext/wikitext.h +30 -0
- data/ext/wikitext_ragel.c +3354 -0
- data/ext/wikitext_ragel.h +17 -0
- data/spec/autolinking_spec.rb +122 -0
- data/spec/blockquote_spec.rb +570 -0
- data/spec/em_spec.rb +97 -0
- data/spec/encoding_spec.rb +124 -0
- data/spec/entity_spec.rb +40 -0
- data/spec/external_link_spec.rb +289 -0
- data/spec/h1_spec.rb +59 -0
- data/spec/h2_spec.rb +59 -0
- data/spec/h3_spec.rb +59 -0
- data/spec/h4_spec.rb +59 -0
- data/spec/h5_spec.rb +59 -0
- data/spec/h6_spec.rb +59 -0
- data/spec/indentation_spec.rb +70 -0
- data/spec/integration_spec.rb +265 -0
- data/spec/internal_link_spec.rb +445 -0
- data/spec/line_endings_spec.rb +81 -0
- data/spec/link_encoding_spec.rb +132 -0
- data/spec/link_sanitizing_spec.rb +228 -0
- data/spec/nowiki_spec.rb +155 -0
- data/spec/p_spec.rb +44 -0
- data/spec/pre_spec.rb +411 -0
- data/spec/regressions_spec.rb +45 -0
- data/spec/spec_helper.rb +77 -0
- data/spec/strong_em_spec.rb +89 -0
- data/spec/strong_spec.rb +99 -0
- data/spec/tokenizing_spec.rb +190 -0
- data/spec/tt_spec.rb +100 -0
- data/spec/ul_spec.rb +307 -0
- data/spec/wikitext_spec.rb +50 -0
- metadata +93 -0
data/spec/p_spec.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Copyright 2007-2008 Wincent Colaiuta
|
3
|
+
# This program is free software: you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU General Public License as published by
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
|
16
|
+
require File.join(File.dirname(__FILE__), 'spec_helper.rb')
|
17
|
+
require 'wikitext'
|
18
|
+
|
19
|
+
describe Wikitext::Parser, 'parsing paragraphs' do
|
20
|
+
before do
|
21
|
+
@parser = Wikitext::Parser.new
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should wrap bare text in paragraph tags' do
|
25
|
+
@parser.parse('foo').should == "<p>foo</p>\n"
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should treat consecutive line breaks as paragraph breaks' do
|
29
|
+
@parser.parse("foo\n\nbar").should == "<p>foo</p>\n<p>bar</p>\n"
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should not insert excess empty paragraphs or spaces when processing multiple consecutive line breaks' do
|
33
|
+
@parser.parse("foo\n\n\n\nbar").should == "<p>foo</p>\n<p>bar</p>\n"
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should not translate single line breaks into spaces when they appear at the start of a paragraph' do
|
37
|
+
@parser.parse("\nfoo").should == "<p>foo</p>\n"
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'should not translate single line breaks into spaces when they appear at the end of a paragraph' do
|
41
|
+
@parser.parse("foo\n").should == "<p>foo</p>\n"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
data/spec/pre_spec.rb
ADDED
@@ -0,0 +1,411 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Copyright 2007-2008 Wincent Colaiuta
|
3
|
+
# This program is free software: you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU General Public License as published by
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
|
16
|
+
require File.join(File.dirname(__FILE__), 'spec_helper.rb')
|
17
|
+
require 'wikitext'
|
18
|
+
|
19
|
+
describe Wikitext::Parser, 'parsing PRE blocks' do
|
20
|
+
before do
|
21
|
+
@parser = Wikitext::Parser.new
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should recognize a single-line <pre> block' do
|
25
|
+
@parser.parse(' foo').should == "<pre>foo</pre>\n"
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should recognize a multiline <pre> block' do
|
29
|
+
@parser.parse(" foo\n bar").should == "<pre>foo\nbar</pre>\n"
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should allow nesting inside a <blockquote> block' do
|
33
|
+
# nesting inside single blockquotes
|
34
|
+
@parser.parse("> foo").should == "<blockquote>\n <pre>foo</pre>\n</blockquote>\n"
|
35
|
+
|
36
|
+
# same, but continued over multiple lines
|
37
|
+
@parser.parse("> foo\n> bar").should == "<blockquote>\n <pre>foo\nbar</pre>\n</blockquote>\n"
|
38
|
+
|
39
|
+
# nesting inside double blockquotes
|
40
|
+
expected = dedent <<-END
|
41
|
+
<blockquote>
|
42
|
+
<blockquote>
|
43
|
+
<pre>foo</pre>
|
44
|
+
</blockquote>
|
45
|
+
</blockquote>
|
46
|
+
END
|
47
|
+
@parser.parse("> > foo").should == expected
|
48
|
+
|
49
|
+
# same, but continued over multiple lines
|
50
|
+
expected = dedent <<-END
|
51
|
+
<blockquote>
|
52
|
+
<blockquote>
|
53
|
+
<pre>foo
|
54
|
+
bar</pre>
|
55
|
+
</blockquote>
|
56
|
+
</blockquote>
|
57
|
+
END
|
58
|
+
@parser.parse("> > foo\n> > bar").should == expected
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'should automatically close preceding blocks at the same depth' do
|
62
|
+
@parser.parse("> foo\n bar").should == "<blockquote>\n <p>foo</p>\n</blockquote>\n<pre>bar</pre>\n"
|
63
|
+
expected = dedent <<-END
|
64
|
+
<blockquote>
|
65
|
+
<blockquote>
|
66
|
+
<p>foo</p>
|
67
|
+
</blockquote>
|
68
|
+
</blockquote>
|
69
|
+
<pre>bar</pre>
|
70
|
+
END
|
71
|
+
@parser.parse("> > foo\n bar").should == expected
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'should pass <tt> and </tt> tags through without any special meaning' do
|
75
|
+
@parser.parse(' foo <tt>bar</tt>').should == "<pre>foo <tt>bar</tt></pre>\n"
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'should pass <em> and </em> tags through without any special meaning' do
|
79
|
+
@parser.parse(" foo ''bar''").should == "<pre>foo ''bar''</pre>\n"
|
80
|
+
end
|
81
|
+
|
82
|
+
it 'should pass <strong> and </strong> tags through without any special meaning' do
|
83
|
+
@parser.parse(" foo '''bar'''").should == "<pre>foo '''bar'''</pre>\n"
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'should pass combined <strong>/<em> and </strong>/</em> tags through without any special meaning' do
|
87
|
+
@parser.parse(" foo '''''bar'''''").should == "<pre>foo '''''bar'''''</pre>\n"
|
88
|
+
end
|
89
|
+
|
90
|
+
it 'should pass named entities through unchanged' do
|
91
|
+
@parser.parse(' €').should == "<pre>€</pre>\n"
|
92
|
+
end
|
93
|
+
|
94
|
+
it 'should pass numeric (decimal) entities through unchanged' do
|
95
|
+
@parser.parse(' €').should == "<pre>€</pre>\n"
|
96
|
+
end
|
97
|
+
|
98
|
+
it 'should pass numeric (hexadecimal) entities through unchanged' do
|
99
|
+
@parser.parse(' €').should == "<pre>€</pre>\n"
|
100
|
+
@parser.parse(' €').should == "<pre>€</pre>\n"
|
101
|
+
end
|
102
|
+
|
103
|
+
it 'should convert non-ASCII characters to numeric entities' do
|
104
|
+
@parser.parse(' €').should == "<pre>€</pre>\n"
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
describe Wikitext::Parser, 'parsing PRE_START/PRE_END blocks' do
|
109
|
+
before do
|
110
|
+
@parser = Wikitext::Parser.new
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'should accept PRE_START/PRE_END as an alternative to the standard syntax' do
|
114
|
+
@parser.parse('<pre>foo</pre>').should == "<pre>foo</pre>\n"
|
115
|
+
end
|
116
|
+
|
117
|
+
it 'should pass through PRE unchanged in PRE_START/PRE_END blocks' do
|
118
|
+
input = dedent <<-END
|
119
|
+
<pre>line 1
|
120
|
+
next line</pre>
|
121
|
+
END
|
122
|
+
expected = dedent <<-END
|
123
|
+
<pre>line 1
|
124
|
+
next line</pre>
|
125
|
+
END
|
126
|
+
@parser.parse(input).should == expected
|
127
|
+
end
|
128
|
+
|
129
|
+
it 'should pass through short BLOCKQUOTE tokens as named entities in PRE_START/PRE_END blocks' do
|
130
|
+
input = dedent <<-END
|
131
|
+
<pre>line 1
|
132
|
+
>next line</pre>
|
133
|
+
END
|
134
|
+
expected = dedent <<-END
|
135
|
+
<pre>line 1
|
136
|
+
>next line</pre>
|
137
|
+
END
|
138
|
+
@parser.parse(input).should == expected
|
139
|
+
end
|
140
|
+
|
141
|
+
it 'should pass through long BLOCKQUOTE tokens as named entities in PRE_START/PRE_END blocks' do
|
142
|
+
input = dedent <<-END
|
143
|
+
<pre>line 1
|
144
|
+
> next line</pre>
|
145
|
+
END
|
146
|
+
expected = dedent <<-END
|
147
|
+
<pre>line 1
|
148
|
+
> next line</pre>
|
149
|
+
END
|
150
|
+
@parser.parse(input).should == expected
|
151
|
+
end
|
152
|
+
|
153
|
+
it 'should pass through EM unchanged in PRE_START/PRE_END blocks' do
|
154
|
+
@parser.parse("<pre>''</pre>").should == "<pre>''</pre>\n"
|
155
|
+
end
|
156
|
+
|
157
|
+
it 'should pass through STRONG unchanged in PRE_START/PRE_END blocks' do
|
158
|
+
@parser.parse("<pre>'''</pre>").should == "<pre>'''</pre>\n"
|
159
|
+
end
|
160
|
+
|
161
|
+
it 'should pass through STRONG_EM unchanged in PRE_START/PRE_END blocks' do
|
162
|
+
@parser.parse("<pre>'''''</pre>").should == "<pre>'''''</pre>\n"
|
163
|
+
end
|
164
|
+
|
165
|
+
it 'should pass through EM_START escaped in PRE_START/PRE_END blocks' do
|
166
|
+
@parser.parse("<pre><em></pre>").should == "<pre><em></pre>\n"
|
167
|
+
end
|
168
|
+
|
169
|
+
it 'should pass through EM_END escaped in PRE_START/PRE_END blocks' do
|
170
|
+
@parser.parse("<pre></em></pre>").should == "<pre></em></pre>\n"
|
171
|
+
end
|
172
|
+
|
173
|
+
it 'should pass through STRONG_START escaped in PRE_START/PRE_END blocks' do
|
174
|
+
@parser.parse("<pre><strong></pre>").should == "<pre><strong></pre>\n"
|
175
|
+
end
|
176
|
+
|
177
|
+
it 'should pass through STRONG_END escaped in PRE_START/PRE_END blocks' do
|
178
|
+
@parser.parse("<pre></strong></pre>").should == "<pre></strong></pre>\n"
|
179
|
+
end
|
180
|
+
|
181
|
+
it 'should pass through TT unchanged in PRE_START/PRE_END blocks' do
|
182
|
+
@parser.parse("<pre>`</pre>").should == "<pre>`</pre>\n"
|
183
|
+
end
|
184
|
+
|
185
|
+
it 'should pass through TT_START escaped in PRE_START/PRE_END blocks' do
|
186
|
+
@parser.parse("<pre><tt></pre>").should == "<pre><tt></pre>\n"
|
187
|
+
end
|
188
|
+
|
189
|
+
it 'should pass through TT_END escaped in PRE_START/PRE_END blocks' do
|
190
|
+
@parser.parse("<pre></tt></pre>").should == "<pre></tt></pre>\n"
|
191
|
+
end
|
192
|
+
|
193
|
+
it 'should pass through UL unchanged in PRE_START/PRE_END blocks' do
|
194
|
+
@parser.parse("<pre>\n#</pre>").should == "<pre>\n#</pre>\n"
|
195
|
+
end
|
196
|
+
|
197
|
+
it 'should pass through OL unchanged in PRE_START/PRE_END blocks' do
|
198
|
+
@parser.parse("<pre>\n*</pre>").should == "<pre>\n*</pre>\n"
|
199
|
+
end
|
200
|
+
|
201
|
+
it 'should ignore PRE_START inside <nowiki> spans' do
|
202
|
+
@parser.parse('<nowiki><pre></nowiki>').should == "<p><pre></p>\n"
|
203
|
+
end
|
204
|
+
|
205
|
+
it 'should ignore PRE_END inside <nowiki> spans' do
|
206
|
+
@parser.parse('<nowiki></pre></nowiki>').should == "<p></pre></p>\n"
|
207
|
+
end
|
208
|
+
|
209
|
+
it 'should ignore PRE_START inside standard PRE blocks' do
|
210
|
+
@parser.parse(' <pre>').should == "<pre><pre></pre>\n"
|
211
|
+
end
|
212
|
+
|
213
|
+
it 'should ignore PRE_END inside standard PRE blocks' do
|
214
|
+
@parser.parse(' </pre>').should == "<pre></pre></pre>\n"
|
215
|
+
end
|
216
|
+
|
217
|
+
it 'should ignore PRE_START inside already open PRE_START blocks' do
|
218
|
+
@parser.parse('<pre><pre></pre>').should == "<pre><pre></pre>\n"
|
219
|
+
end
|
220
|
+
|
221
|
+
it 'should ignore PRE_START inside BLOCKQUOTE blocks' do
|
222
|
+
expected = dedent <<-END
|
223
|
+
<blockquote>
|
224
|
+
<p><pre></p>
|
225
|
+
</blockquote>
|
226
|
+
END
|
227
|
+
@parser.parse('> <pre>').should == expected
|
228
|
+
end
|
229
|
+
|
230
|
+
it 'should ignore PRE_END inside BLOCKQUOTE blocks' do
|
231
|
+
expected = dedent <<-END
|
232
|
+
<blockquote>
|
233
|
+
<p></pre></p>
|
234
|
+
</blockquote>
|
235
|
+
END
|
236
|
+
@parser.parse('> </pre>').should == expected
|
237
|
+
end
|
238
|
+
|
239
|
+
it 'should ignore PRE_START inside UL blocks' do
|
240
|
+
expected = dedent <<-END
|
241
|
+
<ul>
|
242
|
+
<li><pre></li>
|
243
|
+
</ul>
|
244
|
+
END
|
245
|
+
@parser.parse('* <pre>').should == expected
|
246
|
+
end
|
247
|
+
|
248
|
+
it 'should ignore PRE_END inside UL blocks' do
|
249
|
+
expected = dedent <<-END
|
250
|
+
<ul>
|
251
|
+
<li></pre></li>
|
252
|
+
</ul>
|
253
|
+
END
|
254
|
+
@parser.parse('* </pre>').should == expected
|
255
|
+
end
|
256
|
+
|
257
|
+
it 'should ignore PRE_START inside OL blocks' do
|
258
|
+
expected = dedent <<-END
|
259
|
+
<ol>
|
260
|
+
<li><pre></li>
|
261
|
+
</ol>
|
262
|
+
END
|
263
|
+
@parser.parse('# <pre>').should == expected
|
264
|
+
end
|
265
|
+
|
266
|
+
it 'should ignore PRE_END inside OL blocks' do
|
267
|
+
expected = dedent <<-END
|
268
|
+
<ol>
|
269
|
+
<li></pre></li>
|
270
|
+
</ol>
|
271
|
+
END
|
272
|
+
@parser.parse('# </pre>').should == expected
|
273
|
+
end
|
274
|
+
|
275
|
+
it 'should ignore PRE_START inside H1 blocks' do
|
276
|
+
@parser.parse('= <pre> =').should == "<h1><pre></h1>\n"
|
277
|
+
end
|
278
|
+
|
279
|
+
it 'should ignore PRE_END inside H1 blocks' do
|
280
|
+
@parser.parse('= </pre> =').should == "<h1></pre></h1>\n"
|
281
|
+
end
|
282
|
+
|
283
|
+
it 'should ignore PRE_START inside H2 blocks' do
|
284
|
+
@parser.parse('== <pre> ==').should == "<h2><pre></h2>\n"
|
285
|
+
end
|
286
|
+
|
287
|
+
it 'should ignore PRE_END inside H2 blocks' do
|
288
|
+
@parser.parse('== </pre> ==').should == "<h2></pre></h2>\n"
|
289
|
+
end
|
290
|
+
|
291
|
+
it 'should ignore PRE_START inside H3 blocks' do
|
292
|
+
@parser.parse('=== <pre> ===').should == "<h3><pre></h3>\n"
|
293
|
+
end
|
294
|
+
|
295
|
+
it 'should ignore PRE_END inside H3 blocks' do
|
296
|
+
@parser.parse('=== </pre> ===').should == "<h3></pre></h3>\n"
|
297
|
+
end
|
298
|
+
|
299
|
+
it 'should ignore PRE_START inside H4 blocks' do
|
300
|
+
@parser.parse('==== <pre> ====').should == "<h4><pre></h4>\n"
|
301
|
+
end
|
302
|
+
|
303
|
+
it 'should ignore PRE_END inside H4 blocks' do
|
304
|
+
@parser.parse('==== </pre> ====').should == "<h4></pre></h4>\n"
|
305
|
+
end
|
306
|
+
|
307
|
+
it 'should ignore PRE_START inside H5 blocks' do
|
308
|
+
@parser.parse('===== <pre> =====').should == "<h5><pre></h5>\n"
|
309
|
+
end
|
310
|
+
|
311
|
+
it 'should ignore PRE_END inside H5 blocks' do
|
312
|
+
@parser.parse('===== </pre> =====').should == "<h5></pre></h5>\n"
|
313
|
+
end
|
314
|
+
|
315
|
+
it 'should ignore PRE_START inside H6 blocks' do
|
316
|
+
@parser.parse('====== <pre> ======').should == "<h6><pre></h6>\n"
|
317
|
+
end
|
318
|
+
|
319
|
+
it 'should ignore PRE_END inside H6 blocks' do
|
320
|
+
@parser.parse('====== </pre> ======').should == "<h6></pre></h6>\n"
|
321
|
+
end
|
322
|
+
|
323
|
+
it 'should start a <pre> block on seeing PRE_START partway through a P block' do
|
324
|
+
# the trailing space after "hello" is preserved just like it would be if the input were "hello " and nothing else
|
325
|
+
expected = dedent <<-END
|
326
|
+
<p>hello </p>
|
327
|
+
<pre>world</pre>
|
328
|
+
END
|
329
|
+
@parser.parse('hello <pre>world</pre>').should == expected
|
330
|
+
end
|
331
|
+
|
332
|
+
it 'should close any open spans while starting a <pre> block on seeing PRE_START partway through a P block' do
|
333
|
+
# ''
|
334
|
+
expected = dedent <<-END
|
335
|
+
<p>hello <em>my </em></p>
|
336
|
+
<pre>world</pre>
|
337
|
+
END
|
338
|
+
@parser.parse("hello ''my <pre>world</pre>").should == expected
|
339
|
+
|
340
|
+
# '''
|
341
|
+
expected = dedent <<-END
|
342
|
+
<p>hello <strong>my </strong></p>
|
343
|
+
<pre>world</pre>
|
344
|
+
END
|
345
|
+
@parser.parse("hello '''my <pre>world</pre>").should == expected
|
346
|
+
|
347
|
+
# '''''
|
348
|
+
expected = dedent <<-END
|
349
|
+
<p>hello <strong><em>my </em></strong></p>
|
350
|
+
<pre>world</pre>
|
351
|
+
END
|
352
|
+
@parser.parse("hello '''''my <pre>world</pre>").should == expected
|
353
|
+
|
354
|
+
# `
|
355
|
+
expected = dedent <<-END
|
356
|
+
<p>hello <tt>my </tt></p>
|
357
|
+
<pre>world</pre>
|
358
|
+
END
|
359
|
+
@parser.parse("hello `my <pre>world</pre>").should == expected
|
360
|
+
|
361
|
+
# <em>
|
362
|
+
expected = dedent <<-END
|
363
|
+
<p>hello <em>my </em></p>
|
364
|
+
<pre>world</pre>
|
365
|
+
END
|
366
|
+
@parser.parse("hello <em>my <pre>world</pre>").should == expected
|
367
|
+
|
368
|
+
# <strong>
|
369
|
+
expected = dedent <<-END
|
370
|
+
<p>hello <strong>my </strong></p>
|
371
|
+
<pre>world</pre>
|
372
|
+
END
|
373
|
+
@parser.parse("hello <strong>my <pre>world</pre>").should == expected
|
374
|
+
|
375
|
+
# <strong><em>
|
376
|
+
expected = dedent <<-END
|
377
|
+
<p>hello <strong><em>my </em></strong></p>
|
378
|
+
<pre>world</pre>
|
379
|
+
END
|
380
|
+
@parser.parse("hello <strong><em>my <pre>world</pre>").should == expected
|
381
|
+
|
382
|
+
# <tt>
|
383
|
+
expected = dedent <<-END
|
384
|
+
<p>hello <tt>my </tt></p>
|
385
|
+
<pre>world</pre>
|
386
|
+
END
|
387
|
+
@parser.parse("hello <tt>my <pre>world</pre>").should == expected
|
388
|
+
end
|
389
|
+
|
390
|
+
it 'should rollback open internal link spans on encountering a PRE_START in the link target' do
|
391
|
+
expected = dedent <<-END
|
392
|
+
<p>[[hello </p>
|
393
|
+
<pre>world</pre>
|
394
|
+
<p>]]</p>
|
395
|
+
END
|
396
|
+
@parser.parse('[[hello <pre>world</pre>]]').should == expected
|
397
|
+
end
|
398
|
+
|
399
|
+
it 'should rollback open internal link spans on encountering a PRE_START in the link text' do
|
400
|
+
expected = dedent <<-END
|
401
|
+
<p>[[hello | there</p>
|
402
|
+
<pre>world</pre>
|
403
|
+
<p>]]</p>
|
404
|
+
END
|
405
|
+
@parser.parse('[[hello | there<pre>world</pre>]]').should == expected
|
406
|
+
end
|
407
|
+
|
408
|
+
it 'should automatically close open PRE_START blocks on hitting the end-of-file' do
|
409
|
+
@parser.parse('<pre>foo').should == "<pre>foo</pre>\n"
|
410
|
+
end
|
411
|
+
end
|