trac-wiki 0.2.21 → 0.2.23
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/trac-wiki/parser.rb +7 -1
- data/lib/trac-wiki/tree.rb +4 -4
- data/lib/trac-wiki/version.rb +1 -1
- data/test/parser_test.rb +166 -159
- metadata +2 -2
data/lib/trac-wiki/parser.rb
CHANGED
@@ -282,9 +282,14 @@ module TracWiki
|
|
282
282
|
# make_local_link("LocalLink") #=> "/LocalLink"
|
283
283
|
# make_local_link("Wikipedia:Bread") #=> "http://en.wikipedia.org/wiki/Bread"
|
284
284
|
def make_local_link(link) #:doc:
|
285
|
-
return "#{@base}#{link}" if no_escape?
|
286
285
|
link, anch = link.split(/#/, 2)
|
286
|
+
if no_escape?
|
287
|
+
return "#{@base}#{link}" if ! anch
|
288
|
+
return "##{anch}" if link == ''
|
289
|
+
return "#{@base}#{link}##{anch}"
|
290
|
+
end
|
287
291
|
return "#{@base}#{escape_url(link)}" if ! anch
|
292
|
+
return "##{escape_url(anch)}" if link == ''
|
288
293
|
"#{@base}#{escape_url(link)}##{escape_url(anch)}"
|
289
294
|
end
|
290
295
|
|
@@ -417,6 +422,7 @@ module TracWiki
|
|
417
422
|
str = $'
|
418
423
|
link, content, whole= $1, $3, $&
|
419
424
|
make_link(link, content, "[#{whole}]")
|
425
|
+
# [[ link1 | text2 ]]
|
420
426
|
when /\A \[\[ \s* ([^|]*?) \s* (\|\s*(.*?))? \s* \]\] /mx
|
421
427
|
str = $'
|
422
428
|
link, content, whole= $1, $3, $&
|
data/lib/trac-wiki/tree.rb
CHANGED
@@ -144,8 +144,8 @@ module TracWiki
|
|
144
144
|
end
|
145
145
|
|
146
146
|
|
147
|
-
TAGS_APPEND_NL = [:div, :p]
|
148
|
-
TAGS_FORCE_PAIR = [:a, :td, :h1, :h2, :h3, :h4, :h5, :h6, :div, :
|
147
|
+
TAGS_APPEND_NL = [:div, :p, :li, :ol, :ul, :dl, :table, :tr, :td ]
|
148
|
+
TAGS_FORCE_PAIR = [:a, :td, :h1, :h2, :h3, :h4, :h5, :h6, :div, :script]
|
149
149
|
TAGS_ALLOVED = [:a,
|
150
150
|
:h1, :h2, :h3, :h4, :h5, :h6,
|
151
151
|
:div, :span, :p, :pre,
|
@@ -155,7 +155,7 @@ module TracWiki
|
|
155
155
|
:br , :img, :hr,
|
156
156
|
:form, :textarea, :input, :select, :option,
|
157
157
|
]
|
158
|
-
TAGS_SKIP_EMPTY = [ :p ]
|
158
|
+
TAGS_SKIP_EMPTY = [ :p , :ol, :li, :strong, :em ]
|
159
159
|
ATTRIBUTES_ALLOWED = { :form => [:action, :meth],
|
160
160
|
:input => [:size, :type, :value, :name],
|
161
161
|
:select => [:multiple, :name],
|
@@ -178,7 +178,7 @@ module TracWiki
|
|
178
178
|
attrs.each_pair do |k,v|
|
179
179
|
next if v.nil?
|
180
180
|
k_sym = k.to_sym
|
181
|
-
next if ! ATTRIBUTES_ALLOWED[:_all].include?(k_sym)
|
181
|
+
next if ! ( ATTRIBUTES_ALLOWED[:_all].include?(k_sym) || tag_attrs.include?(k_sym) )
|
182
182
|
next if k == :style && v !~ ATTRIBUTE_STYLE_REX
|
183
183
|
#print "style: #{v}\n" if k == :style
|
184
184
|
ret.push "#{TracWiki::Parser.escapeHTML(k.to_s)}=\"#{TracWiki::Parser.escapeHTML(v.to_s)}\""
|
data/lib/trac-wiki/version.rb
CHANGED
data/test/parser_test.rb
CHANGED
@@ -50,7 +50,7 @@ describe TracWiki::Parser do
|
|
50
50
|
it 'should not parse linkd' do
|
51
51
|
tc "<p>[[ahoj]]</p>\n", "[[ahoj]]", :no_link => true
|
52
52
|
tc "<p>[[ahoj|bhoj]]</p>\n", "[[ahoj|bhoj]]", :no_link => true
|
53
|
-
tc "<ul><li>[[ahoj|bhoj]]</li
|
53
|
+
tc "<ul><li>[[ahoj|bhoj]]</li>\n</ul>\n", "* [[ahoj|bhoj]]", :no_link => true
|
54
54
|
end
|
55
55
|
it 'should parse bold' do
|
56
56
|
# Bold can be used inside paragraphs
|
@@ -58,10 +58,10 @@ describe TracWiki::Parser do
|
|
58
58
|
tc "<p>This <strong>is</strong> bold and <strong>bold</strong>ish</p>\n", "This **is** bold and **bold**ish"
|
59
59
|
|
60
60
|
# Bold can be used inside list items
|
61
|
-
tc "<ul><li>This is <strong>bold</strong></li
|
61
|
+
tc "<ul><li>This is <strong>bold</strong></li>\n</ul>\n", "* This is **bold**"
|
62
62
|
|
63
63
|
# Bold can be used inside table cells
|
64
|
-
tc("<table><tr><td>This is <strong>bold</strong></td
|
64
|
+
tc("<table><tr><td>This is <strong>bold</strong></td>\n</tr>\n</table>\n",
|
65
65
|
"||This is **bold**||")
|
66
66
|
|
67
67
|
# Links can appear inside bold text:
|
@@ -72,11 +72,11 @@ describe TracWiki::Parser do
|
|
72
72
|
tc "<p>This <strong>is bold</strong></p>\n", "This **is bold"
|
73
73
|
|
74
74
|
# Bold will end at the end of list items
|
75
|
-
tc("<ul><li>Item <strong>bold</strong></li
|
75
|
+
tc("<ul><li>Item <strong>bold</strong></li>\n<li>Item normal</li>\n</ul>\n",
|
76
76
|
"* Item **bold\n* Item normal")
|
77
77
|
|
78
78
|
# Bold will end at the end of table cells
|
79
|
-
tc("<table><tr><td>Item <strong>bold</strong></td
|
79
|
+
tc("<table><tr><td>Item <strong>bold</strong></td>\n<td>Another <strong>bold</strong></td>\n</tr>\n</table>\n",
|
80
80
|
"||Item **bold||Another **bold||")
|
81
81
|
|
82
82
|
# Bold should not cross paragraphs
|
@@ -121,10 +121,10 @@ describe TracWiki::Parser do
|
|
121
121
|
"This ''is'' italic and ''italic''ish")
|
122
122
|
|
123
123
|
# Italic can be used inside list items
|
124
|
-
tc "<ul><li>This is <em>italic</em></li
|
124
|
+
tc "<ul><li>This is <em>italic</em></li>\n</ul>\n", "* This is ''italic''"
|
125
125
|
|
126
126
|
# Italic can be used inside table cells
|
127
|
-
tc("<table><tr><td>This is <em>italic</em></td
|
127
|
+
tc("<table><tr><td>This is <em>italic</em></td>\n</tr>\n</table>\n",
|
128
128
|
"||This is ''italic''||")
|
129
129
|
|
130
130
|
# Links can appear inside italic text:
|
@@ -135,11 +135,11 @@ describe TracWiki::Parser do
|
|
135
135
|
tc "<p>This <em>is italic</em></p>\n", "This ''is italic"
|
136
136
|
|
137
137
|
# Italic will end at the end of list items
|
138
|
-
tc("<ul><li>Item <em>italic</em></li
|
138
|
+
tc("<ul><li>Item <em>italic</em></li>\n<li>Item normal</li>\n</ul>\n",
|
139
139
|
"* Item ''italic\n* Item normal")
|
140
140
|
|
141
141
|
# Italic will end at the end of table cells
|
142
|
-
tc("<table><tr><td>Item <em>italic</em></td
|
142
|
+
tc("<table><tr><td>Item <em>italic</em></td>\n<td>Another <em>italic</em></td>\n</tr>\n</table>\n",
|
143
143
|
"||Item ''italic||Another ''italic")
|
144
144
|
|
145
145
|
# Italic should not cross paragraphs
|
@@ -295,10 +295,10 @@ describe TracWiki::Parser do
|
|
295
295
|
tc "<p>This is my text.</p>\n<p>This is more text.</p>\n", "This is\nmy text.\n\n\n\nThis is\nmore text."
|
296
296
|
|
297
297
|
# A list end paragraphs too.
|
298
|
-
tc "<p>Hello</p>\n<ul><li>Item</li
|
298
|
+
tc "<p>Hello</p>\n<ul><li>Item</li>\n</ul>\n", "Hello\n* Item\n"
|
299
299
|
|
300
300
|
# A table end paragraphs too.
|
301
|
-
tc "<p>Hello</p>\n<table><tr><td>Cell</td
|
301
|
+
tc "<p>Hello</p>\n<table><tr><td>Cell</td>\n</tr>\n</table>\n", "Hello\n||Cell||"
|
302
302
|
|
303
303
|
# A nowiki end paragraphs too.
|
304
304
|
tc "<p>Hello</p>\n<pre>nowiki</pre>", "Hello\n{{{\nnowiki\n}}}\n"
|
@@ -326,15 +326,15 @@ describe TracWiki::Parser do
|
|
326
326
|
end
|
327
327
|
it 'should parse definition list' do
|
328
328
|
# FIXME: trailing space
|
329
|
-
tc "<dl><dt>Monty Python</dt><dd> definition</dd></dl
|
330
|
-
tc "<dl><dt>Monty Python</dt><dd> definition</dd></dl
|
331
|
-
tc "<dl><dt>Monty Python</dt><dd> definition</dd></dl
|
332
|
-
tc "<dl><dt>Monty Python</dt><dd> definition</dd></dl
|
333
|
-
tc "<dl><dt>Monty Python</dt><dd> definition</dd></dl
|
334
|
-
tc "<dl><dt>Monty Python</dt><dd> definition</dd></dl
|
335
|
-
tc "<dl><dt>Monty Python</dt><dd> definition</dd></dl
|
336
|
-
tc "<dl><dt>Monty::Python</dt><dd> definition</dd></dl
|
337
|
-
tc "<dl><dt>::Python</dt><dd> definition</dd></dl
|
329
|
+
tc "<dl><dt>Monty Python</dt><dd> definition</dd></dl>\n", "Monty Python:: \n definition\n"
|
330
|
+
tc "<dl><dt>Monty Python</dt><dd> definition</dd></dl>\n", "Monty Python::\ndefinition\n"
|
331
|
+
tc "<dl><dt>Monty Python</dt><dd> definition</dd></dl>\n", "Monty Python::\r\ndefinition\n"
|
332
|
+
tc "<dl><dt>Monty Python</dt><dd> definition</dd></dl>\n", "Monty Python::\r\n definition\n"
|
333
|
+
tc "<dl><dt>Monty Python</dt><dd> definition</dd></dl>\n", "Monty Python:: \r\n definition\n"
|
334
|
+
tc "<dl><dt>Monty Python</dt><dd> definition</dd></dl>\n", "Monty Python:: definition\n"
|
335
|
+
tc "<dl><dt>Monty Python</dt><dd> definition</dd></dl>\n", "Monty Python:: definition\n"
|
336
|
+
tc "<dl><dt>Monty::Python</dt><dd> definition</dd></dl>\n", "Monty::Python:: definition\n"
|
337
|
+
tc "<dl><dt>::Python</dt><dd> definition</dd></dl>\n", "::Python:: definition\n"
|
338
338
|
end
|
339
339
|
it 'should not parse definition list' do
|
340
340
|
# FIXME: trailing space
|
@@ -349,133 +349,133 @@ describe TracWiki::Parser do
|
|
349
349
|
# List items begin with a * at the beginning of a line.
|
350
350
|
# An item ends at the next *
|
351
351
|
|
352
|
-
tc "<ul><li>Item 1 next</li
|
352
|
+
tc "<ul><li>Item 1 next</li>\n</ul>\n", "* Item 1\n next\n"
|
353
353
|
|
354
354
|
# Whitespace is optional before and after the *.
|
355
|
-
tc("<ul><li>Item 1</li
|
355
|
+
tc("<ul><li>Item 1</li>\n<li>Item 2</li>\n<li>Item 3</li>\n</ul>\n",
|
356
356
|
" * Item 1\n * Item 2\n *\t\tItem 3\n")
|
357
357
|
|
358
358
|
# A space is required if if the list element starts with bold text.
|
359
|
-
tc("<ul><li><strong>Item 1</strong></li
|
359
|
+
tc("<ul><li><strong>Item 1</strong></li>\n</ul>\n", "* **Item 1")
|
360
360
|
|
361
361
|
# An item ends at blank line
|
362
|
-
tc("<ul><li>Item</li
|
362
|
+
tc("<ul><li>Item</li>\n</ul>\n<p>Par</p>\n", "* Item\n\nPar\n")
|
363
363
|
|
364
364
|
# An item ends at a heading
|
365
|
-
tc("<ul><li>Item</li
|
365
|
+
tc("<ul><li>Item</li>\n</ul>\n<h1>Heading</h1>", "* Item\n= Heading =\n")
|
366
366
|
|
367
367
|
# An item ends at a table
|
368
|
-
tc("<ul><li>Item</li
|
368
|
+
tc("<ul><li>Item</li>\n</ul>\n<table><tr><td>Cell</td>\n</tr>\n</table>\n", "* Item\n||Cell||\n")
|
369
369
|
|
370
370
|
# An item ends at a nowiki block
|
371
|
-
tc("<ul><li>Item</li
|
371
|
+
tc("<ul><li>Item</li>\n</ul>\n<pre>Code</pre>", "* Item\n{{{\nCode\n}}}\n")
|
372
372
|
|
373
373
|
# An item can span multiple lines
|
374
|
-
tc("<ul><li>The quick brown fox jumps over lazy dog.</li
|
374
|
+
tc("<ul><li>The quick brown fox jumps over lazy dog.</li>\n<li>Humpty Dumpty sat on a wall.</li>\n</ul>\n",
|
375
375
|
"* The quick\nbrown fox\n\tjumps over\nlazy dog.\n* Humpty Dumpty\nsat\t\non a wall.")
|
376
376
|
|
377
377
|
# An item can contain line breaks
|
378
|
-
tc("<ul><li>The quick brown<br/>fox jumps over lazy dog.</li
|
378
|
+
tc("<ul><li>The quick brown<br/>fox jumps over lazy dog.</li>\n</ul>\n",
|
379
379
|
"* The quick brown\\\\fox jumps over lazy dog.")
|
380
380
|
|
381
381
|
# Nested
|
382
|
-
tc "<ul><li>Item 1<ul><li>Item 2</li
|
382
|
+
tc "<ul><li>Item 1<ul><li>Item 2</li>\n</ul>\n</li>\n<li>Item 3</li>\n</ul>\n", "* Item 1\n * Item 2\n*\t\tItem 3\n"
|
383
383
|
|
384
384
|
# Nested up to 5 levels
|
385
|
-
tc("<ul><li>Item 1<ul><li>Item 2<ul><li>Item 3<ul><li>Item 4<ul><li>Item 5</li
|
385
|
+
tc("<ul><li>Item 1<ul><li>Item 2<ul><li>Item 3<ul><li>Item 4<ul><li>Item 5</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n",
|
386
386
|
"* Item 1\n * Item 2\n * Item 3\n * Item 4\n * Item 5\n")
|
387
387
|
|
388
|
-
tc("<ul><li>Item 1<ul><li>Item 2<ul><li>Item 3<ul><li>Item 4</li
|
388
|
+
tc("<ul><li>Item 1<ul><li>Item 2<ul><li>Item 3<ul><li>Item 4</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n</li>\n<li>Item 5</li>\n</ul>\n",
|
389
389
|
"* Item 1\n * Item 2\n * Item 3\n * Item 4\n* Item 5\n")
|
390
390
|
|
391
391
|
# ** immediatly following a list element will be treated as a nested unordered element.
|
392
|
-
tc("<ul><li>Hello, World!<ul><li>Not bold</li
|
392
|
+
tc("<ul><li>Hello, World!<ul><li>Not bold</li>\n</ul>\n</li>\n</ul>\n",
|
393
393
|
"* Hello,\n World!\n * Not bold\n")
|
394
394
|
|
395
395
|
# ** immediatly following a list element will be treated as a nested unordered element.
|
396
|
-
tc("<ol><li>Hello, World!<ul><li>Not bold</li
|
396
|
+
tc("<ol><li>Hello, World!<ul><li>Not bold</li>\n</ul>\n</li>\n</ol>\n",
|
397
397
|
"1. Hello,\n World!\n * Not bold\n")
|
398
398
|
|
399
399
|
# [...] otherwise it will be treated as the beginning of bold text.
|
400
|
-
tc("<ul><li>Hello, World!</li
|
400
|
+
tc("<ul><li>Hello, World!</li>\n</ul>\n<p><strong>Not bold</strong></p>\n",
|
401
401
|
"* Hello,\nWorld!\n\n**Not bold\n")
|
402
402
|
end
|
403
403
|
|
404
404
|
it 'should parse ordered lists' do
|
405
405
|
# List items begin with a * at the beginning of a line.
|
406
406
|
# An item ends at the next *
|
407
|
-
tc "<ol><li>Item 1</li
|
407
|
+
tc "<ol><li>Item 1</li>\n<li>Item 2</li>\n<li>Item 3</li>\n</ol>\n", "1. Item 1\n2. Item 2\n3. \t\tItem 3\n"
|
408
408
|
|
409
409
|
# Whitespace is optional before and after the #.
|
410
|
-
tc("<ol><li>Item 1</li
|
410
|
+
tc("<ol><li>Item 1</li>\n<li>Item 2</li>\n<li>Item 3</li>\n</ol>\n",
|
411
411
|
"1. Item 1\n1. Item 2\n4.\t\tItem 3\n")
|
412
412
|
|
413
413
|
# A space is required if if the list element starts with bold text.
|
414
|
-
# tc("<ol><li><ol><li><ol><li>Item 1</li></ol
|
415
|
-
tc("<ol><li><strong>Item 1</strong></li
|
414
|
+
# tc("<ol><li><ol><li><ol><li>Item 1</li></ol>\n</li>\n</ol>\n</li>\n</ol>\n", "###Item 1")
|
415
|
+
tc("<ol><li><strong>Item 1</strong></li>\n</ol>\n", "1. **Item 1")
|
416
416
|
|
417
417
|
# An item ends at blank line
|
418
|
-
tc("<ol><li>Item</li
|
418
|
+
tc("<ol><li>Item</li>\n</ol>\n<p>Par</p>\n", "1. Item\n\nPar\n")
|
419
419
|
|
420
420
|
# An item ends at a heading
|
421
|
-
tc("<ol><li>Item</li
|
421
|
+
tc("<ol><li>Item</li>\n</ol>\n<h1>Heading</h1>", "1. Item\n= Heading =\n")
|
422
422
|
|
423
423
|
# An item ends at a table
|
424
|
-
tc("<ol><li>Item</li
|
424
|
+
tc("<ol><li>Item</li>\n</ol>\n<table><tr><td>Cell</td>\n</tr>\n</table>\n", "1. Item\n||Cell||\n")
|
425
425
|
|
426
426
|
# An item ends at a nowiki block
|
427
|
-
tc("<ol><li>Item</li
|
427
|
+
tc("<ol><li>Item</li>\n</ol>\n<pre>Code</pre>", "1. Item\n{{{\nCode\n}}}\n")
|
428
428
|
|
429
429
|
# An item can span multiple lines
|
430
|
-
tc("<ol><li>The quick brown fox jumps over lazy dog.</li
|
430
|
+
tc("<ol><li>The quick brown fox jumps over lazy dog.</li>\n<li>Humpty Dumpty sat on a wall.</li>\n</ol>\n",
|
431
431
|
"1. The quick\nbrown fox\n\tjumps over\nlazy dog.\n2. Humpty Dumpty\nsat\t\non a wall.")
|
432
432
|
|
433
433
|
# An item can contain line breaks
|
434
|
-
tc("<ol><li>The quick brown<br/>fox jumps over lazy dog.</li
|
434
|
+
tc("<ol><li>The quick brown<br/>fox jumps over lazy dog.</li>\n</ol>\n",
|
435
435
|
"1. The quick brown\\\\fox jumps over lazy dog.")
|
436
436
|
|
437
437
|
# Nested
|
438
|
-
tc "<ol><li>Item 1<ol><li>Item 2</li
|
438
|
+
tc "<ol><li>Item 1<ol><li>Item 2</li>\n</ol>\n</li>\n<li>Item 3</li>\n</ol>\n", "1. Item 1\n 1. Item 2\n2.\t\tItem 3\n"
|
439
439
|
|
440
440
|
# Nested up to 5 levels
|
441
|
-
tc("<ol><li>Item 1<ol><li>Item 2<ol><li>Item 3<ol><li>Item 4<ol><li>Item 5</li
|
441
|
+
tc("<ol><li>Item 1<ol><li>Item 2<ol><li>Item 3<ol><li>Item 4<ol><li>Item 5</li>\n</ol>\n</li>\n</ol>\n</li>\n</ol>\n</li>\n</ol>\n</li>\n</ol>\n",
|
442
442
|
"1. Item 1\n 1. Item 2\n 1. Item 3\n 1. Item 4\n 1. Item 5\n")
|
443
443
|
|
444
444
|
# The two-bullet rule only applies to **.
|
445
|
-
# tc("<ol><li><ol><li>Item</li
|
445
|
+
# tc("<ol><li><ol><li>Item</li>\n</ol>\n</li>\n</ol>\n", "##Item")
|
446
446
|
end
|
447
447
|
|
448
448
|
it 'should parse ordered lists #2' do
|
449
|
-
tc "<ol><li>Item 1</li
|
449
|
+
tc "<ol><li>Item 1</li>\n<li>Item 2</li>\n<li>Item 3</li>\n</ol>\n", "1. Item 1\n1. Item 2\n1.\t\tItem 3\n"
|
450
450
|
# Nested
|
451
|
-
tc "<ol><li>Item 1<ol><li>Item 2</li
|
451
|
+
tc "<ol><li>Item 1<ol><li>Item 2</li>\n</ol>\n</li>\n<li>Item 3</li>\n</ol>\n", "1. Item 1\n 1. Item 2\n1.\t\tItem 3\n"
|
452
452
|
# Multiline
|
453
|
-
tc "<ol><li>Item 1 on multiple lines</li
|
453
|
+
tc "<ol><li>Item 1 on multiple lines</li>\n</ol>\n", "1. Item 1\non multiple lines"
|
454
454
|
end
|
455
455
|
|
456
456
|
it 'should parse ambiguious mixed lists' do
|
457
457
|
# ol following ul
|
458
|
-
tc("<ul><li>uitem</li
|
458
|
+
tc("<ul><li>uitem</li>\n</ul>\n<ol><li>oitem</li>\n</ol>\n", "* uitem\n1. oitem\n")
|
459
459
|
|
460
460
|
# ul following ol
|
461
|
-
tc("<ol><li>uitem</li
|
461
|
+
tc("<ol><li>uitem</li>\n</ol>\n<ul><li>oitem</li>\n</ul>\n", "1. uitem\n* oitem\n")
|
462
462
|
|
463
463
|
# 2ol following ul
|
464
|
-
tc("<ul><li>uitem<ol><li>oitem</li
|
464
|
+
tc("<ul><li>uitem<ol><li>oitem</li>\n</ol>\n</li>\n</ul>\n", "* uitem\n 1. oitem\n")
|
465
465
|
|
466
466
|
# 2ul following ol
|
467
|
-
tc("<ol><li>uitem<ul><li>oitem</li
|
467
|
+
tc("<ol><li>uitem<ul><li>oitem</li>\n</ul>\n</li>\n</ol>\n", "1. uitem\n * oitem\n")
|
468
468
|
|
469
469
|
# 3ol following 3ul
|
470
|
-
# tc("<ul><li><ul><li><ul><li>uitem</li
|
470
|
+
# tc("<ul><li><ul><li><ul><li>uitem</li>\n</ul>\n<ol><li>oitem</li>\n</ol>\n</li>\n</ul>\n</li>\n</ul>\n", "***uitem\n###oitem\n")
|
471
471
|
|
472
472
|
# 2ul following 2ol
|
473
|
-
# tc("<ol><li><ol><li>uitem</li
|
473
|
+
# tc("<ol><li><ol><li>uitem</li>\n</ol>\n<ul><li>oitem</li>\n</ul>\n</li>\n</ol>\n", "##uitem\n**oitem\n")
|
474
474
|
|
475
475
|
# ol following 2ol
|
476
|
-
# tc("<ol><li><ol><li>oitem1</li
|
476
|
+
# tc("<ol><li><ol><li>oitem1</li>\n</ol>\n</li>\n<li>oitem2</li>\n</ol>\n", "##oitem1\n#oitem2\n")
|
477
477
|
# ul following 2ol
|
478
|
-
# tc("<ol><li><ol><li>oitem1</li
|
478
|
+
# tc("<ol><li><ol><li>oitem1</li>\n</ol>\n</li>\n</ol>\n<ul><li>oitem2</li>\n</ul>\n", "##oitem1\n*oitem2\n")
|
479
479
|
end
|
480
480
|
|
481
481
|
it 'should parse ambiguious italics and url' do
|
@@ -588,67 +588,67 @@ describe TracWiki::Parser do
|
|
588
588
|
end
|
589
589
|
|
590
590
|
it 'should parse table' do
|
591
|
-
tc "<table><tr><td>Hello</td
|
592
|
-
tc "<table><tr><td>Hello</td
|
593
|
-
tc "<table><tr><td>Hello</td
|
594
|
-
tc "<table><tr><td>Hello</td
|
595
|
-
tc "<table><tr><td>He</td
|
596
|
-
tc "<table><tr><td>Hello</td
|
597
|
-
tc "<table><tr><td>Hello</td
|
598
|
-
tc "<table><tr><td>1</td
|
599
|
-
|
600
|
-
tc "<table><tr><td>table</td
|
601
|
-
tc "<table><tr><td>table</td
|
602
|
-
tc "<table><tr><td>table</td
|
603
|
-
|
604
|
-
tc "<table><tr><td>Hello, World!</td
|
605
|
-
tc "<table><tr><td style=\"text-align:right\">Hello, Right World!</td
|
606
|
-
tc "<table><tr><th style=\"text-align:right\">Hello, Right World!</th></tr
|
607
|
-
tc "<table><tr><td style=\"text-align:center\">Hello, Centered World!</td
|
608
|
-
tc "<table><tr><th style=\"text-align:center\">Hello, Centered World!</th></tr
|
591
|
+
tc "<table><tr><td>Hello</td>\n<td>World!</td>\n</tr>\n</table>\n", "||Hello||World!||"
|
592
|
+
tc "<table><tr><td>Hello</td>\n<td>World!</td>\n</tr>\n<tr><td>Hello</td>\n<td>World!</td>\n</tr>\n</table>\n", "||Hello||World!||\n||Hello||World!||\n\n"
|
593
|
+
tc "<table><tr><td>Hello</td>\n<td>World!</td>\n</tr>\n<tr><td>Hello</td>\n<td>World!</td>\n</tr>\n</table>\n", "||Hello||World!||\r\n||Hello||World!||\r\n\n"
|
594
|
+
tc "<table><tr><td>Hello</td>\n<td>World!</td>\n</tr>\n</table>\n", "||Hello||\\\n||World!||"
|
595
|
+
tc "<table><tr><td>He</td>\n<td>llo</td>\n<td>World!</td>\n</tr>\n</table>\n", "||He||llo||\\\n||World!||"
|
596
|
+
tc "<table><tr><td>Hello</td>\n<td colspan=\"2\">World!</td>\n</tr>\n</table>\n", "||Hello||||World!||"
|
597
|
+
tc "<table><tr><td>Hello</td>\n<td colspan=\"2\">kuk</td>\n<td>World!</td>\n</tr>\n</table>\n", "||Hello||||kuk||\\\n||World!||"
|
598
|
+
tc "<table><tr><td>1</td>\n<td>2</td>\n<td>3</td>\n</tr>\n<tr><td colspan=\"2\">1-2</td>\n<td>3</td>\n</tr>\n<tr><td>1</td>\n<td colspan=\"2\">2-3</td>\n</tr>\n<tr><td colspan=\"3\">1-2-3</td>\n</tr>\n</table>\n", "|| 1 || 2 || 3 ||\n|||| 1-2 || 3 ||\n|| 1 |||| 2-3 ||\n|||||| 1-2-3 ||\n"
|
599
|
+
|
600
|
+
tc "<table><tr><td>table</td>\n<td style=\"text-align:center\">center</td>\n</tr>\n</table>\n", "||table|| center ||"
|
601
|
+
tc "<table><tr><td>table</td>\n<td style=\"text-align:right\">right</td>\n</tr>\n</table>\n", "||table|| right||"
|
602
|
+
tc "<table><tr><td>table</td>\n<td style=\"text-align:center\">center</td>\n<td style=\"text-align:right\">right</td>\n</tr>\n</table>\n", "||table|| center || right||"
|
603
|
+
|
604
|
+
tc "<table><tr><td>Hello, World!</td>\n</tr>\n</table>\n", "||Hello, World!||"
|
605
|
+
tc "<table><tr><td style=\"text-align:right\">Hello, Right World!</td>\n</tr>\n</table>\n", "|| Hello, Right World!||"
|
606
|
+
tc "<table><tr><th style=\"text-align:right\">Hello, Right World!</th></tr>\n</table>\n", "||= Hello, Right World!=||"
|
607
|
+
tc "<table><tr><td style=\"text-align:center\">Hello, Centered World!</td>\n</tr>\n</table>\n", "|| Hello, Centered World! ||"
|
608
|
+
tc "<table><tr><th style=\"text-align:center\">Hello, Centered World!</th></tr>\n</table>\n", "||= Hello, Centered World! =||"
|
609
609
|
# Multiple columns
|
610
|
-
tc "<table><tr><td>c1</td
|
610
|
+
tc "<table><tr><td>c1</td>\n<td>c2</td>\n<td>c3</td>\n</tr>\n</table>\n", "||c1||c2||c3||"
|
611
611
|
# Multiple rows
|
612
|
-
tc "<table><tr><td>c11</td
|
612
|
+
tc "<table><tr><td>c11</td>\n<td>c12</td>\n</tr>\n<tr><td>c21</td>\n<td>c22</td>\n</tr>\n</table>\n", "||c11||c12||\n||c21||c22||\n"
|
613
613
|
# End pipe is optional
|
614
|
-
tc "<table><tr><td>c1</td
|
614
|
+
tc "<table><tr><td>c1</td>\n<td>c2</td>\n<td>c3</td>\n</tr>\n</table>\n", "||c1||c2||c3"
|
615
615
|
# Empty cells
|
616
|
-
tc "<table><tr><td>c1</td
|
616
|
+
tc "<table><tr><td>c1</td>\n<td></td>\n<td>c2</td>\n</tr>\n</table>\n", "||c1|| ||c2"
|
617
617
|
# Escaping cell separator
|
618
|
-
tc "<table><tr><td>c1|c2</td
|
618
|
+
tc "<table><tr><td>c1|c2</td>\n<td>c3</td>\n</tr>\n</table>\n", "||c1!|c2||c3"
|
619
619
|
# Escape in last cell + empty cell
|
620
|
-
tc "<table><tr><td>c1</td
|
621
|
-
tc "<table><tr><td>c1</td
|
622
|
-
tc "<table><tr><td>c1</td
|
620
|
+
tc "<table><tr><td>c1</td>\n<td>c2|</td>\n</tr>\n</table>\n", "||c1||c2!|"
|
621
|
+
tc "<table><tr><td>c1</td>\n<td>c2|</td>\n</tr>\n</table>\n", "||c1||c2!|"
|
622
|
+
tc "<table><tr><td>c1</td>\n<td>c2|</td>\n<td></td>\n</tr>\n</table>\n", "||c1||c2| || ||"
|
623
623
|
# Equal sign after pipe make a header
|
624
|
-
tc "<table><tr><th>Header</th></tr
|
624
|
+
tc "<table><tr><th>Header</th></tr>\n</table>\n", "||=Header=||"
|
625
625
|
|
626
|
-
tc "<table><tr><td>c1</td
|
627
|
-
tc "<table><tr><td>c1</td
|
626
|
+
tc "<table><tr><td>c1</td>\n<td><a href=\"Link\">Link text</a></td>\n<td><img src=\"Image\"/></td>\n</tr>\n</table>\n", "||c1||[[Link|Link text]]||[[Image(Image)]]||"
|
627
|
+
tc "<table><tr><td>c1</td>\n<td><a href=\"Link\">Link text</a></td>\n<td><img src=\"Image\"/></td>\n</tr>\n</table>\n", "||c1||[Link|Link text]||[[Image(Image)]]||"
|
628
628
|
end
|
629
629
|
|
630
630
|
it 'should parse following table' do
|
631
631
|
# table followed by heading
|
632
|
-
tc("<table><tr><td>table</td
|
633
|
-
tc("<table><tr><td>table</td
|
632
|
+
tc("<table><tr><td>table</td>\n</tr>\n</table>\n<h1>heading</h1>", "||table||\n=heading=\n")
|
633
|
+
tc("<table><tr><td>table</td>\n</tr>\n</table>\n<h1>heading</h1>", "||table||\n\n=heading=\n")
|
634
634
|
# table followed by paragraph
|
635
|
-
tc("<table><tr><td>table</td
|
636
|
-
tc("<table><tr><td>table</td
|
635
|
+
tc("<table><tr><td>table</td>\n</tr>\n</table>\n<p>par</p>\n", "||table||\npar\n")
|
636
|
+
tc("<table><tr><td>table</td>\n</tr>\n</table>\n<p>par</p>\n", "||table||\n\npar\n")
|
637
637
|
# table followed by unordered list
|
638
|
-
tc("<table><tr><td>table</td
|
639
|
-
tc("<table><tr><td>table</td
|
638
|
+
tc("<table><tr><td>table</td>\n</tr>\n</table>\n<ul><li>item</li>\n</ul>\n", "||table||\n* item\n")
|
639
|
+
tc("<table><tr><td>table</td>\n</tr>\n</table>\n<ul><li>item</li>\n</ul>\n", "||table||\n\n* item\n")
|
640
640
|
# table followed by ordered list
|
641
|
-
tc("<table><tr><td>table</td
|
642
|
-
tc("<table><tr><td>table</td
|
641
|
+
tc("<table><tr><td>table</td>\n</tr>\n</table>\n<ol><li>item</li>\n</ol>\n", "||table||\n1. item\n")
|
642
|
+
tc("<table><tr><td>table</td>\n</tr>\n</table>\n<ol><li>item</li>\n</ol>\n", "||table||\n\n1. item\n")
|
643
643
|
# table followed by horizontal rule
|
644
|
-
tc("<table><tr><td>table</td
|
645
|
-
tc("<table><tr><td>table</td
|
644
|
+
tc("<table><tr><td>table</td>\n</tr>\n</table>\n<hr/>", "||table||\n----\n")
|
645
|
+
tc("<table><tr><td>table</td>\n</tr>\n</table>\n<hr/>", "||table||\n\n----\n")
|
646
646
|
# table followed by nowiki block
|
647
|
-
tc("<table><tr><td>table</td
|
648
|
-
tc("<table><tr><td>table</td
|
647
|
+
tc("<table><tr><td>table</td>\n</tr>\n</table>\n<pre>pre</pre>", "||table||\n{{{\npre\n}}}\n")
|
648
|
+
tc("<table><tr><td>table</td>\n</tr>\n</table>\n<pre>pre</pre>", "||table||\n\n{{{\npre\n}}}\n")
|
649
649
|
# table followed by table
|
650
|
-
tc("<table><tr><td>table</td
|
651
|
-
tc("<table><tr><td>table</td
|
650
|
+
tc("<table><tr><td>table</td>\n</tr>\n<tr><td>table</td>\n</tr>\n</table>\n", "||table||\n||table||\n")
|
651
|
+
tc("<table><tr><td>table</td>\n</tr>\n</table>\n<table><tr><td>table</td>\n</tr>\n</table>\n", "||table||\n\n||table||\n")
|
652
652
|
end
|
653
653
|
|
654
654
|
it 'should parse following heading' do
|
@@ -659,11 +659,11 @@ describe TracWiki::Parser do
|
|
659
659
|
tc("<h1>heading</h1><p>par</p>\n", "=heading=\npar\n")
|
660
660
|
tc("<h1>heading</h1><p>par</p>\n", "=heading=\n\npar\n")
|
661
661
|
# unordered list
|
662
|
-
tc("<h1>heading</h1><ul><li>item</li
|
663
|
-
tc("<h1>heading</h1><ul><li>item</li
|
662
|
+
tc("<h1>heading</h1><ul><li>item</li>\n</ul>\n", "=heading=\n* item\n")
|
663
|
+
tc("<h1>heading</h1><ul><li>item</li>\n</ul>\n", "=heading=\n\n* item\n")
|
664
664
|
# ordered list
|
665
|
-
tc("<h1>heading</h1><ol><li>item</li
|
666
|
-
tc("<h1>heading</h1><ol><li>item</li
|
665
|
+
tc("<h1>heading</h1><ol><li>item</li>\n</ol>\n", "=heading=\n1. item\n")
|
666
|
+
tc("<h1>heading</h1><ol><li>item</li>\n</ol>\n", "=heading=\n\n1. item\n")
|
667
667
|
# horizontal rule
|
668
668
|
tc("<h1>heading</h1><hr/>", "=heading=\n----\n")
|
669
669
|
tc("<h1>heading</h1><hr/>", "=heading=\n\n----\n")
|
@@ -671,8 +671,8 @@ describe TracWiki::Parser do
|
|
671
671
|
tc("<h1>heading</h1><pre>nowiki</pre>", "=heading=\n{{{\nnowiki\n}}}\n")
|
672
672
|
tc("<h1>heading</h1><pre>nowiki</pre>", "=heading=\n\n{{{\nnowiki\n}}}\n")
|
673
673
|
# table
|
674
|
-
tc("<h1>heading</h1><table><tr><td>table</td
|
675
|
-
tc("<h1>heading</h1><table><tr><td>table</td
|
674
|
+
tc("<h1>heading</h1><table><tr><td>table</td>\n</tr>\n</table>\n", "=heading=\n||table||\n")
|
675
|
+
tc("<h1>heading</h1><table><tr><td>table</td>\n</tr>\n</table>\n", "=heading=\n\n||table||\n")
|
676
676
|
end
|
677
677
|
|
678
678
|
it 'should parse following paragraph' do
|
@@ -683,11 +683,11 @@ describe TracWiki::Parser do
|
|
683
683
|
tc("<p>par par</p>\n", "par\npar\n")
|
684
684
|
tc("<p>par</p>\n<p>par</p>\n", "par\n\npar\n")
|
685
685
|
# unordered
|
686
|
-
tc("<p>par</p>\n<ul><li>item</li
|
687
|
-
tc("<p>par</p>\n<ul><li>item</li
|
686
|
+
tc("<p>par</p>\n<ul><li>item</li>\n</ul>\n", "par\n* item")
|
687
|
+
tc("<p>par</p>\n<ul><li>item</li>\n</ul>\n", "par\n\n* item")
|
688
688
|
# ordered
|
689
|
-
tc("<p>par</p>\n<ol><li>item</li
|
690
|
-
tc("<p>par</p>\n<ol><li>item</li
|
689
|
+
tc("<p>par</p>\n<ol><li>item</li>\n</ol>\n", "par\n1. item\n")
|
690
|
+
tc("<p>par</p>\n<ol><li>item</li>\n</ol>\n", "par\n\n1. item\n")
|
691
691
|
# horizontal
|
692
692
|
tc("<p>par</p>\n<hr/>", "par\n----\n")
|
693
693
|
tc("<p>par</p>\n<hr/>", "par\n\n----\n")
|
@@ -695,56 +695,56 @@ describe TracWiki::Parser do
|
|
695
695
|
tc("<p>par</p>\n<pre>nowiki</pre>", "par\n{{{\nnowiki\n}}}\n")
|
696
696
|
tc("<p>par</p>\n<pre>nowiki</pre>", "par\n\n{{{\nnowiki\n}}}\n")
|
697
697
|
# table
|
698
|
-
tc("<p>par</p>\n<table><tr><td>table</td
|
699
|
-
tc("<p>par</p>\n<table><tr><td>table</td
|
698
|
+
tc("<p>par</p>\n<table><tr><td>table</td>\n</tr>\n</table>\n", "par\n||table||\n")
|
699
|
+
tc("<p>par</p>\n<table><tr><td>table</td>\n</tr>\n</table>\n", "par\n\n||table||\n")
|
700
700
|
end
|
701
701
|
|
702
702
|
it 'should parse following unordered list' do
|
703
703
|
# heading
|
704
|
-
tc("<ul><li>item</li
|
705
|
-
tc("<ul><li>item</li
|
704
|
+
tc("<ul><li>item</li>\n</ul>\n<h1>heading</h1>", "* item\n=heading=")
|
705
|
+
tc("<ul><li>item</li>\n</ul>\n<h1>heading</h1>", "* item\n\n=heading=")
|
706
706
|
# paragraph
|
707
|
-
tc("<ul><li>item par</li
|
708
|
-
tc("<ul><li>item</li
|
707
|
+
tc("<ul><li>item par</li>\n</ul>\n", "* item\npar\n") # items may span multiple lines
|
708
|
+
tc("<ul><li>item</li>\n</ul>\n<p>par</p>\n", "* item\n\npar\n")
|
709
709
|
# unordered
|
710
|
-
tc("<ul><li>item</li
|
711
|
-
tc("<ul><li>item</li
|
710
|
+
tc("<ul><li>item</li>\n<li>item</li>\n</ul>\n", "* item\n* item\n")
|
711
|
+
tc("<ul><li>item</li>\n</ul>\n<ul><li>item</li>\n</ul>\n", "* item\n\n* item\n")
|
712
712
|
# ordered
|
713
|
-
tc("<ul><li>item</li
|
714
|
-
tc("<ul><li>item</li
|
713
|
+
tc("<ul><li>item</li>\n</ul>\n<ol><li>item</li>\n</ol>\n", "* item\n1. item\n")
|
714
|
+
tc("<ul><li>item</li>\n</ul>\n<ol><li>item</li>\n</ol>\n", "* item\n\n1. item\n")
|
715
715
|
# horizontal rule
|
716
|
-
tc("<ul><li>item</li
|
717
|
-
tc("<ul><li>item</li
|
716
|
+
tc("<ul><li>item</li>\n</ul>\n<hr/>", "* item\n----\n")
|
717
|
+
tc("<ul><li>item</li>\n</ul>\n<hr/>", "* item\n\n----\n")
|
718
718
|
# nowiki
|
719
|
-
tc("<ul><li>item</li
|
720
|
-
tc("<ul><li>item</li
|
719
|
+
tc("<ul><li>item</li>\n</ul>\n<pre>nowiki</pre>", "* item\n{{{\nnowiki\n}}}\n")
|
720
|
+
tc("<ul><li>item</li>\n</ul>\n<pre>nowiki</pre>", "* item\n\n{{{\nnowiki\n}}}\n")
|
721
721
|
# table
|
722
|
-
tc("<ul><li>item</li
|
723
|
-
tc("<ul><li>item</li
|
722
|
+
tc("<ul><li>item</li>\n</ul>\n<table><tr><td>table</td>\n</tr>\n</table>\n", "* item\n||table||\n")
|
723
|
+
tc("<ul><li>item</li>\n</ul>\n<table><tr><td>table</td>\n</tr>\n</table>\n", "* item\n\n||table||\n")
|
724
724
|
end
|
725
725
|
|
726
726
|
it 'should parse following ordered list' do
|
727
727
|
# heading
|
728
|
-
tc("<ol><li>item</li
|
729
|
-
tc("<ol><li>item</li
|
728
|
+
tc("<ol><li>item</li>\n</ol>\n<h1>heading</h1>", "1. item\n=heading=")
|
729
|
+
tc("<ol><li>item</li>\n</ol>\n<h1>heading</h1>", "1. item\n\n=heading=")
|
730
730
|
# paragraph
|
731
|
-
tc("<ol><li>item par</li
|
732
|
-
tc("<ol><li>item</li
|
731
|
+
tc("<ol><li>item par</li>\n</ol>\n", "1. item\npar\n") # items may span multiple lines
|
732
|
+
tc("<ol><li>item</li>\n</ol>\n<p>par</p>\n", "1. item\n\npar\n")
|
733
733
|
# unordered
|
734
|
-
tc("<ol><li>item</li
|
735
|
-
tc("<ol><li>item</li
|
734
|
+
tc("<ol><li>item</li>\n</ol>\n<ul><li>item</li>\n</ul>\n", "1. item\n* item\n")
|
735
|
+
tc("<ol><li>item</li>\n</ol>\n<ul><li>item</li>\n</ul>\n", "1. item\n\n* item\n")
|
736
736
|
# ordered
|
737
|
-
tc("<ol><li>item</li
|
738
|
-
tc("<ol><li>item</li
|
737
|
+
tc("<ol><li>item</li>\n<li>item</li>\n</ol>\n", "1. item\n2. item\n")
|
738
|
+
tc("<ol><li>item</li>\n</ol>\n<ol><li>item</li>\n</ol>\n", "1. item\n\n1. item\n")
|
739
739
|
# horizontal role
|
740
|
-
tc("<ol><li>item</li
|
741
|
-
tc("<ol><li>item</li
|
740
|
+
tc("<ol><li>item</li>\n</ol>\n<hr/>", "1. item\n----\n")
|
741
|
+
tc("<ol><li>item</li>\n</ol>\n<hr/>", "1. item\n\n----\n")
|
742
742
|
# nowiki
|
743
|
-
tc("<ol><li>item</li
|
744
|
-
tc("<ol><li>item</li
|
743
|
+
tc("<ol><li>item</li>\n</ol>\n<pre>nowiki</pre>", "1. item\n{{{\nnowiki\n}}}\n")
|
744
|
+
tc("<ol><li>item</li>\n</ol>\n<pre>nowiki</pre>", "1. item\n\n{{{\nnowiki\n}}}\n")
|
745
745
|
# table
|
746
|
-
tc("<ol><li>item</li
|
747
|
-
tc("<ol><li>item</li
|
746
|
+
tc("<ol><li>item</li>\n</ol>\n<table><tr><td>table</td>\n</tr>\n</table>\n", "1. item\n||table||\n")
|
747
|
+
tc("<ol><li>item</li>\n</ol>\n<table><tr><td>table</td>\n</tr>\n</table>\n", "1. item\n\n||table||\n")
|
748
748
|
end
|
749
749
|
|
750
750
|
it 'should parse following horizontal rule' do
|
@@ -755,14 +755,14 @@ describe TracWiki::Parser do
|
|
755
755
|
tc("<hr/><p>par</p>\n", "----\npar\n")
|
756
756
|
tc("<hr/><p>par</p>\n", "----\n\npar\n")
|
757
757
|
# unordered
|
758
|
-
tc("<hr/><ul><li>item</li
|
759
|
-
tc("<hr/><ul><li>item</li
|
760
|
-
tc("<hr/><ul><li>item</li
|
761
|
-
tc("<hr/><ul><li>item</li
|
762
|
-
tc("<hr/><ul><li>item</li
|
758
|
+
tc("<hr/><ul><li>item</li>\n</ul>\n", "----\n* item")
|
759
|
+
tc("<hr/><ul><li>item</li>\n</ul>\n", "----\n* item")
|
760
|
+
tc("<hr/><ul><li>item</li>\n</ul>\n", "----\n- item")
|
761
|
+
tc("<hr/><ul><li>item</li>\n</ul>\n", "----\n- item")
|
762
|
+
tc("<hr/><ul><li>item</li>\n</ul>\n", "----\n - item")
|
763
763
|
# ordered
|
764
|
-
tc("<hr/><ol><li>item</li
|
765
|
-
tc("<hr/><ol><li>item</li
|
764
|
+
tc("<hr/><ol><li>item</li>\n</ol>\n", "----\n1. item")
|
765
|
+
tc("<hr/><ol><li>item</li>\n</ol>\n", "----\n1. item")
|
766
766
|
# horizontal
|
767
767
|
tc("<hr/><hr/>", "----\n----\n")
|
768
768
|
tc("<hr/><hr/>", "----\n\n----\n")
|
@@ -770,8 +770,8 @@ describe TracWiki::Parser do
|
|
770
770
|
tc("<hr/><pre>nowiki</pre>", "----\n{{{\nnowiki\n}}}\n")
|
771
771
|
tc("<hr/><pre>nowiki</pre>", "----\n\n{{{\nnowiki\n}}}\n")
|
772
772
|
# table
|
773
|
-
tc("<hr/><table><tr><td>table</td
|
774
|
-
tc("<hr/><table><tr><td>table</td
|
773
|
+
tc("<hr/><table><tr><td>table</td>\n</tr>\n</table>\n", "----\n||table||\n")
|
774
|
+
tc("<hr/><table><tr><td>table</td>\n</tr>\n</table>\n", "----\n\n||table||\n")
|
775
775
|
end
|
776
776
|
|
777
777
|
it 'should parse following nowiki block' do
|
@@ -782,11 +782,11 @@ describe TracWiki::Parser do
|
|
782
782
|
tc("<pre>nowiki</pre><p>par</p>\n", "{{{\nnowiki\n}}}\npar")
|
783
783
|
tc("<pre>nowiki</pre><p>par</p>\n", "{{{\nnowiki\n}}}\n\npar")
|
784
784
|
# unordered
|
785
|
-
tc("<pre>nowiki</pre><ul><li>item</li
|
786
|
-
tc("<pre>nowiki</pre><ul><li>item</li
|
785
|
+
tc("<pre>nowiki</pre><ul><li>item</li>\n</ul>\n", "{{{\nnowiki\n}}}\n* item\n")
|
786
|
+
tc("<pre>nowiki</pre><ul><li>item</li>\n</ul>\n", "{{{\nnowiki\n}}}\n\n* item\n")
|
787
787
|
# ordered
|
788
|
-
tc("<pre>nowiki</pre><ol><li>item</li
|
789
|
-
tc("<pre>nowiki</pre><ol><li>item</li
|
788
|
+
tc("<pre>nowiki</pre><ol><li>item</li>\n</ol>\n", "{{{\nnowiki\n}}}\n1. item\n")
|
789
|
+
tc("<pre>nowiki</pre><ol><li>item</li>\n</ol>\n", "{{{\nnowiki\n}}}\n\n1. item\n")
|
790
790
|
# horizontal
|
791
791
|
tc("<pre>nowiki</pre><hr/>", "{{{\nnowiki\n}}}\n----\n")
|
792
792
|
tc("<pre>nowiki</pre><hr/>", "{{{\nnowiki\n}}}\n\n----\n")
|
@@ -794,8 +794,8 @@ describe TracWiki::Parser do
|
|
794
794
|
tc("<pre>nowiki</pre><pre>nowiki</pre>", "{{{\nnowiki\n}}}\n{{{\nnowiki\n}}}\n")
|
795
795
|
tc("<pre>nowiki</pre><pre>nowiki</pre>", "{{{\nnowiki\n}}}\n\n{{{\nnowiki\n}}}\n")
|
796
796
|
# table
|
797
|
-
tc("<pre>nowiki</pre><table><tr><td>table</td
|
798
|
-
tc("<pre>nowiki</pre><table><tr><td>table</td
|
797
|
+
tc("<pre>nowiki</pre><table><tr><td>table</td>\n</tr>\n</table>\n", "{{{\nnowiki\n}}}\n||table||\n")
|
798
|
+
tc("<pre>nowiki</pre><table><tr><td>table</td>\n</tr>\n</table>\n", "{{{\nnowiki\n}}}\n\n||table||\n")
|
799
799
|
end
|
800
800
|
|
801
801
|
it 'should parse image' do
|
@@ -819,7 +819,7 @@ describe TracWiki::Parser do
|
|
819
819
|
end
|
820
820
|
|
821
821
|
it 'should parse bold combo' do
|
822
|
-
tc("<p><strong>bold and</strong></p>\n<table><tr><td>table</td
|
822
|
+
tc("<p><strong>bold and</strong></p>\n<table><tr><td>table</td>\n</tr>\n</table>\n<p>end</p>\n",
|
823
823
|
"**bold and\n||table||\nend**")
|
824
824
|
end
|
825
825
|
|
@@ -897,6 +897,7 @@ kuk
|
|
897
897
|
eos
|
898
898
|
|
899
899
|
|
900
|
+
end
|
900
901
|
it 'should support macro' do
|
901
902
|
tc "<p>ahoj</p>\n" , "{{#echo \nahoj\n}}"
|
902
903
|
tc "<h2>H2</h2>" , "{{#echo == H2 ==}}"
|
@@ -999,7 +1000,13 @@ eos
|
|
999
1000
|
tc "<p><b class=\"bclass\">BOLD</b></p>\n", "<b bad=\"bad\" class=\"bclass\">BOLD</b>\n", raw_html: true
|
1000
1001
|
tc "<p><b class=\"bclass\">BOLD</b></p>\n", "<b bad=\"bad\" class=\"bclass\">BOLD</b>\n", raw_html: true
|
1001
1002
|
end
|
1002
|
-
|
1003
|
+
it 'should parse link' do
|
1004
|
+
tc "<p><a href=\"#here\">Here</a></p>\n", "[[#here|Here]]"
|
1005
|
+
tc "<p><a href=\"#here+i+m\">Here</a></p>\n", "[[#here i m|Here]]"
|
1006
|
+
tc "<p><a href=\"there#i+m\">There</a></p>\n", "[[there#i m|There]]"
|
1007
|
+
tc "<p><a href=\"http://example.com/there#i+m\">There</a></p>\n", "[[there#i m|There]]", base: 'http://example.com/'
|
1008
|
+
tc "<p><a href=\"#here+i+m\">Here</a></p>\n", "[[#here i m|Here]]", base: 'http://example.com/'
|
1003
1009
|
end
|
1010
|
+
|
1004
1011
|
end
|
1005
1012
|
# vim: tw=0
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trac-wiki
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.23
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-01
|
12
|
+
date: 2014-02-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bacon
|