asciidoctor 1.5.7.1 → 1.5.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +95 -5
- data/Gemfile +23 -13
- data/README-de.adoc +482 -0
- data/README-fr.adoc +128 -119
- data/README-jp.adoc +2 -3
- data/README-zh_CN.adoc +2 -3
- data/README.adoc +131 -106
- data/asciidoctor.gemspec +9 -7
- data/data/locale/attributes-ar.adoc +1 -1
- data/data/locale/attributes-bg.adoc +1 -1
- data/data/locale/attributes-ca.adoc +1 -1
- data/data/locale/attributes-cs.adoc +1 -1
- data/data/locale/attributes-da.adoc +1 -1
- data/data/locale/attributes-de.adoc +1 -1
- data/data/locale/attributes-en.adoc +1 -1
- data/data/locale/attributes-es.adoc +1 -1
- data/data/locale/attributes-fa.adoc +1 -1
- data/data/locale/attributes-fi.adoc +1 -1
- data/data/locale/attributes-fr.adoc +1 -1
- data/data/locale/attributes-hu.adoc +1 -1
- data/data/locale/attributes-id.adoc +1 -1
- data/data/locale/attributes-it.adoc +1 -1
- data/data/locale/attributes-ja.adoc +1 -1
- data/data/locale/attributes-kr.adoc +1 -1
- data/data/locale/attributes-nb.adoc +1 -1
- data/data/locale/attributes-nl.adoc +1 -1
- data/data/locale/attributes-nn.adoc +1 -1
- data/data/locale/attributes-pl.adoc +1 -1
- data/data/locale/attributes-pt.adoc +1 -1
- data/data/locale/attributes-pt_BR.adoc +1 -1
- data/data/locale/attributes-ro.adoc +1 -1
- data/data/locale/attributes-ru.adoc +1 -1
- data/data/locale/attributes-sr.adoc +5 -4
- data/data/locale/attributes-sr_Latn.adoc +5 -4
- data/data/locale/attributes-sv.adoc +23 -0
- data/data/locale/attributes-tr.adoc +1 -1
- data/data/locale/attributes-uk.adoc +1 -1
- data/data/locale/attributes-zh_CN.adoc +1 -1
- data/data/locale/attributes-zh_TW.adoc +1 -1
- data/data/stylesheets/asciidoctor-default.css +23 -23
- data/lib/asciidoctor.rb +110 -104
- data/lib/asciidoctor/abstract_block.rb +55 -32
- data/lib/asciidoctor/abstract_node.rb +32 -17
- data/lib/asciidoctor/attribute_list.rb +8 -7
- data/lib/asciidoctor/block.rb +5 -7
- data/lib/asciidoctor/cli/options.rb +5 -9
- data/lib/asciidoctor/converter.rb +2 -2
- data/lib/asciidoctor/converter/docbook45.rb +7 -20
- data/lib/asciidoctor/converter/docbook5.rb +36 -37
- data/lib/asciidoctor/converter/factory.rb +10 -8
- data/lib/asciidoctor/converter/html5.rb +90 -65
- data/lib/asciidoctor/converter/manpage.rb +72 -62
- data/lib/asciidoctor/converter/template.rb +8 -6
- data/lib/asciidoctor/core_ext/1.8.7/concurrent/hash.rb +5 -0
- data/lib/asciidoctor/document.rb +62 -10
- data/lib/asciidoctor/extensions.rb +74 -16
- data/lib/asciidoctor/helpers.rb +11 -14
- data/lib/asciidoctor/list.rb +2 -2
- data/lib/asciidoctor/parser.rb +223 -195
- data/lib/asciidoctor/path_resolver.rb +15 -7
- data/lib/asciidoctor/reader.rb +65 -36
- data/lib/asciidoctor/section.rb +6 -4
- data/lib/asciidoctor/substitutors.rb +170 -149
- data/lib/asciidoctor/table.rb +16 -8
- data/lib/asciidoctor/version.rb +1 -1
- data/man/asciidoctor.1 +6 -5
- data/man/asciidoctor.adoc +3 -2
- data/test/api_test.rb +236 -0
- data/test/attribute_list_test.rb +242 -0
- data/test/attributes_test.rb +65 -52
- data/test/blocks_test.rb +408 -260
- data/test/converter_test.rb +7 -7
- data/test/document_test.rb +60 -54
- data/test/extensions_test.rb +218 -32
- data/test/fixtures/doctime-localtime.adoc +2 -0
- data/test/fixtures/section-a.adoc +4 -0
- data/test/fixtures/subs.adoc +0 -1
- data/test/invoker_test.rb +56 -18
- data/test/links_test.rb +105 -81
- data/test/lists_test.rb +636 -265
- data/test/logger_test.rb +1 -1
- data/test/manpage_test.rb +140 -3
- data/test/paragraphs_test.rb +42 -42
- data/test/parser_test.rb +63 -183
- data/test/paths_test.rb +21 -4
- data/test/preamble_test.rb +9 -9
- data/test/reader_test.rb +78 -28
- data/test/sections_test.rb +273 -151
- data/test/substitutions_test.rb +53 -19
- data/test/tables_test.rb +286 -163
- data/test/test_helper.rb +4 -3
- data/test/text_test.rb +65 -65
- metadata +16 -21
data/test/lists_test.rb
CHANGED
@@ -15,7 +15,7 @@ List
|
|
15
15
|
- Boo
|
16
16
|
- Blech
|
17
17
|
EOS
|
18
|
-
output =
|
18
|
+
output = convert_string input
|
19
19
|
assert_xpath '//ul', output, 1
|
20
20
|
assert_xpath '//ul/li', output, 3
|
21
21
|
end
|
@@ -26,7 +26,7 @@ List
|
|
26
26
|
- Boo
|
27
27
|
- Blech
|
28
28
|
EOS
|
29
|
-
output =
|
29
|
+
output = convert_string input
|
30
30
|
assert_xpath '//ul', output, 1
|
31
31
|
assert_xpath '//ul/li', output, 3
|
32
32
|
end
|
@@ -37,7 +37,7 @@ List
|
|
37
37
|
\t-\tBoo
|
38
38
|
\t-\tBlech
|
39
39
|
EOS
|
40
|
-
output =
|
40
|
+
output = convert_string input
|
41
41
|
assert_xpath '//ul', output, 1
|
42
42
|
assert_xpath '//ul/li', output, 3
|
43
43
|
end
|
@@ -54,7 +54,7 @@ List
|
|
54
54
|
|
55
55
|
- Blech
|
56
56
|
EOS
|
57
|
-
output =
|
57
|
+
output = convert_string input
|
58
58
|
assert_xpath '//ul', output, 1
|
59
59
|
assert_xpath '//ul/li', output, 3
|
60
60
|
end
|
@@ -72,7 +72,7 @@ more text
|
|
72
72
|
// another line comment
|
73
73
|
- Blech
|
74
74
|
EOS
|
75
|
-
output =
|
75
|
+
output = convert_string_to_embedded input
|
76
76
|
assert_xpath '//ul', output, 1
|
77
77
|
assert_xpath '//ul/li', output, 3
|
78
78
|
assert_xpath %((//ul/li)[2]/p[text()="Boo\nmore text"]), output, 1
|
@@ -90,7 +90,7 @@ List
|
|
90
90
|
|
91
91
|
- Blech
|
92
92
|
EOS
|
93
|
-
output =
|
93
|
+
output = convert_string input
|
94
94
|
assert_xpath '//ul', output, 2
|
95
95
|
assert_xpath '(//ul)[1]/li', output, 2
|
96
96
|
assert_xpath '(//ul)[2]/li', output, 1
|
@@ -107,7 +107,7 @@ List
|
|
107
107
|
.Also
|
108
108
|
- Blech
|
109
109
|
EOS
|
110
|
-
output =
|
110
|
+
output = convert_string input
|
111
111
|
assert_xpath '//ul', output, 2
|
112
112
|
assert_xpath '(//ul)[1]/li', output, 2
|
113
113
|
assert_xpath '(//ul)[2]/li', output, 1
|
@@ -124,7 +124,7 @@ List
|
|
124
124
|
:foo: bar
|
125
125
|
- Blech
|
126
126
|
EOS
|
127
|
-
output =
|
127
|
+
output = convert_string_to_embedded input
|
128
128
|
assert_xpath '//ul', output, 2
|
129
129
|
assert_xpath '(//ul)[1]/li', output, 2
|
130
130
|
assert_xpath '(//ul)[2]/li', output, 1
|
@@ -140,7 +140,7 @@ wrapped content
|
|
140
140
|
- Boo
|
141
141
|
- Blech
|
142
142
|
EOS
|
143
|
-
output =
|
143
|
+
output = convert_string input
|
144
144
|
assert_xpath '//ul', output, 1
|
145
145
|
assert_xpath '//ul/li[1]/*', output, 1
|
146
146
|
assert_xpath "//ul/li[1]/p[text() = 'Foo\nwrapped content']", output, 1
|
@@ -155,7 +155,7 @@ wrapped content
|
|
155
155
|
- Boo
|
156
156
|
- Blech
|
157
157
|
EOS
|
158
|
-
output =
|
158
|
+
output = convert_string_to_embedded input
|
159
159
|
assert_xpath '//ul', output, 1
|
160
160
|
assert_xpath '//ul/li[1]/*', output, 1
|
161
161
|
assert_xpath "//ul/li[1]/p[text() = 'Foo\n.wrapped content']", output, 1
|
@@ -170,7 +170,7 @@ wrapped content
|
|
170
170
|
- Boo
|
171
171
|
- Blech
|
172
172
|
EOS
|
173
|
-
output =
|
173
|
+
output = convert_string_to_embedded input
|
174
174
|
assert_xpath '//ul', output, 1
|
175
175
|
assert_xpath '//ul/li[1]/*', output, 1
|
176
176
|
assert_xpath "//ul/li[1]/p[text() = 'Foo\n:foo: bar']", output, 1
|
@@ -183,7 +183,7 @@ Bar
|
|
183
183
|
* Foo
|
184
184
|
EOS
|
185
185
|
|
186
|
-
output =
|
186
|
+
output = convert_string_to_embedded input
|
187
187
|
assert_css 'ul ul', output, 1
|
188
188
|
refute_includes output, '* Foo'
|
189
189
|
end
|
@@ -203,7 +203,7 @@ text
|
|
203
203
|
term:: def
|
204
204
|
EOS
|
205
205
|
|
206
|
-
output =
|
206
|
+
output = convert_string_to_embedded input
|
207
207
|
assert_css 'ul ol', output, 1
|
208
208
|
refute_includes output, '* Foo'
|
209
209
|
assert_css 'ul dl', output, 1
|
@@ -220,7 +220,7 @@ List
|
|
220
220
|
- Boo
|
221
221
|
- Blech
|
222
222
|
EOS
|
223
|
-
output =
|
223
|
+
output = convert_string input
|
224
224
|
assert_xpath '//ul', output, 1
|
225
225
|
assert_xpath '//ul/li[1]/*', output, 1
|
226
226
|
assert_xpath "//ul/li[1]/p[text() = 'Foo\nwrapped content']", output, 1
|
@@ -235,7 +235,7 @@ List
|
|
235
235
|
second wrapped line
|
236
236
|
- list item 2
|
237
237
|
EOS
|
238
|
-
output =
|
238
|
+
output = convert_string_to_embedded input
|
239
239
|
assert_css 'ul', output, 1
|
240
240
|
assert_css 'ul li', output, 2
|
241
241
|
# NOTE for some reason, we're getting an extra line after the indented line
|
@@ -253,7 +253,7 @@ second wrapped line
|
|
253
253
|
* Foo
|
254
254
|
EOS
|
255
255
|
|
256
|
-
output =
|
256
|
+
output = convert_string_to_embedded input
|
257
257
|
assert_css 'ul ul', output, 1
|
258
258
|
refute_includes output, '* Foo'
|
259
259
|
end
|
@@ -264,7 +264,7 @@ second wrapped line
|
|
264
264
|
*. normal text
|
265
265
|
EOS
|
266
266
|
|
267
|
-
output =
|
267
|
+
output = convert_string_to_embedded input
|
268
268
|
assert_css 'ul', output, 1
|
269
269
|
assert_css 'ul li', output, 1
|
270
270
|
assert_xpath "//ul/li/p[text()='first item\n*. normal text']", output, 1
|
@@ -285,7 +285,7 @@ second wrapped line
|
|
285
285
|
term:: def
|
286
286
|
EOS
|
287
287
|
|
288
|
-
output =
|
288
|
+
output = convert_string_to_embedded input
|
289
289
|
assert_css 'ul ol', output, 1
|
290
290
|
refute_includes output, '* Foo'
|
291
291
|
assert_css 'ul dl', output, 1
|
@@ -304,7 +304,7 @@ List
|
|
304
304
|
- Boo
|
305
305
|
- Blech
|
306
306
|
EOS
|
307
|
-
output =
|
307
|
+
output = convert_string input
|
308
308
|
assert_xpath '//ul', output, 1
|
309
309
|
assert_xpath '//ul/li', output, 3
|
310
310
|
assert_xpath '(//ul/li)[1]/p[text() = "Foo"]', output, 1
|
@@ -327,7 +327,7 @@ para
|
|
327
327
|
- Boo
|
328
328
|
- Blech
|
329
329
|
EOS
|
330
|
-
output =
|
330
|
+
output = convert_string input
|
331
331
|
assert_xpath '//ul', output, 1
|
332
332
|
assert_xpath '//ul/li', output, 3
|
333
333
|
assert_xpath '(//ul/li)[1]/p[text() = "Foo"]', output, 1
|
@@ -346,7 +346,7 @@ para
|
|
346
346
|
NOTE: This is a note.
|
347
347
|
EOS
|
348
348
|
|
349
|
-
output =
|
349
|
+
output = convert_string_to_embedded input
|
350
350
|
assert_css 'ul', output, 1
|
351
351
|
assert_css 'ul > li', output, 1
|
352
352
|
assert_css 'ul > li > p', output, 1
|
@@ -370,7 +370,7 @@ NOTE: This is a note.
|
|
370
370
|
'''
|
371
371
|
EOS
|
372
372
|
|
373
|
-
output =
|
373
|
+
output = convert_string_to_embedded input
|
374
374
|
assert_css 'ul ul .admonitionblock.note', output, 0
|
375
375
|
assert_xpath '(//ul)[1]/li/*[@class="admonitionblock note"]', output, 1
|
376
376
|
assert_css 'ul ul hr', output, 0
|
@@ -415,7 +415,7 @@ example
|
|
415
415
|
'''
|
416
416
|
EOS
|
417
417
|
|
418
|
-
output =
|
418
|
+
output = convert_string_to_embedded input
|
419
419
|
assert_css 'ul > li > .paragraph', output, 1
|
420
420
|
assert_css 'ul > li > .exampleblock', output, 1
|
421
421
|
end
|
@@ -429,7 +429,7 @@ paragraph in list item 1
|
|
429
429
|
|
430
430
|
- list item 2
|
431
431
|
EOS
|
432
|
-
output =
|
432
|
+
output = convert_string_to_embedded input
|
433
433
|
assert_css 'ul', output, 1
|
434
434
|
assert_css 'ul li', output, 2
|
435
435
|
assert_xpath '(//ul/li)[1]/p[text()="list item 1"]', output, 1
|
@@ -449,7 +449,7 @@ para
|
|
449
449
|
|
450
450
|
* Bar
|
451
451
|
EOS
|
452
|
-
output =
|
452
|
+
output = convert_string input
|
453
453
|
assert_xpath '//ul', output, 1
|
454
454
|
assert_xpath '//ul/li', output, 2
|
455
455
|
assert_xpath '(//ul/li)[1]/p[text() = "Foo"]', output, 1
|
@@ -475,7 +475,7 @@ List
|
|
475
475
|
- Boo
|
476
476
|
- Blech
|
477
477
|
EOS
|
478
|
-
output =
|
478
|
+
output = convert_string input
|
479
479
|
assert_xpath '//ul', output, 1
|
480
480
|
assert_xpath '//ul/li', output, 3
|
481
481
|
assert_xpath '(//ul/li)[1]/p[text() = "Foo"]', output, 1
|
@@ -496,7 +496,7 @@ List
|
|
496
496
|
- Boo
|
497
497
|
- Blech
|
498
498
|
EOS
|
499
|
-
output =
|
499
|
+
output = convert_string input
|
500
500
|
assert_xpath '//ul', output, 1
|
501
501
|
assert_xpath '//ul/li', output, 1
|
502
502
|
assert_xpath '(//ul/li)[1]/p[text() = "Foo"]', output, 1
|
@@ -514,7 +514,7 @@ List
|
|
514
514
|
* Boo
|
515
515
|
* Blech
|
516
516
|
EOS
|
517
|
-
output =
|
517
|
+
output = convert_string input
|
518
518
|
assert_xpath '//ul', output, 1
|
519
519
|
assert_xpath '//ul/li', output, 3
|
520
520
|
end
|
@@ -525,7 +525,7 @@ List
|
|
525
525
|
* Boo
|
526
526
|
* Blech
|
527
527
|
EOS
|
528
|
-
output =
|
528
|
+
output = convert_string input
|
529
529
|
assert_xpath '//ul', output, 1
|
530
530
|
assert_xpath '//ul/li', output, 3
|
531
531
|
end
|
@@ -536,7 +536,7 @@ List
|
|
536
536
|
• Boo
|
537
537
|
• Blech
|
538
538
|
EOS
|
539
|
-
output =
|
539
|
+
output = convert_string input
|
540
540
|
assert_xpath '//ul', output, 1
|
541
541
|
assert_xpath '//ul/li', output, 3
|
542
542
|
end if ::RUBY_MIN_VERSION_1_9
|
@@ -547,7 +547,7 @@ List
|
|
547
547
|
\t*\tBoo
|
548
548
|
\t*\tBlech
|
549
549
|
EOS
|
550
|
-
output =
|
550
|
+
output = convert_string input
|
551
551
|
assert_xpath '//ul', output, 1
|
552
552
|
assert_xpath '//ul/li', output, 3
|
553
553
|
end
|
@@ -560,7 +560,7 @@ List
|
|
560
560
|
* b
|
561
561
|
* c
|
562
562
|
EOS
|
563
|
-
output =
|
563
|
+
output = convert_string_to_embedded input
|
564
564
|
assert_css ".ulist.#{style}", output, 1
|
565
565
|
assert_css ".ulist.#{style} ul.#{style}", output, 1
|
566
566
|
end
|
@@ -578,7 +578,7 @@ List
|
|
578
578
|
|
579
579
|
* Blech
|
580
580
|
EOS
|
581
|
-
output =
|
581
|
+
output = convert_string input
|
582
582
|
assert_xpath '//ul', output, 1
|
583
583
|
assert_xpath '//ul/li', output, 3
|
584
584
|
end
|
@@ -596,7 +596,7 @@ more text
|
|
596
596
|
// another line comment
|
597
597
|
* Blech
|
598
598
|
EOS
|
599
|
-
output =
|
599
|
+
output = convert_string_to_embedded input
|
600
600
|
assert_xpath '//ul', output, 1
|
601
601
|
assert_xpath '//ul/li', output, 3
|
602
602
|
assert_xpath %((//ul/li)[2]/p[text()="Boo\nmore text"]), output, 1
|
@@ -614,7 +614,7 @@ List
|
|
614
614
|
|
615
615
|
* Blech
|
616
616
|
EOS
|
617
|
-
output =
|
617
|
+
output = convert_string input
|
618
618
|
assert_xpath '//ul', output, 2
|
619
619
|
assert_xpath '(//ul)[1]/li', output, 2
|
620
620
|
assert_xpath '(//ul)[2]/li', output, 1
|
@@ -631,7 +631,7 @@ List
|
|
631
631
|
.Also
|
632
632
|
* Blech
|
633
633
|
EOS
|
634
|
-
output =
|
634
|
+
output = convert_string input
|
635
635
|
assert_xpath '//ul', output, 2
|
636
636
|
assert_xpath '(//ul)[1]/li', output, 2
|
637
637
|
assert_xpath '(//ul)[2]/li', output, 1
|
@@ -648,7 +648,7 @@ List
|
|
648
648
|
:foo: bar
|
649
649
|
* Blech
|
650
650
|
EOS
|
651
|
-
output =
|
651
|
+
output = convert_string_to_embedded input
|
652
652
|
assert_xpath '//ul', output, 2
|
653
653
|
assert_xpath '(//ul)[1]/li', output, 2
|
654
654
|
assert_xpath '(//ul)[2]/li', output, 1
|
@@ -666,7 +666,7 @@ item
|
|
666
666
|
|
667
667
|
== Section
|
668
668
|
EOS
|
669
|
-
output =
|
669
|
+
output = convert_string input
|
670
670
|
assert_xpath '//ul', output, 1
|
671
671
|
assert_xpath '//ul/li', output, 2
|
672
672
|
assert_xpath '//h2[text() = "Section"]', output, 1
|
@@ -685,7 +685,7 @@ item
|
|
685
685
|
[[sec]]
|
686
686
|
== Section
|
687
687
|
EOS
|
688
|
-
output =
|
688
|
+
output = convert_string input
|
689
689
|
assert_xpath '//ul', output, 1
|
690
690
|
assert_xpath '//ul/li', output, 2
|
691
691
|
assert_xpath '//h2[@id = "sec"][text() = "Section"]', output, 1
|
@@ -698,13 +698,37 @@ item
|
|
698
698
|
== Not a section
|
699
699
|
EOS
|
700
700
|
|
701
|
-
output =
|
701
|
+
output = convert_string_to_embedded input
|
702
702
|
assert_css 'ul', output, 1
|
703
703
|
assert_css 'ul > li', output, 2
|
704
704
|
assert_css 'h2', output, 0
|
705
705
|
assert_includes output, '== Not a section'
|
706
706
|
assert_xpath %((//li)[2]/p[text() = "second\n== Not a section"]), output, 1
|
707
707
|
end
|
708
|
+
|
709
|
+
test 'should match trailing line separator in text of list item' do
|
710
|
+
input = <<-EOS.chomp
|
711
|
+
* a
|
712
|
+
* b#{decode_char 8232}
|
713
|
+
* c
|
714
|
+
EOS
|
715
|
+
|
716
|
+
output = convert_string input
|
717
|
+
assert_css 'li', output, 3
|
718
|
+
assert_xpath %((//li)[2]/p[text()="b#{decode_char 8232}"]), output, 1
|
719
|
+
end
|
720
|
+
|
721
|
+
test 'should match line separator in text of list item' do
|
722
|
+
input = <<-EOS.chomp
|
723
|
+
* a
|
724
|
+
* b#{decode_char 8232}b
|
725
|
+
* c
|
726
|
+
EOS
|
727
|
+
|
728
|
+
output = convert_string input
|
729
|
+
assert_css 'li', output, 3
|
730
|
+
assert_xpath %((//li)[2]/p[text()="b#{decode_char 8232}b"]), output, 1
|
731
|
+
end
|
708
732
|
end
|
709
733
|
|
710
734
|
context "Lists with inline markup" do
|
@@ -717,7 +741,7 @@ List
|
|
717
741
|
- I am _stressed_.
|
718
742
|
- I am `flexible`.
|
719
743
|
EOS
|
720
|
-
output =
|
744
|
+
output = convert_string input
|
721
745
|
assert_xpath '//ul', output, 1
|
722
746
|
assert_xpath '//ul/li', output, 3
|
723
747
|
assert_xpath '(//ul/li)[1]//strong', output, 1
|
@@ -734,7 +758,7 @@ List
|
|
734
758
|
- side a {vbar} side b
|
735
759
|
- Take me to a {foo}.
|
736
760
|
EOS
|
737
|
-
output =
|
761
|
+
output = convert_string input
|
738
762
|
assert_xpath '//ul', output, 1
|
739
763
|
assert_xpath '//ul/li', output, 2
|
740
764
|
assert_xpath '(//ul/li)[1]//p[text() = "side a | side b"]', output, 1
|
@@ -747,7 +771,7 @@ List
|
|
747
771
|
* .second
|
748
772
|
* .third
|
749
773
|
EOS
|
750
|
-
output =
|
774
|
+
output = convert_string input
|
751
775
|
assert_xpath '//ul', output, 1
|
752
776
|
assert_xpath '//ul/li', output, 3
|
753
777
|
%w(.first .second .third).each_with_index do |text, index|
|
@@ -761,12 +785,12 @@ A. This is the story about
|
|
761
785
|
AsciiDoc. It begins here.
|
762
786
|
B. And it ends here.
|
763
787
|
EOS
|
764
|
-
output =
|
788
|
+
output = convert_string input
|
765
789
|
assert_xpath '//ol', output, 1
|
766
790
|
assert_xpath '//ol/li', output, 2
|
767
791
|
end
|
768
792
|
|
769
|
-
test 'should discover anchor at start of list item text and register it as a reference' do
|
793
|
+
test 'should discover anchor at start of unordered list item text and register it as a reference' do
|
770
794
|
input = <<-EOS
|
771
795
|
The highest peak in the Front Range is <<grays-peak>>, which tops <<mount-evans>> by just a few feet.
|
772
796
|
|
@@ -785,6 +809,26 @@ Grays Peak rises to 14,278 feet, making it the highest summit in the Front Range
|
|
785
809
|
assert_xpath '(//p)[1]/a[@href="#grays-peak"][text()="Grays Peak"]', output, 1
|
786
810
|
assert_xpath '(//p)[1]/a[@href="#mount-evans"][text()="Mount Evans"]', output, 1
|
787
811
|
end
|
812
|
+
|
813
|
+
test 'should discover anchor at start of ordered list item text and register it as a reference' do
|
814
|
+
input = <<-EOS
|
815
|
+
This is a cross-reference to <<step-2>>.
|
816
|
+
This is a cross-reference to <<step-4>>.
|
817
|
+
|
818
|
+
. Ordered list, item 1, without anchor
|
819
|
+
. [[step-2,Step 2]]Ordered list, item 2, with anchor
|
820
|
+
. Ordered list, item 3, without anchor
|
821
|
+
. [[step-4,Step 4]]Ordered list, item 4, with anchor
|
822
|
+
EOS
|
823
|
+
|
824
|
+
doc = document_from_string input
|
825
|
+
refs = doc.catalog[:refs]
|
826
|
+
assert refs.key?('step-2')
|
827
|
+
assert refs.key?('step-4')
|
828
|
+
output = doc.convert :header_footer => false
|
829
|
+
assert_xpath '(//p)[1]/a[@href="#step-2"][text()="Step 2"]', output, 1
|
830
|
+
assert_xpath '(//p)[1]/a[@href="#step-4"][text()="Step 4"]', output, 1
|
831
|
+
end
|
788
832
|
end
|
789
833
|
|
790
834
|
context "Nested lists" do
|
@@ -797,7 +841,7 @@ List
|
|
797
841
|
* Boo
|
798
842
|
- Blech
|
799
843
|
EOS
|
800
|
-
output =
|
844
|
+
output = convert_string input
|
801
845
|
assert_xpath '//ul', output, 2
|
802
846
|
assert_xpath '//ul/li', output, 3
|
803
847
|
assert_xpath '(//ul)[1]/li', output, 2
|
@@ -813,7 +857,7 @@ List
|
|
813
857
|
- Boo
|
814
858
|
* Blech
|
815
859
|
EOS
|
816
|
-
output =
|
860
|
+
output = convert_string input
|
817
861
|
assert_xpath '//ul', output, 2
|
818
862
|
assert_xpath '//ul/li', output, 3
|
819
863
|
assert_xpath '(//ul)[1]/li', output, 2
|
@@ -832,7 +876,7 @@ List
|
|
832
876
|
|
833
877
|
- Blech
|
834
878
|
EOS
|
835
|
-
output =
|
879
|
+
output = convert_string input
|
836
880
|
assert_xpath '//ul', output, 2
|
837
881
|
assert_xpath '//ul/li', output, 3
|
838
882
|
assert_xpath '(//ul)[1]/li', output, 2
|
@@ -848,7 +892,7 @@ List
|
|
848
892
|
** Boo
|
849
893
|
* Blech
|
850
894
|
EOS
|
851
|
-
output =
|
895
|
+
output = convert_string input
|
852
896
|
assert_xpath '//ul', output, 2
|
853
897
|
assert_xpath '//ul/li', output, 3
|
854
898
|
assert_xpath '(//ul)[1]/li', output, 2
|
@@ -865,7 +909,7 @@ List
|
|
865
909
|
*** Snoo
|
866
910
|
* Blech
|
867
911
|
EOS
|
868
|
-
output =
|
912
|
+
output = convert_string input
|
869
913
|
assert_xpath '//ul', output, 3
|
870
914
|
assert_xpath '(//ul)[1]/li', output, 2
|
871
915
|
assert_xpath '((//ul)[1]/li//ul)[1]/li', output, 1
|
@@ -883,7 +927,7 @@ List
|
|
883
927
|
**** Froo
|
884
928
|
* Blech
|
885
929
|
EOS
|
886
|
-
output =
|
930
|
+
output = convert_string input
|
887
931
|
assert_xpath '//ul', output, 4
|
888
932
|
assert_xpath '(//ul)[1]/li', output, 2
|
889
933
|
assert_xpath '((//ul)[1]/li//ul)[1]/li', output, 1
|
@@ -903,7 +947,7 @@ List
|
|
903
947
|
***** Groo
|
904
948
|
* Blech
|
905
949
|
EOS
|
906
|
-
output =
|
950
|
+
output = convert_string input
|
907
951
|
assert_xpath '//ul', output, 5
|
908
952
|
assert_xpath '(//ul)[1]/li', output, 2
|
909
953
|
assert_xpath '((//ul)[1]/li//ul)[1]/li', output, 1
|
@@ -912,25 +956,46 @@ List
|
|
912
956
|
assert_xpath '(((((//ul)[1]/li//ul)[1]/li//ul)[1]/li//ul)[1]/li//ul)[1]/li', output, 1
|
913
957
|
end
|
914
958
|
|
915
|
-
test 'nested
|
959
|
+
test 'nested arbitrary depth with asterisks' do
|
960
|
+
input = []
|
961
|
+
('a'..'z').each_with_index do |ch, i|
|
962
|
+
input << %(#{'*' * (i + 1)} #{ch})
|
963
|
+
end
|
964
|
+
output = convert_string_to_embedded input.join(%(\n))
|
965
|
+
refute_includes output, '*'
|
966
|
+
assert_css 'li', output, 26
|
967
|
+
end
|
968
|
+
|
969
|
+
test 'level of unordered list should match section level' do
|
916
970
|
input = <<-EOS
|
917
|
-
|
918
|
-
|
971
|
+
== Parent Section
|
972
|
+
|
973
|
+
* item 1.1
|
974
|
+
** item 2.1
|
975
|
+
*** item 3.1
|
976
|
+
** item 2.2
|
977
|
+
* item 1.2
|
978
|
+
|
979
|
+
=== Nested Section
|
980
|
+
|
981
|
+
* item 1.1
|
982
|
+
EOS
|
983
|
+
|
984
|
+
doc = document_from_string input
|
985
|
+
lists = doc.find_by :context => :ulist
|
986
|
+
assert_equal 1, lists[0].level
|
987
|
+
assert_equal 1, lists[1].level
|
988
|
+
assert_equal 1, lists[2].level
|
989
|
+
assert_equal 2, lists[3].level
|
990
|
+
end
|
919
991
|
|
920
|
-
|
992
|
+
test 'does not recognize lists with repeating unicode bullets' do
|
993
|
+
input = <<-EOS
|
921
994
|
•• Boo
|
922
|
-
••• Snoo
|
923
|
-
•••• Froo
|
924
|
-
••••• Groo
|
925
|
-
• Blech
|
926
995
|
EOS
|
927
|
-
output =
|
928
|
-
assert_xpath '//ul', output,
|
929
|
-
|
930
|
-
assert_xpath '((//ul)[1]/li//ul)[1]/li', output, 1
|
931
|
-
assert_xpath '(((//ul)[1]/li//ul)[1]/li//ul)[1]/li', output, 1
|
932
|
-
assert_xpath '((((//ul)[1]/li//ul)[1]/li//ul)[1]/li//ul)[1]/li', output, 1
|
933
|
-
assert_xpath '(((((//ul)[1]/li//ul)[1]/li//ul)[1]/li//ul)[1]/li//ul)[1]/li', output, 1
|
996
|
+
output = convert_string input
|
997
|
+
assert_xpath '//ul', output, 0
|
998
|
+
assert_includes output, '•'
|
934
999
|
end if ::RUBY_MIN_VERSION_1_9
|
935
1000
|
|
936
1001
|
test "nested ordered elements (2)" do
|
@@ -942,7 +1007,7 @@ List
|
|
942
1007
|
.. Boo
|
943
1008
|
. Blech
|
944
1009
|
EOS
|
945
|
-
output =
|
1010
|
+
output = convert_string input
|
946
1011
|
assert_xpath '//ol', output, 2
|
947
1012
|
assert_xpath '//ol/li', output, 3
|
948
1013
|
assert_xpath '(//ol)[1]/li', output, 2
|
@@ -959,13 +1024,46 @@ List
|
|
959
1024
|
... Snoo
|
960
1025
|
. Blech
|
961
1026
|
EOS
|
962
|
-
output =
|
1027
|
+
output = convert_string input
|
963
1028
|
assert_xpath '//ol', output, 3
|
964
1029
|
assert_xpath '(//ol)[1]/li', output, 2
|
965
1030
|
assert_xpath '((//ol)[1]/li//ol)[1]/li', output, 1
|
966
1031
|
assert_xpath '(((//ol)[1]/li//ol)[1]/li//ol)[1]/li', output, 1
|
967
1032
|
end
|
968
1033
|
|
1034
|
+
test 'nested arbitrary depth with dot marker' do
|
1035
|
+
input = []
|
1036
|
+
('a'..'z').each_with_index do |ch, i|
|
1037
|
+
input << %(#{'.' * (i + 1)} #{ch})
|
1038
|
+
end
|
1039
|
+
output = convert_string_to_embedded input.join(%(\n))
|
1040
|
+
refute_includes output, '.'
|
1041
|
+
assert_css 'li', output, 26
|
1042
|
+
end
|
1043
|
+
|
1044
|
+
test 'level of ordered list should match section level' do
|
1045
|
+
input = <<-EOS
|
1046
|
+
== Parent Section
|
1047
|
+
|
1048
|
+
. item 1.1
|
1049
|
+
.. item 2.1
|
1050
|
+
... item 3.1
|
1051
|
+
.. item 2.2
|
1052
|
+
. item 1.2
|
1053
|
+
|
1054
|
+
=== Nested Section
|
1055
|
+
|
1056
|
+
. item 1.1
|
1057
|
+
EOS
|
1058
|
+
|
1059
|
+
doc = document_from_string input
|
1060
|
+
lists = doc.find_by :context => :olist
|
1061
|
+
assert_equal 1, lists[0].level
|
1062
|
+
assert_equal 1, lists[1].level
|
1063
|
+
assert_equal 1, lists[2].level
|
1064
|
+
assert_equal 2, lists[3].level
|
1065
|
+
end
|
1066
|
+
|
969
1067
|
test "nested unordered inside ordered elements" do
|
970
1068
|
input = <<-EOS
|
971
1069
|
List
|
@@ -975,7 +1073,7 @@ List
|
|
975
1073
|
* Boo
|
976
1074
|
. Blech
|
977
1075
|
EOS
|
978
|
-
output =
|
1076
|
+
output = convert_string input
|
979
1077
|
assert_xpath '//ol', output, 1
|
980
1078
|
assert_xpath '//ul', output, 1
|
981
1079
|
assert_xpath '(//ol)[1]/li', output, 2
|
@@ -991,7 +1089,7 @@ List
|
|
991
1089
|
. Boo
|
992
1090
|
* Blech
|
993
1091
|
EOS
|
994
|
-
output =
|
1092
|
+
output = convert_string input
|
995
1093
|
assert_xpath '//ul', output, 1
|
996
1094
|
assert_xpath '//ol', output, 1
|
997
1095
|
assert_xpath '(//ul)[1]/li', output, 2
|
@@ -1008,7 +1106,7 @@ List
|
|
1008
1106
|
* bullet 2
|
1009
1107
|
EOS
|
1010
1108
|
|
1011
|
-
output =
|
1109
|
+
output = convert_string_to_embedded input
|
1012
1110
|
assert_css '.ulist', output, 2
|
1013
1111
|
assert_css '.olist', output, 1
|
1014
1112
|
assert_css '.ulist > ul > li > p', output, 3
|
@@ -1031,7 +1129,7 @@ List
|
|
1031
1129
|
|
1032
1130
|
* Blech
|
1033
1131
|
EOS
|
1034
|
-
output =
|
1132
|
+
output = convert_string input
|
1035
1133
|
assert_xpath '//ul', output, 1
|
1036
1134
|
assert_xpath '//ol', output, 1
|
1037
1135
|
assert_xpath '(//ul)[1]/li', output, 2
|
@@ -1051,7 +1149,7 @@ List
|
|
1051
1149
|
|
1052
1150
|
. numbered
|
1053
1151
|
EOS
|
1054
|
-
output =
|
1152
|
+
output = convert_string input
|
1055
1153
|
assert_xpath '//ul', output, 1
|
1056
1154
|
assert_xpath '//li', output, 2
|
1057
1155
|
assert_xpath '//ul//ol', output, 1
|
@@ -1077,8 +1175,8 @@ List
|
|
1077
1175
|
literal
|
1078
1176
|
....
|
1079
1177
|
EOS
|
1080
|
-
# use
|
1081
|
-
output =
|
1178
|
+
# use convert_string so we can match all ulists easier
|
1179
|
+
output = convert_string input
|
1082
1180
|
assert_xpath '//*[@class="ulist"]/ul', output, 2
|
1083
1181
|
assert_xpath '(//*[@class="ulist"])[1]/following-sibling::*[@class="literalblock"]', output, 1
|
1084
1182
|
assert_xpath '(//*[@class="ulist"])[1]/following-sibling::*[@class="literalblock"]/*[@class="title"]', output, 1
|
@@ -1095,7 +1193,7 @@ term1:: def1
|
|
1095
1193
|
|
1096
1194
|
* Blech
|
1097
1195
|
EOS
|
1098
|
-
output =
|
1196
|
+
output = convert_string input
|
1099
1197
|
assert_xpath '//ul', output, 1
|
1100
1198
|
assert_xpath '//dl', output, 1
|
1101
1199
|
assert_xpath '//ul[1]/li', output, 2
|
@@ -1113,7 +1211,7 @@ Blah
|
|
1113
1211
|
. Boo
|
1114
1212
|
* Blech
|
1115
1213
|
EOS
|
1116
|
-
output =
|
1214
|
+
output = convert_string input
|
1117
1215
|
assert_xpath '//ul', output, 1
|
1118
1216
|
assert_xpath '//ol', output, 1
|
1119
1217
|
assert_xpath '(//ul)[1]/li', output, 2
|
@@ -1133,7 +1231,7 @@ Item one, paragraph two
|
|
1133
1231
|
+
|
1134
1232
|
* Item two
|
1135
1233
|
EOS
|
1136
|
-
output =
|
1234
|
+
output = convert_string input
|
1137
1235
|
assert_xpath '//ul', output, 1
|
1138
1236
|
assert_xpath '//ul/li', output, 2
|
1139
1237
|
assert_xpath '//ul/li[1]/p', output, 1
|
@@ -1155,7 +1253,7 @@ Item one, literal block
|
|
1155
1253
|
+
|
1156
1254
|
* Item two
|
1157
1255
|
EOS
|
1158
|
-
output =
|
1256
|
+
output = convert_string input
|
1159
1257
|
assert_xpath '//ul', output, 1
|
1160
1258
|
assert_xpath '//ul/li', output, 2
|
1161
1259
|
assert_xpath '//ul/li[1]/p', output, 1
|
@@ -1179,7 +1277,7 @@ Lists
|
|
1179
1277
|
|
1180
1278
|
* Item two
|
1181
1279
|
EOS
|
1182
|
-
output =
|
1280
|
+
output = convert_string input
|
1183
1281
|
assert_xpath '//ul', output, 1
|
1184
1282
|
assert_xpath '//ul/li', output, 2
|
1185
1283
|
assert_xpath '//ul/li[1]/p', output, 1
|
@@ -1199,7 +1297,7 @@ Lists
|
|
1199
1297
|
|
1200
1298
|
* Item two
|
1201
1299
|
EOS
|
1202
|
-
output =
|
1300
|
+
output = convert_string input
|
1203
1301
|
assert_xpath '//ul', output, 1
|
1204
1302
|
assert_xpath '//ul/li', output, 2
|
1205
1303
|
assert_xpath '//ul/li[1]/*', output, 1
|
@@ -1217,7 +1315,7 @@ Lists
|
|
1217
1315
|
|
1218
1316
|
* Item two
|
1219
1317
|
EOS
|
1220
|
-
output =
|
1318
|
+
output = convert_string input
|
1221
1319
|
assert_xpath '//ul', output, 1
|
1222
1320
|
assert_xpath '//ul/li', output, 2
|
1223
1321
|
assert_xpath '//ul/li[1]/*', output, 1
|
@@ -1240,7 +1338,7 @@ ____
|
|
1240
1338
|
+
|
1241
1339
|
* Item two
|
1242
1340
|
EOS
|
1243
|
-
output =
|
1341
|
+
output = convert_string_to_embedded input
|
1244
1342
|
assert_xpath '//ul', output, 1
|
1245
1343
|
assert_xpath '//ul/li', output, 2
|
1246
1344
|
assert_xpath '//ul/li[1]/p', output, 1
|
@@ -1261,7 +1359,7 @@ open block in list item 1
|
|
1261
1359
|
|
1262
1360
|
. list item 2
|
1263
1361
|
EOS
|
1264
|
-
output =
|
1362
|
+
output = convert_string_to_embedded input
|
1265
1363
|
assert_css 'ol', output, 1
|
1266
1364
|
assert_css 'ol li', output, 2
|
1267
1365
|
assert_xpath %((//ol/li)[1]/p[text()="list item 1\ncontinued"]), output, 1
|
@@ -1284,7 +1382,7 @@ nested list item paragraph
|
|
1284
1382
|
|
1285
1383
|
. list item 2
|
1286
1384
|
EOS
|
1287
|
-
output =
|
1385
|
+
output = convert_string_to_embedded input
|
1288
1386
|
assert_css '.olist ol', output, 1
|
1289
1387
|
assert_css '.olist ol > li', output, 2
|
1290
1388
|
assert_css '.ulist ul', output, 1
|
@@ -1315,7 +1413,7 @@ paragraph for list item 1
|
|
1315
1413
|
|
1316
1414
|
. list item 2
|
1317
1415
|
EOS
|
1318
|
-
output =
|
1416
|
+
output = convert_string_to_embedded input
|
1319
1417
|
assert_css '.olist ol', output, 1
|
1320
1418
|
assert_css '.olist ol > li', output, 2
|
1321
1419
|
assert_css '.ulist ul', output, 1
|
@@ -1348,7 +1446,7 @@ bullet 1 paragraph
|
|
1348
1446
|
|
1349
1447
|
* bullet 2
|
1350
1448
|
EOS
|
1351
|
-
output =
|
1449
|
+
output = convert_string_to_embedded input
|
1352
1450
|
|
1353
1451
|
assert_xpath '(//ul)[1]/li', output, 2
|
1354
1452
|
|
@@ -1389,7 +1487,7 @@ paragraph for list item 1
|
|
1389
1487
|
|
1390
1488
|
. list item 2
|
1391
1489
|
EOS
|
1392
|
-
output =
|
1490
|
+
output = convert_string_to_embedded input
|
1393
1491
|
assert_css '.olist ol', output, 1
|
1394
1492
|
assert_css '.olist ol > li', output, 2
|
1395
1493
|
assert_css '.ulist ul', output, 1
|
@@ -1430,7 +1528,7 @@ paragraph for list item 1
|
|
1430
1528
|
|
1431
1529
|
. list item 2
|
1432
1530
|
EOS
|
1433
|
-
output =
|
1531
|
+
output = convert_string_to_embedded input
|
1434
1532
|
assert_css '.olist ol', output, 1
|
1435
1533
|
assert_css '.olist ol > li', output, 2
|
1436
1534
|
assert_css '.ulist ul', output, 1
|
@@ -1472,7 +1570,7 @@ paragraph for list item 1
|
|
1472
1570
|
|
1473
1571
|
. list item 2
|
1474
1572
|
EOS
|
1475
|
-
output =
|
1573
|
+
output = convert_string_to_embedded input
|
1476
1574
|
assert_css '.olist ol', output, 1
|
1477
1575
|
assert_css '.olist ol > li', output, 2
|
1478
1576
|
assert_css '.ulist ul', output, 1
|
@@ -1514,7 +1612,7 @@ bullet 1 paragraph
|
|
1514
1612
|
|
1515
1613
|
* bullet 2
|
1516
1614
|
EOS
|
1517
|
-
output =
|
1615
|
+
output = convert_string_to_embedded input
|
1518
1616
|
|
1519
1617
|
assert_xpath '((//ul)[1]/li[1])/*', output, 3
|
1520
1618
|
assert_xpath '(((//ul)[1]/li[1])/*)[1]/self::p[text()="bullet 1"]', output, 1
|
@@ -1548,7 +1646,7 @@ attached paragraph
|
|
1548
1646
|
* item 2
|
1549
1647
|
EOS
|
1550
1648
|
|
1551
|
-
output =
|
1649
|
+
output = convert_string_to_embedded input
|
1552
1650
|
|
1553
1651
|
assert_css 'ul', output, 1
|
1554
1652
|
assert_css 'ol', output, 1
|
@@ -1580,7 +1678,7 @@ attached paragraph
|
|
1580
1678
|
* item 2
|
1581
1679
|
EOS
|
1582
1680
|
|
1583
|
-
output =
|
1681
|
+
output = convert_string_to_embedded input
|
1584
1682
|
|
1585
1683
|
assert_css 'ul', output, 1
|
1586
1684
|
assert_css 'dl', output, 1
|
@@ -1615,7 +1713,7 @@ Item one, paragraph two
|
|
1615
1713
|
+
|
1616
1714
|
+
|
1617
1715
|
EOS
|
1618
|
-
output =
|
1716
|
+
output = convert_string input
|
1619
1717
|
assert_xpath '//ul', output, 1
|
1620
1718
|
assert_xpath '//ul/li', output, 2
|
1621
1719
|
assert_xpath '//ul/li[1]/p', output, 1
|
@@ -1635,7 +1733,7 @@ example
|
|
1635
1733
|
EOS
|
1636
1734
|
|
1637
1735
|
using_memory_logger do |logger|
|
1638
|
-
output =
|
1736
|
+
output = convert_string_to_embedded input
|
1639
1737
|
assert_xpath '//ul/li', output, 1
|
1640
1738
|
assert_xpath '//ul/li/*[@class="exampleblock"]', output, 1
|
1641
1739
|
assert_xpath %(//p[text()="example\n* swallowed item"]), output, 1
|
@@ -1656,7 +1754,7 @@ List
|
|
1656
1754
|
. Boo
|
1657
1755
|
. Blech
|
1658
1756
|
EOS
|
1659
|
-
output =
|
1757
|
+
output = convert_string input
|
1660
1758
|
assert_xpath '//ol', output, 1
|
1661
1759
|
assert_xpath '//ol/li', output, 3
|
1662
1760
|
end
|
@@ -1667,7 +1765,7 @@ List
|
|
1667
1765
|
. Boo
|
1668
1766
|
. Blech
|
1669
1767
|
EOS
|
1670
|
-
output =
|
1768
|
+
output = convert_string input
|
1671
1769
|
assert_xpath '//ol', output, 1
|
1672
1770
|
assert_xpath '//ol/li', output, 3
|
1673
1771
|
end
|
@@ -1678,7 +1776,7 @@ List
|
|
1678
1776
|
\t.\tBoo
|
1679
1777
|
\t.\tBlech
|
1680
1778
|
EOS
|
1681
|
-
output =
|
1779
|
+
output = convert_string input
|
1682
1780
|
assert_xpath '//ol', output, 1
|
1683
1781
|
assert_xpath '//ol/li', output, 3
|
1684
1782
|
end
|
@@ -1691,11 +1789,37 @@ List
|
|
1691
1789
|
. Refactor!
|
1692
1790
|
EOS
|
1693
1791
|
|
1694
|
-
output =
|
1792
|
+
output = convert_string_to_embedded input
|
1695
1793
|
assert_css '.olist.arabic.dry', output, 1
|
1696
1794
|
assert_css '.olist ol.arabic', output, 1
|
1697
1795
|
end
|
1698
1796
|
|
1797
|
+
test 'should base list style on marker length rather than list depth' do
|
1798
|
+
input = <<-EOS
|
1799
|
+
... parent
|
1800
|
+
.. child
|
1801
|
+
. grandchild
|
1802
|
+
EOS
|
1803
|
+
|
1804
|
+
output = convert_string_to_embedded input
|
1805
|
+
assert_css '.olist.lowerroman', output, 1
|
1806
|
+
assert_css '.olist.lowerroman .olist.loweralpha', output, 1
|
1807
|
+
assert_css '.olist.lowerroman .olist.loweralpha .olist.arabic', output, 1
|
1808
|
+
end
|
1809
|
+
|
1810
|
+
test 'should allow list style to be specified explicitly when using markers with implicit style' do
|
1811
|
+
input = <<-EOS
|
1812
|
+
[loweralpha]
|
1813
|
+
i) 1
|
1814
|
+
ii) 2
|
1815
|
+
iii) 3
|
1816
|
+
EOS
|
1817
|
+
|
1818
|
+
output = convert_string_to_embedded input
|
1819
|
+
assert_css '.olist.loweralpha', output, 1
|
1820
|
+
assert_css '.olist.lowerroman', output, 0
|
1821
|
+
end
|
1822
|
+
|
1699
1823
|
test 'should represent custom numbering and explicit role attribute as style classes' do
|
1700
1824
|
input = <<-EOS
|
1701
1825
|
[loweralpha, role="dry"]
|
@@ -1704,7 +1828,7 @@ List
|
|
1704
1828
|
. Refactor!
|
1705
1829
|
EOS
|
1706
1830
|
|
1707
|
-
output =
|
1831
|
+
output = convert_string_to_embedded input
|
1708
1832
|
assert_css '.olist.loweralpha.dry', output, 1
|
1709
1833
|
assert_css '.olist ol.loweralpha', output, 1
|
1710
1834
|
end
|
@@ -1718,7 +1842,7 @@ List
|
|
1718
1842
|
. blast off!
|
1719
1843
|
EOS
|
1720
1844
|
|
1721
|
-
output =
|
1845
|
+
output = convert_string_to_embedded input
|
1722
1846
|
assert_css 'ol[reversed][start="3"]', output, 1
|
1723
1847
|
end
|
1724
1848
|
|
@@ -1730,7 +1854,7 @@ List
|
|
1730
1854
|
. Refactor!
|
1731
1855
|
EOS
|
1732
1856
|
|
1733
|
-
output =
|
1857
|
+
output = convert_string_to_embedded input
|
1734
1858
|
assert_css '.olist.arabic.dry', output, 1
|
1735
1859
|
assert_css '.olist ol.arabic', output, 1
|
1736
1860
|
end
|
@@ -1743,7 +1867,7 @@ List
|
|
1743
1867
|
. Refactor!
|
1744
1868
|
EOS
|
1745
1869
|
|
1746
|
-
output =
|
1870
|
+
output = convert_string_to_embedded input
|
1747
1871
|
assert_css '.olist.loweralpha.dry', output, 1
|
1748
1872
|
assert_css '.olist ol.loweralpha', output, 1
|
1749
1873
|
end
|
@@ -1760,7 +1884,7 @@ List
|
|
1760
1884
|
|
1761
1885
|
. Blech
|
1762
1886
|
EOS
|
1763
|
-
output =
|
1887
|
+
output = convert_string input
|
1764
1888
|
assert_xpath '//ol', output, 1
|
1765
1889
|
assert_xpath '//ol/li', output, 3
|
1766
1890
|
end
|
@@ -1778,7 +1902,7 @@ more text
|
|
1778
1902
|
// another line comment
|
1779
1903
|
. Blech
|
1780
1904
|
EOS
|
1781
|
-
output =
|
1905
|
+
output = convert_string_to_embedded input
|
1782
1906
|
assert_xpath '//ol', output, 1
|
1783
1907
|
assert_xpath '//ol/li', output, 3
|
1784
1908
|
assert_xpath %((//ol/li)[2]/p[text()="Boo\nmore text"]), output, 1
|
@@ -1796,7 +1920,7 @@ List
|
|
1796
1920
|
|
1797
1921
|
. Blech
|
1798
1922
|
EOS
|
1799
|
-
output =
|
1923
|
+
output = convert_string input
|
1800
1924
|
assert_xpath '//ol', output, 2
|
1801
1925
|
assert_xpath '(//ol)[1]/li', output, 2
|
1802
1926
|
assert_xpath '(//ol)[2]/li', output, 1
|
@@ -1813,7 +1937,7 @@ List
|
|
1813
1937
|
.Also
|
1814
1938
|
. Blech
|
1815
1939
|
EOS
|
1816
|
-
output =
|
1940
|
+
output = convert_string input
|
1817
1941
|
assert_xpath '//ol', output, 2
|
1818
1942
|
assert_xpath '(//ol)[1]/li', output, 2
|
1819
1943
|
assert_xpath '(//ol)[2]/li', output, 1
|
@@ -1830,7 +1954,7 @@ List
|
|
1830
1954
|
:foo: bar
|
1831
1955
|
. Blech
|
1832
1956
|
EOS
|
1833
|
-
output =
|
1957
|
+
output = convert_string_to_embedded input
|
1834
1958
|
assert_xpath '//ol', output, 2
|
1835
1959
|
assert_xpath '(//ol)[1]/li', output, 2
|
1836
1960
|
assert_xpath '(//ol)[2]/li', output, 1
|
@@ -1845,7 +1969,7 @@ List
|
|
1845
1969
|
. item 8
|
1846
1970
|
EOS
|
1847
1971
|
|
1848
|
-
output =
|
1972
|
+
output = convert_string_to_embedded input, :backend => 'docbook45'
|
1849
1973
|
assert_xpath '//orderedlist', output, 1
|
1850
1974
|
assert_xpath '(//orderedlist)/listitem', output, 2
|
1851
1975
|
assert_xpath '(//orderedlist/listitem)[1][@override = "7"]', output, 1
|
@@ -1860,11 +1984,35 @@ List
|
|
1860
1984
|
. item 8
|
1861
1985
|
EOS
|
1862
1986
|
|
1863
|
-
output =
|
1987
|
+
output = convert_string_to_embedded input, :backend => 'docbook5'
|
1864
1988
|
assert_xpath '//orderedlist', output, 1
|
1865
1989
|
assert_xpath '(//orderedlist)/listitem', output, 2
|
1866
1990
|
assert_xpath '(//orderedlist)[@startingnumber = "7"]', output, 1
|
1867
1991
|
end
|
1992
|
+
|
1993
|
+
test 'should match trailing line separator in text of list item' do
|
1994
|
+
input = <<-EOS.chomp
|
1995
|
+
. a
|
1996
|
+
. b#{decode_char 8232}
|
1997
|
+
. c
|
1998
|
+
EOS
|
1999
|
+
|
2000
|
+
output = convert_string input
|
2001
|
+
assert_css 'li', output, 3
|
2002
|
+
assert_xpath %((//li)[2]/p[text()="b#{decode_char 8232}"]), output, 1
|
2003
|
+
end
|
2004
|
+
|
2005
|
+
test 'should match line separator in text of list item' do
|
2006
|
+
input = <<-EOS.chomp
|
2007
|
+
. a
|
2008
|
+
. b#{decode_char 8232}b
|
2009
|
+
. c
|
2010
|
+
EOS
|
2011
|
+
|
2012
|
+
output = convert_string input
|
2013
|
+
assert_css 'li', output, 3
|
2014
|
+
assert_xpath %((//li)[2]/p[text()="b#{decode_char 8232}b"]), output, 1
|
2015
|
+
end
|
1868
2016
|
end
|
1869
2017
|
|
1870
2018
|
test 'should warn if explicit uppercase roman numerals in list are out of sequence' do
|
@@ -1873,7 +2021,7 @@ I) one
|
|
1873
2021
|
III) three
|
1874
2022
|
EOS
|
1875
2023
|
using_memory_logger do |logger|
|
1876
|
-
output =
|
2024
|
+
output = convert_string_to_embedded input
|
1877
2025
|
assert_xpath '//ol/li', output, 2
|
1878
2026
|
assert_message logger, :WARN, '<stdin>: line 2: list item index: expected II, got III', Hash
|
1879
2027
|
end
|
@@ -1885,7 +2033,7 @@ i) one
|
|
1885
2033
|
iii) three
|
1886
2034
|
EOS
|
1887
2035
|
using_memory_logger do |logger|
|
1888
|
-
output =
|
2036
|
+
output = convert_string_to_embedded input
|
1889
2037
|
assert_xpath '//ol/li', output, 2
|
1890
2038
|
assert_message logger, :WARN, '<stdin>: line 2: list item index: expected ii, got iii', Hash
|
1891
2039
|
end
|
@@ -1899,7 +2047,7 @@ context "Description lists (:dlist)" do
|
|
1899
2047
|
term1:: def1
|
1900
2048
|
term2:: def2
|
1901
2049
|
EOS
|
1902
|
-
output =
|
2050
|
+
output = convert_string input
|
1903
2051
|
assert_xpath '//dl', output, 1
|
1904
2052
|
assert_xpath '//dl/dt', output, 2
|
1905
2053
|
assert_xpath '//dl/dt/following-sibling::dd', output, 2
|
@@ -1914,7 +2062,7 @@ term2:: def2
|
|
1914
2062
|
term1;; ;; def1
|
1915
2063
|
term2;; ;; def2
|
1916
2064
|
EOS
|
1917
|
-
output =
|
2065
|
+
output = convert_string input
|
1918
2066
|
assert_xpath '//dl', output, 1
|
1919
2067
|
assert_xpath '//dl/dt', output, 2
|
1920
2068
|
assert_xpath '//dl/dt/following-sibling::dd', output, 2
|
@@ -1929,7 +2077,7 @@ term2;; ;; def2
|
|
1929
2077
|
term1:: def1
|
1930
2078
|
term2:: def2
|
1931
2079
|
EOS
|
1932
|
-
output =
|
2080
|
+
output = convert_string input
|
1933
2081
|
assert_xpath '//dl', output, 1
|
1934
2082
|
assert_xpath '//dl/dt', output, 2
|
1935
2083
|
assert_xpath '//dl/dt/following-sibling::dd', output, 2
|
@@ -1944,7 +2092,7 @@ term1:: def1
|
|
1944
2092
|
term1::\tdef1
|
1945
2093
|
\tterm2::\tdef2
|
1946
2094
|
EOS
|
1947
|
-
output =
|
2095
|
+
output = convert_string input
|
1948
2096
|
assert_xpath '//dl', output, 1
|
1949
2097
|
assert_xpath '//dl/dt', output, 2
|
1950
2098
|
assert_xpath '//dl/dt/following-sibling::dd', output, 2
|
@@ -1960,7 +2108,7 @@ term1:: def1
|
|
1960
2108
|
|
1961
2109
|
term2:: def2
|
1962
2110
|
EOS
|
1963
|
-
output =
|
2111
|
+
output = convert_string input
|
1964
2112
|
assert_xpath '//dl', output, 1
|
1965
2113
|
assert_xpath '//dl/dt', output, 2
|
1966
2114
|
assert_xpath '//dl/dt/following-sibling::dd', output, 2
|
@@ -1974,7 +2122,7 @@ term1:: def1
|
|
1974
2122
|
|
1975
2123
|
term2:: def2
|
1976
2124
|
EOS
|
1977
|
-
output =
|
2125
|
+
output = convert_string input
|
1978
2126
|
assert_xpath '//dl', output, 2
|
1979
2127
|
assert_xpath '//dl/dt', output, 2
|
1980
2128
|
assert_xpath '(//dl)[1]/dt', output, 1
|
@@ -1989,7 +2137,7 @@ term1:: def1
|
|
1989
2137
|
|
1990
2138
|
term2:: def2
|
1991
2139
|
EOS
|
1992
|
-
output =
|
2140
|
+
output = convert_string input
|
1993
2141
|
assert_xpath '//dl', output, 2
|
1994
2142
|
assert_xpath '//dl/dt', output, 2
|
1995
2143
|
assert_xpath '//dl//hr', output, 0
|
@@ -2004,7 +2152,7 @@ term1:: def1
|
|
2004
2152
|
.Some more
|
2005
2153
|
term2:: def2
|
2006
2154
|
EOS
|
2007
|
-
output =
|
2155
|
+
output = convert_string input
|
2008
2156
|
assert_xpath '//dl', output, 2
|
2009
2157
|
assert_xpath '//dl/dt', output, 2
|
2010
2158
|
assert_xpath '(//dl)[1]/dt', output, 1
|
@@ -2019,7 +2167,7 @@ def1
|
|
2019
2167
|
term2::
|
2020
2168
|
def2
|
2021
2169
|
EOS
|
2022
|
-
output =
|
2170
|
+
output = convert_string input
|
2023
2171
|
assert_xpath '//dl', output, 1
|
2024
2172
|
assert_xpath '//dl/dt', output, 2
|
2025
2173
|
assert_xpath '//dl/dt/following-sibling::dd', output, 2
|
@@ -2036,7 +2184,7 @@ term1::
|
|
2036
2184
|
term2::
|
2037
2185
|
def2
|
2038
2186
|
EOS
|
2039
|
-
output =
|
2187
|
+
output = convert_string input
|
2040
2188
|
assert_xpath '//dl', output, 1
|
2041
2189
|
assert_xpath '//dl/dt', output, 2
|
2042
2190
|
assert_xpath '//dl/dt/following-sibling::dd', output, 2
|
@@ -2056,7 +2204,7 @@ term2::
|
|
2056
2204
|
// comment
|
2057
2205
|
def2 continued
|
2058
2206
|
EOS
|
2059
|
-
output =
|
2207
|
+
output = convert_string_to_embedded input
|
2060
2208
|
assert_xpath '//dl', output, 1
|
2061
2209
|
assert_xpath '//dl/dt', output, 2
|
2062
2210
|
assert_xpath '//dl/dt/following-sibling::dd', output, 2
|
@@ -2074,7 +2222,7 @@ term1::
|
|
2074
2222
|
// not a comment
|
2075
2223
|
line 3
|
2076
2224
|
EOS
|
2077
|
-
output =
|
2225
|
+
output = convert_string_to_embedded input
|
2078
2226
|
assert_xpath '//*[@class="literalblock"]', output, 1
|
2079
2227
|
assert_xpath %(//*[@class="literalblock"]//pre[text()=" line 1\n// not a comment\n line 3"]), output, 1
|
2080
2228
|
end
|
@@ -2088,7 +2236,7 @@ term1::
|
|
2088
2236
|
term2::
|
2089
2237
|
def2
|
2090
2238
|
EOS
|
2091
|
-
output =
|
2239
|
+
output = convert_string_to_embedded input
|
2092
2240
|
assert_xpath '//dl', output, 1
|
2093
2241
|
assert_xpath '//dl/dt', output, 2
|
2094
2242
|
assert_xpath '//dl/dt/following-sibling::dd', output, 2
|
@@ -2104,7 +2252,7 @@ term1::
|
|
2104
2252
|
term2::
|
2105
2253
|
def2
|
2106
2254
|
EOS
|
2107
|
-
output =
|
2255
|
+
output = convert_string input
|
2108
2256
|
assert_xpath '//dl', output, 1
|
2109
2257
|
assert_xpath '//dl/dt', output, 2
|
2110
2258
|
assert_xpath '//dl/dd', output, 1
|
@@ -2122,7 +2270,7 @@ description
|
|
2122
2270
|
|
2123
2271
|
last::
|
2124
2272
|
EOS
|
2125
|
-
output =
|
2273
|
+
output = convert_string_to_embedded input, :backend => 'docbook'
|
2126
2274
|
assert_xpath '//varlistentry', output, 2
|
2127
2275
|
assert_xpath '(//varlistentry)[1]/term', output, 2
|
2128
2276
|
assert_xpath '(//varlistentry)[2]/term', output, 1
|
@@ -2139,7 +2287,7 @@ term2::
|
|
2139
2287
|
|
2140
2288
|
def2
|
2141
2289
|
EOS
|
2142
|
-
output =
|
2290
|
+
output = convert_string input
|
2143
2291
|
assert_xpath '//dl', output, 1
|
2144
2292
|
assert_xpath '//dl/dt', output, 2
|
2145
2293
|
assert_xpath '//dl/dt/following-sibling::dd', output, 2
|
@@ -2160,7 +2308,7 @@ def1
|
|
2160
2308
|
term2::
|
2161
2309
|
def2
|
2162
2310
|
EOS
|
2163
|
-
output =
|
2311
|
+
output = convert_string input
|
2164
2312
|
assert_xpath '//dl', output, 1
|
2165
2313
|
assert_xpath '//dl/dt', output, 2
|
2166
2314
|
assert_xpath '//dl/dt/following-sibling::dd', output, 2
|
@@ -2177,7 +2325,7 @@ term1:: def1
|
|
2177
2325
|
term2::
|
2178
2326
|
def2
|
2179
2327
|
EOS
|
2180
|
-
output =
|
2328
|
+
output = convert_string input
|
2181
2329
|
assert_xpath '//dl', output, 1
|
2182
2330
|
assert_xpath '//dl/dt', output, 2
|
2183
2331
|
assert_xpath '//dl/dt/following-sibling::dd', output, 2
|
@@ -2212,7 +2360,7 @@ The highest peak in the Front Range is <<grays-peak>>, which tops <<mount-evans>
|
|
2212
2360
|
term1::def1
|
2213
2361
|
term2::def2
|
2214
2362
|
EOS
|
2215
|
-
output =
|
2363
|
+
output = convert_string input
|
2216
2364
|
assert_xpath '//dl', output, 0
|
2217
2365
|
end
|
2218
2366
|
|
@@ -2227,7 +2375,7 @@ literal, line 2
|
|
2227
2375
|
....
|
2228
2376
|
anotherterm:: def
|
2229
2377
|
EOS
|
2230
|
-
output =
|
2378
|
+
output = convert_string input
|
2231
2379
|
assert_xpath '//dl/dt', output, 2
|
2232
2380
|
assert_xpath '//dl/dd', output, 2
|
2233
2381
|
assert_xpath '//dl/dd//pre', output, 1
|
@@ -2247,7 +2395,7 @@ literal, line 2
|
|
2247
2395
|
+
|
2248
2396
|
anotherterm:: def
|
2249
2397
|
EOS
|
2250
|
-
output =
|
2398
|
+
output = convert_string input
|
2251
2399
|
assert_xpath '//dl/dt', output, 2
|
2252
2400
|
assert_xpath '//dl/dd', output, 2
|
2253
2401
|
assert_xpath '//dl/dd//pre', output, 1
|
@@ -2272,7 +2420,7 @@ listing, line 2
|
|
2272
2420
|
----
|
2273
2421
|
anotherterm:: def
|
2274
2422
|
EOS
|
2275
|
-
output =
|
2423
|
+
output = convert_string input
|
2276
2424
|
assert_xpath '//dl/dt', output, 2
|
2277
2425
|
assert_xpath '//dl/dd', output, 2
|
2278
2426
|
assert_xpath '//dl/dd//pre', output, 2
|
@@ -2291,7 +2439,7 @@ And some more detail...
|
|
2291
2439
|
--
|
2292
2440
|
anotherterm:: def
|
2293
2441
|
EOS
|
2294
|
-
output =
|
2442
|
+
output = convert_string input
|
2295
2443
|
assert_xpath '//dl/dd//p', output, 3
|
2296
2444
|
assert_xpath '(//dl/dd)[1]//*[@class="openblock"]//p', output, 2
|
2297
2445
|
end
|
@@ -2304,7 +2452,7 @@ more detail
|
|
2304
2452
|
+
|
2305
2453
|
term2:: def2
|
2306
2454
|
EOS
|
2307
|
-
output =
|
2455
|
+
output = convert_string input
|
2308
2456
|
assert_xpath '(//dl/dt)[1][normalize-space(text())="term1"]', output, 1
|
2309
2457
|
assert_xpath '(//dl/dt)[2][normalize-space(text())="term2"]', output, 1
|
2310
2458
|
assert_xpath '(//dl/dd)[1]//p', output, 2
|
@@ -2321,7 +2469,7 @@ more detail
|
|
2321
2469
|
+
|
2322
2470
|
term2:: def2
|
2323
2471
|
EOS
|
2324
|
-
output =
|
2472
|
+
output = convert_string input
|
2325
2473
|
assert_xpath '(//dl/dt)[1][normalize-space(text())="term1"]', output, 1
|
2326
2474
|
assert_xpath '(//dl/dt)[2][normalize-space(text())="term2"]', output, 1
|
2327
2475
|
assert_xpath '(//dl/dd)[1]//p', output, 2
|
@@ -2338,7 +2486,7 @@ la la la
|
|
2338
2486
|
|
2339
2487
|
term2:: def
|
2340
2488
|
EOS
|
2341
|
-
output =
|
2489
|
+
output = convert_string input
|
2342
2490
|
assert_xpath '//dl/dd//p', output, 2
|
2343
2491
|
assert_xpath '(//dl/dd)[1]/*[@class="verseblock"]/pre[text() = "la la la"]', output, 1
|
2344
2492
|
end
|
@@ -2351,7 +2499,7 @@ term1::
|
|
2351
2499
|
* level 1
|
2352
2500
|
term2:: def
|
2353
2501
|
EOS
|
2354
|
-
output =
|
2502
|
+
output = convert_string input
|
2355
2503
|
assert_xpath '//dl/dd', output, 2
|
2356
2504
|
assert_xpath '//dl/dd/p', output, 1
|
2357
2505
|
assert_xpath '(//dl/dd)[1]//ul', output, 2
|
@@ -2368,7 +2516,7 @@ term1::
|
|
2368
2516
|
|
2369
2517
|
term2:: def
|
2370
2518
|
EOS
|
2371
|
-
output =
|
2519
|
+
output = convert_string input
|
2372
2520
|
assert_xpath '//dl/dd', output, 2
|
2373
2521
|
assert_xpath '//dl/dd/p', output, 1
|
2374
2522
|
assert_xpath '(//dl/dd)[1]//ul', output, 2
|
@@ -2389,7 +2537,7 @@ A new paragraph
|
|
2389
2537
|
|
2390
2538
|
Another new paragraph
|
2391
2539
|
EOS
|
2392
|
-
output =
|
2540
|
+
output = convert_string input
|
2393
2541
|
assert_xpath '//dl', output, 1
|
2394
2542
|
assert_xpath '//dl/dd', output, 2
|
2395
2543
|
assert_xpath '(//dl/dd)[1]/p[text() = "def1"]', output, 1
|
@@ -2413,7 +2561,7 @@ A new paragraph
|
|
2413
2561
|
|
2414
2562
|
Another new paragraph
|
2415
2563
|
EOS
|
2416
|
-
output =
|
2564
|
+
output = convert_string input
|
2417
2565
|
assert_xpath '//dl', output, 1
|
2418
2566
|
assert_xpath '//dl/dd', output, 2
|
2419
2567
|
assert_xpath '(//dl/dd)[1]/p[text() = "def1"]', output, 1
|
@@ -2437,7 +2585,7 @@ term2::
|
|
2437
2585
|
|
2438
2586
|
A new paragraph.
|
2439
2587
|
EOS
|
2440
|
-
output =
|
2588
|
+
output = convert_string input
|
2441
2589
|
assert_xpath '//dl', output, 1
|
2442
2590
|
assert_xpath '//dl/dd', output, 2
|
2443
2591
|
assert_xpath '(//dl/dd)[1]/p[text() = "def1"]', output, 1
|
@@ -2450,6 +2598,19 @@ A new paragraph.
|
|
2450
2598
|
|
2451
2599
|
test 'should not match comment line that looks like description list term' do
|
2452
2600
|
input = <<-EOS
|
2601
|
+
before
|
2602
|
+
|
2603
|
+
//key:: val
|
2604
|
+
|
2605
|
+
after
|
2606
|
+
EOS
|
2607
|
+
|
2608
|
+
output = convert_string_to_embedded input
|
2609
|
+
assert_css 'dl', output, 0
|
2610
|
+
end
|
2611
|
+
|
2612
|
+
test 'should not match comment line following list that looks like description list term' do
|
2613
|
+
input = <<-EOS
|
2453
2614
|
* item
|
2454
2615
|
|
2455
2616
|
//::
|
@@ -2458,19 +2619,77 @@ A new paragraph.
|
|
2458
2619
|
section text
|
2459
2620
|
EOS
|
2460
2621
|
|
2461
|
-
output =
|
2622
|
+
output = convert_string_to_embedded input
|
2462
2623
|
assert_xpath '/*[@class="ulist"]', output, 1
|
2463
2624
|
assert_xpath '/*[@class="sect1"]', output, 1
|
2464
2625
|
assert_xpath '/*[@class="sect1"]/h2[text()="Section"]', output, 1
|
2465
2626
|
assert_xpath '/*[@class="ulist"]/following-sibling::*[@class="sect1"]', output, 1
|
2466
2627
|
end
|
2467
2628
|
|
2629
|
+
test 'should not match comment line that looks like sibling description list term' do
|
2630
|
+
input = <<-EOS
|
2631
|
+
before
|
2632
|
+
|
2633
|
+
foo:: bar
|
2634
|
+
//yin:: yang
|
2635
|
+
|
2636
|
+
after
|
2637
|
+
EOS
|
2638
|
+
|
2639
|
+
output = convert_string_to_embedded input
|
2640
|
+
assert_css '.dlist', output, 1
|
2641
|
+
assert_css '.dlist dt', output, 1
|
2642
|
+
refute_includes output, 'yin'
|
2643
|
+
end
|
2644
|
+
|
2645
|
+
test 'should not hang on description list item in list that begins with ///' do
|
2646
|
+
input = <<-EOS
|
2647
|
+
* x
|
2648
|
+
///::
|
2649
|
+
y
|
2650
|
+
EOS
|
2651
|
+
|
2652
|
+
output = convert_string_to_embedded input
|
2653
|
+
assert_css '.ulist', output, 1
|
2654
|
+
assert_css '.ulist .dlist', output, 1
|
2655
|
+
assert_xpath '//dt[text()="///"]', output, 1
|
2656
|
+
assert_xpath '//dd/p[text()="y"]', output, 1
|
2657
|
+
end
|
2658
|
+
|
2659
|
+
test 'should not hang on sibling description list item that begins with ///' do
|
2660
|
+
input = <<-EOS
|
2661
|
+
::
|
2662
|
+
///::
|
2663
|
+
y
|
2664
|
+
EOS
|
2665
|
+
|
2666
|
+
output = convert_string_to_embedded input
|
2667
|
+
assert_css '.dlist', output, 1
|
2668
|
+
assert_xpath '(//dl/dt)[1][not(text())]', output, 1
|
2669
|
+
assert_xpath '(//dl/dt)[2][text()="///"]', output, 1
|
2670
|
+
assert_xpath '//dl/dd/p[text()="y"]', output, 1
|
2671
|
+
end
|
2672
|
+
|
2673
|
+
test 'should skip dlist term that begins with // unless it begins with ///' do
|
2674
|
+
input = <<-EOS
|
2675
|
+
category a::
|
2676
|
+
//ignored term:: def
|
2677
|
+
|
2678
|
+
category b::
|
2679
|
+
///term:: def
|
2680
|
+
EOS
|
2681
|
+
|
2682
|
+
output = convert_string_to_embedded input
|
2683
|
+
refute_includes output, 'ignored term'
|
2684
|
+
assert_xpath '//dt[text()="///term"]', output, 1
|
2685
|
+
end
|
2686
|
+
|
2468
2687
|
test 'more than 4 consecutive colons should become part of description list term' do
|
2469
2688
|
input = <<-EOS
|
2470
2689
|
A term::::: a description
|
2471
2690
|
EOS
|
2472
2691
|
|
2473
|
-
output =
|
2692
|
+
output = convert_string_to_embedded input
|
2474
2693
|
assert_xpath '//dl', output, 1
|
2475
2694
|
assert_xpath '//dt', output, 1
|
2476
2695
|
assert_xpath '//dt[text()="A term:"]', output, 1
|
@@ -2488,6 +2707,30 @@ paragraph
|
|
2488
2707
|
dd = doc.blocks[0].items[0][1]
|
2489
2708
|
assert_nil dd.text
|
2490
2709
|
end
|
2710
|
+
|
2711
|
+
test 'should match trailing line separator in text of list item' do
|
2712
|
+
input = <<-EOS.chomp
|
2713
|
+
A:: a
|
2714
|
+
B:: b#{decode_char 8232}
|
2715
|
+
C:: c
|
2716
|
+
EOS
|
2717
|
+
|
2718
|
+
output = convert_string input
|
2719
|
+
assert_css 'dd', output, 3
|
2720
|
+
assert_xpath %((//dd)[2]/p[text()="b#{decode_char 8232}"]), output, 1
|
2721
|
+
end
|
2722
|
+
|
2723
|
+
test 'should match line separator in text of list item' do
|
2724
|
+
input = <<-EOS.chomp
|
2725
|
+
A:: a
|
2726
|
+
B:: b#{decode_char 8232}b
|
2727
|
+
C:: c
|
2728
|
+
EOS
|
2729
|
+
|
2730
|
+
output = convert_string input
|
2731
|
+
assert_css 'dd', output, 3
|
2732
|
+
assert_xpath %((//dd)[2]/p[text()="b#{decode_char 8232}b"]), output, 1
|
2733
|
+
end
|
2491
2734
|
end
|
2492
2735
|
|
2493
2736
|
context "Nested lists" do
|
@@ -2497,7 +2740,7 @@ term1:: def1
|
|
2497
2740
|
label1::: detail1
|
2498
2741
|
term2:: def2
|
2499
2742
|
EOS
|
2500
|
-
output =
|
2743
|
+
output = convert_string input
|
2501
2744
|
assert_xpath '//dl', output, 2
|
2502
2745
|
assert_xpath '//dl//dl', output, 1
|
2503
2746
|
assert_xpath '(//dl)[1]/dt[1][normalize-space(text()) = "term1"]', output, 1
|
@@ -2516,7 +2759,7 @@ name1:::: value1
|
|
2516
2759
|
item1;; price1
|
2517
2760
|
term2:: def2
|
2518
2761
|
EOS
|
2519
|
-
output =
|
2762
|
+
output = convert_string input
|
2520
2763
|
assert_xpath '//dl', output, 4
|
2521
2764
|
assert_xpath '//dl//dl//dl//dl', output, 1
|
2522
2765
|
end
|
@@ -2529,7 +2772,7 @@ label1::: detail1
|
|
2529
2772
|
|
2530
2773
|
term2:: def2
|
2531
2774
|
EOS
|
2532
|
-
output =
|
2775
|
+
output = convert_string input
|
2533
2776
|
assert_xpath '//dl', output, 2
|
2534
2777
|
assert_xpath '//dl//dl', output, 1
|
2535
2778
|
assert_xpath '(//dl)[1]/dt[1][normalize-space(text()) = "term1"]', output, 1
|
@@ -2548,7 +2791,7 @@ label1::: detail1
|
|
2548
2791
|
label2::: detail2
|
2549
2792
|
term2:: def2
|
2550
2793
|
EOS
|
2551
|
-
output =
|
2794
|
+
output = convert_string input
|
2552
2795
|
assert_xpath '//dl', output, 2
|
2553
2796
|
assert_xpath '//dl//dl', output, 1
|
2554
2797
|
assert_xpath '(//dl)[1]/dt[1][normalize-space(text()) = "term1"]', output, 1
|
@@ -2565,7 +2808,7 @@ term1:: def1
|
|
2565
2808
|
label1;; detail1
|
2566
2809
|
term2:: def2
|
2567
2810
|
EOS
|
2568
|
-
output =
|
2811
|
+
output = convert_string input
|
2569
2812
|
assert_xpath '//dl', output, 2
|
2570
2813
|
assert_xpath '//dl//dl', output, 1
|
2571
2814
|
assert_xpath '(//dl)[1]/dt[1][normalize-space(text()) = "term1"]', output, 1
|
@@ -2585,7 +2828,7 @@ detail1
|
|
2585
2828
|
term2::
|
2586
2829
|
def2
|
2587
2830
|
EOS
|
2588
|
-
output =
|
2831
|
+
output = convert_string input
|
2589
2832
|
assert_xpath '//dl', output, 2
|
2590
2833
|
assert_xpath '//dl//dl', output, 1
|
2591
2834
|
assert_xpath '(//dl)[1]/dt[1][normalize-space(text()) = "term1"]', output, 1
|
@@ -2608,7 +2851,7 @@ detail2
|
|
2608
2851
|
|
2609
2852
|
term2:: def2
|
2610
2853
|
EOS
|
2611
|
-
output =
|
2854
|
+
output = convert_string input
|
2612
2855
|
assert_xpath '//dl', output, 2
|
2613
2856
|
assert_xpath '//dl//dl', output, 1
|
2614
2857
|
assert_xpath '(//dl)[1]/dt[1][normalize-space(text()) = "term1"]', output, 1
|
@@ -2628,7 +2871,7 @@ term1::
|
|
2628
2871
|
term2::
|
2629
2872
|
def2
|
2630
2873
|
EOS
|
2631
|
-
output =
|
2874
|
+
output = convert_string input
|
2632
2875
|
assert_xpath '//dl', output, 2
|
2633
2876
|
assert_xpath '//dl//dl', output, 1
|
2634
2877
|
assert_xpath '(//dl)[1]/dt', output, 2
|
@@ -2649,7 +2892,7 @@ term1:: def1
|
|
2649
2892
|
detail1
|
2650
2893
|
term2:: def2
|
2651
2894
|
EOS
|
2652
|
-
output =
|
2895
|
+
output = convert_string input
|
2653
2896
|
assert_xpath '//dl', output, 2
|
2654
2897
|
assert_xpath '//dl//dl', output, 1
|
2655
2898
|
assert_xpath '(//dl)[1]/dt[1][normalize-space(text()) = "term1"]', output, 1
|
@@ -2667,7 +2910,7 @@ continued
|
|
2667
2910
|
label1:::
|
2668
2911
|
detail1
|
2669
2912
|
EOS
|
2670
|
-
output =
|
2913
|
+
output = convert_string input
|
2671
2914
|
assert_xpath '//dl', output, 2
|
2672
2915
|
assert_xpath '//dl//dl', output, 1
|
2673
2916
|
assert_xpath '(//dl)[1]/dt[1][normalize-space(text()) = "term1"]', output, 1
|
@@ -2679,13 +2922,13 @@ detail1
|
|
2679
2922
|
end
|
2680
2923
|
|
2681
2924
|
context 'Special lists' do
|
2682
|
-
test 'should
|
2925
|
+
test 'should convert glossary list with proper semantics' do
|
2683
2926
|
input = <<-EOS
|
2684
2927
|
[glossary]
|
2685
2928
|
term 1:: def 1
|
2686
2929
|
term 2:: def 2
|
2687
2930
|
EOS
|
2688
|
-
output =
|
2931
|
+
output = convert_string_to_embedded input
|
2689
2932
|
assert_css '.dlist.glossary', output, 1
|
2690
2933
|
assert_css '.dlist dt:not([class])', output, 2
|
2691
2934
|
end
|
@@ -2699,7 +2942,7 @@ description
|
|
2699
2942
|
|
2700
2943
|
last::
|
2701
2944
|
EOS
|
2702
|
-
output =
|
2945
|
+
output = convert_string_to_embedded input, :backend => 'docbook'
|
2703
2946
|
assert_xpath '/glossentry', output, 2
|
2704
2947
|
assert_xpath '(/glossentry)[1]/glossterm', output, 2
|
2705
2948
|
assert_xpath '(/glossentry)[2]/glossterm', output, 1
|
@@ -2707,7 +2950,7 @@ last::
|
|
2707
2950
|
assert_xpath '(/glossentry)[2]/glossdef[normalize-space(text())=""]', output, 1
|
2708
2951
|
end
|
2709
2952
|
|
2710
|
-
test 'should
|
2953
|
+
test 'should convert horizontal list with proper markup' do
|
2711
2954
|
input = <<-EOS
|
2712
2955
|
[horizontal]
|
2713
2956
|
first term:: description
|
@@ -2716,7 +2959,7 @@ more detail
|
|
2716
2959
|
|
2717
2960
|
second term:: description
|
2718
2961
|
EOS
|
2719
|
-
output =
|
2962
|
+
output = convert_string_to_embedded input
|
2720
2963
|
assert_css '.hdlist', output, 1
|
2721
2964
|
assert_css '.hdlist table', output, 1
|
2722
2965
|
assert_css '.hdlist table colgroup', output, 0
|
@@ -2741,7 +2984,7 @@ second term:: description
|
|
2741
2984
|
term:: def
|
2742
2985
|
EOS
|
2743
2986
|
|
2744
|
-
output =
|
2987
|
+
output = convert_string_to_embedded input
|
2745
2988
|
assert_css 'table', output, 1
|
2746
2989
|
assert_css 'table > colgroup', output, 1
|
2747
2990
|
assert_css 'table > colgroup > col', output, 2
|
@@ -2756,7 +2999,7 @@ term:: def
|
|
2756
2999
|
term:: def
|
2757
3000
|
EOS
|
2758
3001
|
|
2759
|
-
output =
|
3002
|
+
output = convert_string_to_embedded input, :backend => 'docbook'
|
2760
3003
|
assert_css 'informaltable', output, 1
|
2761
3004
|
assert_css 'informaltable > tgroup', output, 1
|
2762
3005
|
assert_css 'informaltable > tgroup > colspec', output, 2
|
@@ -2770,7 +3013,7 @@ term:: def
|
|
2770
3013
|
term:: def
|
2771
3014
|
EOS
|
2772
3015
|
|
2773
|
-
output =
|
3016
|
+
output = convert_string_to_embedded input
|
2774
3017
|
assert_css '.hdlist', output, 1
|
2775
3018
|
assert_css '.hdlist td.hdlist1.strong', output, 1
|
2776
3019
|
end
|
@@ -2784,7 +3027,7 @@ description
|
|
2784
3027
|
|
2785
3028
|
last::
|
2786
3029
|
EOS
|
2787
|
-
output =
|
3030
|
+
output = convert_string_to_embedded input
|
2788
3031
|
assert_xpath '//tr', output, 2
|
2789
3032
|
assert_xpath '(//tr)[1]/td[@class="hdlist1"]', output, 1
|
2790
3033
|
# NOTE I'm trimming the trailing <br> in Asciidoctor
|
@@ -2802,7 +3045,7 @@ description
|
|
2802
3045
|
|
2803
3046
|
last::
|
2804
3047
|
EOS
|
2805
|
-
output =
|
3048
|
+
output = convert_string_to_embedded input, :backend => 'docbook'
|
2806
3049
|
assert_xpath '//row', output, 2
|
2807
3050
|
assert_xpath '(//row)[1]/entry', output, 2
|
2808
3051
|
assert_xpath '((//row)[1]/entry)[1]/simpara', output, 2
|
@@ -2810,7 +3053,7 @@ last::
|
|
2810
3053
|
assert_xpath '((//row)[2]/entry)[2][normalize-space(text())=""]', output, 1
|
2811
3054
|
end
|
2812
3055
|
|
2813
|
-
test 'should
|
3056
|
+
test 'should convert horizontal list in docbook with proper markup' do
|
2814
3057
|
input = <<-EOS
|
2815
3058
|
.Terms
|
2816
3059
|
[horizontal]
|
@@ -2820,7 +3063,7 @@ more detail
|
|
2820
3063
|
|
2821
3064
|
second term:: description
|
2822
3065
|
EOS
|
2823
|
-
output =
|
3066
|
+
output = convert_string_to_embedded input, :backend => 'docbook'
|
2824
3067
|
assert_xpath '/table', output, 1
|
2825
3068
|
assert_xpath '/table[@tabstyle="horizontal"]', output, 1
|
2826
3069
|
assert_xpath '/table[@tabstyle="horizontal"]/title[text()="Terms"]', output, 1
|
@@ -2830,7 +3073,7 @@ second term:: description
|
|
2830
3073
|
assert_xpath '((/table//row)[1]/entry)[2]/simpara', output, 2
|
2831
3074
|
end
|
2832
3075
|
|
2833
|
-
test 'should
|
3076
|
+
test 'should convert qanda list in HTML with proper semantics' do
|
2834
3077
|
input = <<-EOS
|
2835
3078
|
[qanda]
|
2836
3079
|
Question 1::
|
@@ -2840,7 +3083,7 @@ Question 2::
|
|
2840
3083
|
+
|
2841
3084
|
NOTE: A note about Answer 2.
|
2842
3085
|
EOS
|
2843
|
-
output =
|
3086
|
+
output = convert_string_to_embedded input
|
2844
3087
|
assert_css '.qlist.qanda', output, 1
|
2845
3088
|
assert_css '.qanda > ol', output, 1
|
2846
3089
|
assert_css '.qanda > ol > li', output, 2
|
@@ -2854,7 +3097,7 @@ NOTE: A note about Answer 2.
|
|
2854
3097
|
assert_xpath "/*[@class = 'qlist qanda']/ol/li[2]/p[2]/following-sibling::div[@class='admonitionblock note']", output, 1
|
2855
3098
|
end
|
2856
3099
|
|
2857
|
-
test 'should
|
3100
|
+
test 'should convert qanda list in DocBook with proper semantics' do
|
2858
3101
|
input = <<-EOS
|
2859
3102
|
[qanda]
|
2860
3103
|
Question 1::
|
@@ -2864,7 +3107,7 @@ Question 2::
|
|
2864
3107
|
+
|
2865
3108
|
NOTE: A note about Answer 2.
|
2866
3109
|
EOS
|
2867
|
-
output =
|
3110
|
+
output = convert_string_to_embedded input, :backend => 'docbook'
|
2868
3111
|
assert_css 'qandaset', output, 1
|
2869
3112
|
assert_css 'qandaset > qandaentry', output, 2
|
2870
3113
|
(1..2).each do |idx|
|
@@ -2887,7 +3130,7 @@ response
|
|
2887
3130
|
|
2888
3131
|
last question::
|
2889
3132
|
EOS
|
2890
|
-
output =
|
3133
|
+
output = convert_string_to_embedded input, :backend => 'docbook'
|
2891
3134
|
assert_xpath '//qandaentry', output, 2
|
2892
3135
|
assert_xpath '(//qandaentry)[1]/question', output, 1
|
2893
3136
|
assert_xpath '(//qandaentry)[1]/question/simpara', output, 2
|
@@ -2896,7 +3139,7 @@ last question::
|
|
2896
3139
|
assert_xpath '(//qandaentry)[2]/answer[normalize-space(text())=""]', output, 1
|
2897
3140
|
end
|
2898
3141
|
|
2899
|
-
test 'should
|
3142
|
+
test 'should convert bibliography list with proper semantics' do
|
2900
3143
|
input = <<-EOS
|
2901
3144
|
[bibliography]
|
2902
3145
|
- [[[taoup]]] Eric Steven Raymond. 'The Art of Unix
|
@@ -2905,7 +3148,7 @@ last question::
|
|
2905
3148
|
'DocBook - The Definitive Guide'. O'Reilly & Associates. 1999.
|
2906
3149
|
ISBN 1-56592-580-7.
|
2907
3150
|
EOS
|
2908
|
-
output =
|
3151
|
+
output = convert_string_to_embedded input
|
2909
3152
|
assert_css '.ulist.bibliography', output, 1
|
2910
3153
|
assert_css '.ulist.bibliography ul', output, 1
|
2911
3154
|
assert_css '.ulist.bibliography ul li', output, 2
|
@@ -2916,7 +3159,7 @@ last question::
|
|
2916
3159
|
assert text.text.start_with?('[taoup] ')
|
2917
3160
|
end
|
2918
3161
|
|
2919
|
-
test 'should
|
3162
|
+
test 'should convert bibliography list with proper semantics to DocBook' do
|
2920
3163
|
input = <<-EOS
|
2921
3164
|
[bibliography]
|
2922
3165
|
- [[[taoup]]] Eric Steven Raymond. 'The Art of Unix
|
@@ -2925,7 +3168,7 @@ last question::
|
|
2925
3168
|
'DocBook - The Definitive Guide'. O'Reilly & Associates. 1999.
|
2926
3169
|
ISBN 1-56592-580-7.
|
2927
3170
|
EOS
|
2928
|
-
output =
|
3171
|
+
output = convert_string_to_embedded input, :backend => 'docbook'
|
2929
3172
|
assert_css 'bibliodiv', output, 1
|
2930
3173
|
assert_css 'bibliodiv > bibliomixed', output, 2
|
2931
3174
|
assert_css 'bibliodiv > bibliomixed > bibliomisc', output, 2
|
@@ -2944,7 +3187,7 @@ Addison-Wesley. 1997.
|
|
2944
3187
|
Addison-Wesley. 1997.
|
2945
3188
|
EOS
|
2946
3189
|
using_memory_logger do |logger|
|
2947
|
-
output =
|
3190
|
+
output = convert_string_to_embedded input
|
2948
3191
|
assert_css '.ulist.bibliography', output, 1
|
2949
3192
|
assert_css '.ulist.bibliography ul li:nth-child(1) p a#Fowler', output, 1
|
2950
3193
|
assert_css '.ulist.bibliography ul li:nth-child(2) p a#Fowler', output, 1
|
@@ -2980,7 +3223,7 @@ Addison-Wesley. 1997.
|
|
2980
3223
|
- [[[1984]]] George Orwell. '1984'. New American Library. 1950.
|
2981
3224
|
EOS
|
2982
3225
|
|
2983
|
-
output =
|
3226
|
+
output = convert_string_to_embedded input
|
2984
3227
|
assert_includes output, '[[[1984]]]'
|
2985
3228
|
assert_xpath '//a[@id="1984"]', output, 0
|
2986
3229
|
end
|
@@ -2991,7 +3234,7 @@ Addison-Wesley. 1997.
|
|
2991
3234
|
- [[[_1984]]] George Orwell. '1984'. New American Library. 1950.
|
2992
3235
|
EOS
|
2993
3236
|
|
2994
|
-
output =
|
3237
|
+
output = convert_string_to_embedded input
|
2995
3238
|
refute_includes output, '[[[_1984]]]'
|
2996
3239
|
assert_includes output, '[_1984]'
|
2997
3240
|
assert_xpath '//a[@id="_1984"]', output, 1
|
@@ -3045,7 +3288,7 @@ Please read #{'<<'}Fowler_1997>>.
|
|
3045
3288
|
* [[[Fowler_1997,1]]] Fowler M. _Analysis Patterns: Reusable Object Models_. Addison-Wesley. 1997.
|
3046
3289
|
EOS
|
3047
3290
|
|
3048
|
-
result =
|
3291
|
+
result = convert_string_to_embedded input, :backend => :docbook
|
3049
3292
|
assert_includes result, '<anchor xml:id="Fowler_1997" xreflabel="[1]"/>'
|
3050
3293
|
end
|
3051
3294
|
end
|
@@ -3063,7 +3306,7 @@ term1::
|
|
3063
3306
|
def1
|
3064
3307
|
EOS
|
3065
3308
|
|
3066
|
-
output =
|
3309
|
+
output = convert_string_to_embedded input
|
3067
3310
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3068
3311
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3069
3312
|
assert_xpath '//*[@class="dlist"]//dd/p[text()="def1"]', output, 1
|
@@ -3079,7 +3322,7 @@ term1::
|
|
3079
3322
|
def1
|
3080
3323
|
EOS
|
3081
3324
|
|
3082
|
-
output =
|
3325
|
+
output = convert_string_to_embedded input
|
3083
3326
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3084
3327
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3085
3328
|
assert_xpath '//*[@class="dlist"]//dd/p[text()="def1"]', output, 1
|
@@ -3095,7 +3338,7 @@ def1
|
|
3095
3338
|
term2:: def2
|
3096
3339
|
EOS
|
3097
3340
|
|
3098
|
-
output =
|
3341
|
+
output = convert_string_to_embedded input
|
3099
3342
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3100
3343
|
assert_xpath '//*[@class="dlist"]//dd', output, 2
|
3101
3344
|
assert_xpath '(//*[@class="dlist"]//dd)[1]/p[text()="def1"]', output, 1
|
@@ -3112,7 +3355,7 @@ def1
|
|
3112
3355
|
term2:: def2
|
3113
3356
|
EOS
|
3114
3357
|
|
3115
|
-
output =
|
3358
|
+
output = convert_string_to_embedded input
|
3116
3359
|
assert_css 'dl', output, 1
|
3117
3360
|
assert_css 'dl > dt', output, 2
|
3118
3361
|
assert_css 'dl > dd', output, 2
|
@@ -3128,7 +3371,7 @@ term1::
|
|
3128
3371
|
def1
|
3129
3372
|
EOS
|
3130
3373
|
|
3131
|
-
output =
|
3374
|
+
output = convert_string_to_embedded input
|
3132
3375
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3133
3376
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3134
3377
|
assert_xpath '//*[@class="dlist"]//dd/p[text()="def1"]', output, 1
|
@@ -3144,7 +3387,7 @@ term1::
|
|
3144
3387
|
def1
|
3145
3388
|
EOS
|
3146
3389
|
|
3147
|
-
output =
|
3390
|
+
output = convert_string_to_embedded input
|
3148
3391
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3149
3392
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3150
3393
|
assert_xpath '//*[@class="dlist"]//dd/p[text()="def1"]', output, 1
|
@@ -3158,7 +3401,7 @@ term1::
|
|
3158
3401
|
def1
|
3159
3402
|
EOS
|
3160
3403
|
|
3161
|
-
output =
|
3404
|
+
output = convert_string_to_embedded input
|
3162
3405
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3163
3406
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3164
3407
|
assert_xpath '//*[@class="dlist"]//dd/p[text()="def1"]', output, 1
|
@@ -3173,7 +3416,7 @@ term1::
|
|
3173
3416
|
def1
|
3174
3417
|
EOS
|
3175
3418
|
|
3176
|
-
output =
|
3419
|
+
output = convert_string_to_embedded input
|
3177
3420
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3178
3421
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3179
3422
|
assert_xpath '//*[@class="dlist"]//dd/p[text()="def1"]', output, 1
|
@@ -3188,7 +3431,7 @@ term1::
|
|
3188
3431
|
'''
|
3189
3432
|
EOS
|
3190
3433
|
|
3191
|
-
output =
|
3434
|
+
output = convert_string_to_embedded input
|
3192
3435
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3193
3436
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3194
3437
|
assert_xpath %(//*[@class="dlist"]//dd/p[text()="'''"]), output, 1
|
@@ -3204,7 +3447,7 @@ term1::
|
|
3204
3447
|
'''
|
3205
3448
|
EOS
|
3206
3449
|
|
3207
|
-
output =
|
3450
|
+
output = convert_string_to_embedded input
|
3208
3451
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3209
3452
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3210
3453
|
assert_xpath %(//*[@class="dlist"]//dd/p[text()="'''"]), output, 1
|
@@ -3220,7 +3463,7 @@ term1::
|
|
3220
3463
|
continued
|
3221
3464
|
EOS
|
3222
3465
|
|
3223
|
-
output =
|
3466
|
+
output = convert_string_to_embedded input
|
3224
3467
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3225
3468
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3226
3469
|
assert_xpath %(//*[@class="dlist"]//dd/p[normalize-space(text())="''' continued"]), output, 1
|
@@ -3235,7 +3478,7 @@ term1::
|
|
3235
3478
|
.def1
|
3236
3479
|
EOS
|
3237
3480
|
|
3238
|
-
output =
|
3481
|
+
output = convert_string_to_embedded input
|
3239
3482
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3240
3483
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3241
3484
|
assert_xpath '//*[@class="dlist"]//dd/p[text()=".def1"]', output, 1
|
@@ -3251,7 +3494,7 @@ term1::
|
|
3251
3494
|
.def1
|
3252
3495
|
EOS
|
3253
3496
|
|
3254
|
-
output =
|
3497
|
+
output = convert_string_to_embedded input
|
3255
3498
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3256
3499
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3257
3500
|
assert_xpath '//*[@class="dlist"]//dd/p[text()=".def1"]', output, 1
|
@@ -3266,7 +3509,7 @@ term1::
|
|
3266
3509
|
NOTE: def1
|
3267
3510
|
EOS
|
3268
3511
|
|
3269
|
-
output =
|
3512
|
+
output = convert_string_to_embedded input
|
3270
3513
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3271
3514
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3272
3515
|
assert_xpath '//*[@class="dlist"]//dd/p[text()="NOTE: def1"]', output, 1
|
@@ -3281,7 +3524,7 @@ term1::
|
|
3281
3524
|
== Another Section
|
3282
3525
|
EOS
|
3283
3526
|
|
3284
|
-
output =
|
3527
|
+
output = convert_string_to_embedded input
|
3285
3528
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3286
3529
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3287
3530
|
assert_xpath '//*[@class="dlist"]//dd/p[text()="== Another Section"]', output, 1
|
@@ -3302,7 +3545,7 @@ term1::
|
|
3302
3545
|
literal
|
3303
3546
|
EOS
|
3304
3547
|
|
3305
|
-
output =
|
3548
|
+
output = convert_string_to_embedded input
|
3306
3549
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3307
3550
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3308
3551
|
assert_xpath '//*[@class="dlist"]//dd/p[text()="def1"]', output, 1
|
@@ -3322,7 +3565,7 @@ def1
|
|
3322
3565
|
term2:: def2
|
3323
3566
|
EOS
|
3324
3567
|
|
3325
|
-
output =
|
3568
|
+
output = convert_string_to_embedded input
|
3326
3569
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3327
3570
|
assert_xpath '//*[@class="dlist"]//dd', output, 2
|
3328
3571
|
assert_xpath '(//*[@class="dlist"]//dd)[1]/p[text()="def1"]', output, 1
|
@@ -3339,7 +3582,7 @@ term1::
|
|
3339
3582
|
literal
|
3340
3583
|
EOS
|
3341
3584
|
|
3342
|
-
output =
|
3585
|
+
output = convert_string_to_embedded input
|
3343
3586
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3344
3587
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3345
3588
|
assert_xpath '//*[@class="dlist"]//dd/p', output, 0
|
@@ -3358,7 +3601,7 @@ term1::
|
|
3358
3601
|
'''
|
3359
3602
|
EOS
|
3360
3603
|
|
3361
|
-
output =
|
3604
|
+
output = convert_string_to_embedded input
|
3362
3605
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3363
3606
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3364
3607
|
assert_xpath '//*[@class="dlist"]//dd/p', output, 0
|
@@ -3378,7 +3621,7 @@ para
|
|
3378
3621
|
'''
|
3379
3622
|
EOS
|
3380
3623
|
|
3381
|
-
output =
|
3624
|
+
output = convert_string_to_embedded input
|
3382
3625
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3383
3626
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3384
3627
|
assert_xpath '//*[@class="dlist"]//dd/p', output, 0
|
@@ -3400,7 +3643,7 @@ literal
|
|
3400
3643
|
....
|
3401
3644
|
EOS
|
3402
3645
|
|
3403
|
-
output =
|
3646
|
+
output = convert_string_to_embedded input
|
3404
3647
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3405
3648
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3406
3649
|
assert_xpath '//*[@class="dlist"]//dd/p', output, 0
|
@@ -3424,7 +3667,7 @@ detached
|
|
3424
3667
|
....
|
3425
3668
|
EOS
|
3426
3669
|
|
3427
|
-
output =
|
3670
|
+
output = convert_string_to_embedded input
|
3428
3671
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3429
3672
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3430
3673
|
assert_xpath '//*[@class="dlist"]//dd/p', output, 0
|
@@ -3445,7 +3688,7 @@ term1::
|
|
3445
3688
|
* three
|
3446
3689
|
EOS
|
3447
3690
|
|
3448
|
-
output =
|
3691
|
+
output = convert_string_to_embedded input
|
3449
3692
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3450
3693
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3451
3694
|
assert_xpath '//*[@class="dlist"]//dd/p', output, 0
|
@@ -3464,7 +3707,7 @@ term1::
|
|
3464
3707
|
term2:: def2
|
3465
3708
|
EOS
|
3466
3709
|
|
3467
|
-
output =
|
3710
|
+
output = convert_string_to_embedded input
|
3468
3711
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3469
3712
|
assert_xpath '//*[@class="dlist"]//dd', output, 2
|
3470
3713
|
assert_xpath '(//*[@class="dlist"]//dd)[1]/p', output, 0
|
@@ -3487,7 +3730,7 @@ label 2::
|
|
3487
3730
|
|
3488
3731
|
paragraph
|
3489
3732
|
EOS
|
3490
|
-
output =
|
3733
|
+
output = convert_string_to_embedded input
|
3491
3734
|
assert_css '.dlist > dl', output, 1
|
3492
3735
|
assert_css '.dlist dt', output, 2
|
3493
3736
|
assert_xpath '(//*[@class="dlist"]//dt)[1][normalize-space(text())="label 1"]', output, 1
|
@@ -3515,7 +3758,7 @@ label 2::
|
|
3515
3758
|
|
3516
3759
|
paragraph
|
3517
3760
|
EOS
|
3518
|
-
output =
|
3761
|
+
output = convert_string_to_embedded input
|
3519
3762
|
assert_css '.dlist > dl', output, 1
|
3520
3763
|
assert_css '.dlist dt', output, 2
|
3521
3764
|
assert_xpath '(//*[@class="dlist"]//dt)[1][normalize-space(text())="label 1"]', output, 1
|
@@ -3542,7 +3785,7 @@ term1::
|
|
3542
3785
|
para
|
3543
3786
|
EOS
|
3544
3787
|
|
3545
|
-
output =
|
3788
|
+
output = convert_string_to_embedded input
|
3546
3789
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3547
3790
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3548
3791
|
assert_xpath '//*[@class="dlist"]//dd/p', output, 0
|
@@ -3565,7 +3808,7 @@ nested list para
|
|
3565
3808
|
term1 para
|
3566
3809
|
EOS
|
3567
3810
|
|
3568
|
-
output =
|
3811
|
+
output = convert_string_to_embedded input
|
3569
3812
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3570
3813
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3571
3814
|
assert_xpath '//*[@class="dlist"]//dd/p', output, 0
|
@@ -3589,7 +3832,7 @@ notnestedterm:::
|
|
3589
3832
|
notnestedterm:::
|
3590
3833
|
EOS
|
3591
3834
|
|
3592
|
-
output =
|
3835
|
+
output = convert_string_to_embedded input
|
3593
3836
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3594
3837
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3595
3838
|
assert_xpath '//*[@class="dlist"]//dd/p', output, 0
|
@@ -3606,7 +3849,7 @@ term1::
|
|
3606
3849
|
para
|
3607
3850
|
EOS
|
3608
3851
|
|
3609
|
-
output =
|
3852
|
+
output = convert_string_to_embedded input
|
3610
3853
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3611
3854
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3612
3855
|
assert_xpath '//*[@class="dlist"]//dd/p', output, 0
|
@@ -3622,7 +3865,7 @@ more description
|
|
3622
3865
|
not a term::: def
|
3623
3866
|
EOS
|
3624
3867
|
|
3625
|
-
output =
|
3868
|
+
output = convert_string_to_embedded input
|
3626
3869
|
assert_css '.dlist > dl > dt', output, 1
|
3627
3870
|
assert_css '.dlist > dl > dd', output, 1
|
3628
3871
|
assert_css '.dlist > dl > dd > .paragraph', output, 1
|
@@ -3639,7 +3882,7 @@ more description
|
|
3639
3882
|
not a term:: def
|
3640
3883
|
EOS
|
3641
3884
|
|
3642
|
-
output =
|
3885
|
+
output = convert_string_to_embedded input
|
3643
3886
|
assert_css '.dlist > dl > dt', output, 1
|
3644
3887
|
assert_css '.dlist > dl > dd', output, 1
|
3645
3888
|
assert_css '.dlist > dl > dd > .paragraph', output, 1
|
@@ -3656,7 +3899,7 @@ more description
|
|
3656
3899
|
not a term::: def
|
3657
3900
|
EOS
|
3658
3901
|
|
3659
|
-
output =
|
3902
|
+
output = convert_string_to_embedded input
|
3660
3903
|
assert_css '.dlist > dl > dt', output, 1
|
3661
3904
|
assert_css '.dlist > dl > dd', output, 1
|
3662
3905
|
assert_css '.dlist > dl > dd > .quoteblock', output, 1
|
@@ -3674,7 +3917,7 @@ term1::
|
|
3674
3917
|
para
|
3675
3918
|
EOS
|
3676
3919
|
|
3677
|
-
output =
|
3920
|
+
output = convert_string_to_embedded input
|
3678
3921
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3679
3922
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3680
3923
|
assert_xpath '//*[@class="dlist"]//dd/p', output, 0
|
@@ -3692,7 +3935,7 @@ term1::
|
|
3692
3935
|
para
|
3693
3936
|
EOS
|
3694
3937
|
|
3695
|
-
output =
|
3938
|
+
output = convert_string_to_embedded input
|
3696
3939
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3697
3940
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3698
3941
|
assert_xpath '//*[@class="dlist"]//dd/p', output, 0
|
@@ -3710,7 +3953,7 @@ detached
|
|
3710
3953
|
====
|
3711
3954
|
EOS
|
3712
3955
|
|
3713
|
-
output =
|
3956
|
+
output = convert_string_to_embedded input
|
3714
3957
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3715
3958
|
assert_xpath '//*[@class="dlist"]//dd', output, 0
|
3716
3959
|
assert_xpath '//*[@class="dlist"]/following-sibling::*[@class="exampleblock"]', output, 1
|
@@ -3726,7 +3969,7 @@ term1::
|
|
3726
3969
|
detached
|
3727
3970
|
EOS
|
3728
3971
|
|
3729
|
-
output =
|
3972
|
+
output = convert_string_to_embedded input
|
3730
3973
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3731
3974
|
assert_xpath '//*[@class="dlist"]//dd', output, 0
|
3732
3975
|
assert_xpath '//*[@class="dlist"]/following-sibling::*[@class="verseblock"]', output, 1
|
@@ -3742,7 +3985,7 @@ term1::
|
|
3742
3985
|
detached
|
3743
3986
|
EOS
|
3744
3987
|
|
3745
|
-
output =
|
3988
|
+
output = convert_string_to_embedded input
|
3746
3989
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3747
3990
|
assert_xpath '//*[@class="dlist"]//dd', output, 0
|
3748
3991
|
assert_xpath '//*[@class="dlist"]/following-sibling::*[@class="paragraph"]', output, 1
|
@@ -3760,7 +4003,7 @@ term1:: def1
|
|
3760
4003
|
continued
|
3761
4004
|
EOS
|
3762
4005
|
|
3763
|
-
output =
|
4006
|
+
output = convert_string_to_embedded input
|
3764
4007
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3765
4008
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3766
4009
|
assert_xpath %(//*[@class="dlist"]//dd/p[text()="def1\ncontinued"]), output, 1
|
@@ -3775,7 +4018,7 @@ continued
|
|
3775
4018
|
continued
|
3776
4019
|
EOS
|
3777
4020
|
|
3778
|
-
output =
|
4021
|
+
output = convert_string_to_embedded input
|
3779
4022
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3780
4023
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3781
4024
|
assert_xpath %(//*[@class="dlist"]//dd/p[text()="def1\ncontinued\ncontinued"]), output, 1
|
@@ -3790,7 +4033,7 @@ term1:: def1
|
|
3790
4033
|
continued
|
3791
4034
|
EOS
|
3792
4035
|
|
3793
|
-
output =
|
4036
|
+
output = convert_string_to_embedded input
|
3794
4037
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3795
4038
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3796
4039
|
assert_xpath %(//*[@class="dlist"]//dd/p[text()="def1\ncontinued"]), output, 1
|
@@ -3804,7 +4047,7 @@ term1:: def1
|
|
3804
4047
|
continued
|
3805
4048
|
EOS
|
3806
4049
|
|
3807
|
-
output =
|
4050
|
+
output = convert_string_to_embedded input
|
3808
4051
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3809
4052
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3810
4053
|
assert_xpath %(//*[@class="dlist"]//dd/p[text()="def1\ncontinued"]), output, 1
|
@@ -3819,7 +4062,7 @@ term1:: def1
|
|
3819
4062
|
literal
|
3820
4063
|
EOS
|
3821
4064
|
|
3822
|
-
output =
|
4065
|
+
output = convert_string_to_embedded input
|
3823
4066
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3824
4067
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3825
4068
|
assert_xpath '//*[@class="dlist"]//dd/p[text()="def1"]', output, 1
|
@@ -3838,7 +4081,7 @@ term1:: def1
|
|
3838
4081
|
para
|
3839
4082
|
EOS
|
3840
4083
|
|
3841
|
-
output =
|
4084
|
+
output = convert_string_to_embedded input
|
3842
4085
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3843
4086
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3844
4087
|
assert_xpath '//*[@class="dlist"]//dd/p[text()="def1"]', output, 1
|
@@ -3859,7 +4102,7 @@ para
|
|
3859
4102
|
literal
|
3860
4103
|
EOS
|
3861
4104
|
|
3862
|
-
output =
|
4105
|
+
output = convert_string_to_embedded input
|
3863
4106
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3864
4107
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3865
4108
|
assert_xpath '//*[@class="dlist"]//dd/p[text()="def1"]', output, 1
|
@@ -3880,7 +4123,7 @@ term1:: def1
|
|
3880
4123
|
* three
|
3881
4124
|
EOS
|
3882
4125
|
|
3883
|
-
output =
|
4126
|
+
output = convert_string_to_embedded input
|
3884
4127
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3885
4128
|
assert_xpath '//*[@class="dlist"]//dd/p[text()="def1"]', output, 1
|
3886
4129
|
assert_xpath '//*[@class="dlist"]//dd/p/following-sibling::*[@class="ulist"]', output, 1
|
@@ -3898,7 +4141,7 @@ term1:: def1
|
|
3898
4141
|
'''
|
3899
4142
|
EOS
|
3900
4143
|
|
3901
|
-
output =
|
4144
|
+
output = convert_string_to_embedded input
|
3902
4145
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3903
4146
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3904
4147
|
assert_xpath '//*[@class="dlist"]//dd/p[text()="def1"]', output, 1
|
@@ -3916,7 +4159,7 @@ term1:: def1
|
|
3916
4159
|
detached
|
3917
4160
|
EOS
|
3918
4161
|
|
3919
|
-
output =
|
4162
|
+
output = convert_string_to_embedded input
|
3920
4163
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3921
4164
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3922
4165
|
assert_xpath '//*[@class="dlist"]//dd/p[text()="def1"]', output, 1
|
@@ -3937,7 +4180,7 @@ Detached
|
|
3937
4180
|
~~~~~~~~
|
3938
4181
|
EOS
|
3939
4182
|
|
3940
|
-
output =
|
4183
|
+
output = convert_string_to_embedded input
|
3941
4184
|
assert_xpath '//*[@class="dlist"]/dl', output, 2
|
3942
4185
|
assert_xpath '//*[@class="dlist"]//dd', output, 2
|
3943
4186
|
assert_xpath '//*[@class="dlist"]/dl//dl', output, 1
|
@@ -3960,7 +4203,7 @@ para
|
|
3960
4203
|
detached
|
3961
4204
|
EOS
|
3962
4205
|
|
3963
|
-
output =
|
4206
|
+
output = convert_string_to_embedded input
|
3964
4207
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3965
4208
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3966
4209
|
assert_xpath '//*[@class="dlist"]//dd/p[text()="def1"]', output, 1
|
@@ -3983,7 +4226,7 @@ detached
|
|
3983
4226
|
****
|
3984
4227
|
EOS
|
3985
4228
|
|
3986
|
-
output =
|
4229
|
+
output = convert_string_to_embedded input
|
3987
4230
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
3988
4231
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
3989
4232
|
assert_xpath '//*[@class="dlist"]//dd/p[text()="def1"]', output, 1
|
@@ -4003,7 +4246,7 @@ term1:: def1
|
|
4003
4246
|
para
|
4004
4247
|
EOS
|
4005
4248
|
|
4006
|
-
output =
|
4249
|
+
output = convert_string_to_embedded input
|
4007
4250
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
4008
4251
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
4009
4252
|
assert_xpath '//*[@class="dlist"]//dd/p[text()="def1"]', output, 1
|
@@ -4021,7 +4264,7 @@ term1:: def1
|
|
4021
4264
|
para
|
4022
4265
|
EOS
|
4023
4266
|
|
4024
|
-
output =
|
4267
|
+
output = convert_string_to_embedded input
|
4025
4268
|
assert_xpath '//*[@class="dlist"]/dl', output, 1
|
4026
4269
|
assert_xpath '//*[@class="dlist"]//dd', output, 1
|
4027
4270
|
assert_xpath '//*[@class="dlist"]//dd/p[text()="def1"]', output, 1
|
@@ -4040,7 +4283,7 @@ term1:: def1
|
|
4040
4283
|
term2:: def2
|
4041
4284
|
EOS
|
4042
4285
|
|
4043
|
-
output =
|
4286
|
+
output = convert_string_to_embedded input
|
4044
4287
|
assert_xpath '//*[@class="dlist"]/dl', output, 2
|
4045
4288
|
end
|
4046
4289
|
|
@@ -4055,7 +4298,7 @@ term1:: def1
|
|
4055
4298
|
term2:: def2
|
4056
4299
|
EOS
|
4057
4300
|
|
4058
|
-
output =
|
4301
|
+
output = convert_string_to_embedded input
|
4059
4302
|
assert_xpath '//*[@class="dlist"]/dl', output, 2
|
4060
4303
|
end
|
4061
4304
|
|
@@ -4070,7 +4313,7 @@ term1:: def1
|
|
4070
4313
|
term2:: def2
|
4071
4314
|
EOS
|
4072
4315
|
|
4073
|
-
output =
|
4316
|
+
output = convert_string_to_embedded input
|
4074
4317
|
assert_xpath '//*[@class="dlist"]/dl', output, 2
|
4075
4318
|
assert_xpath '(//*[@class="dlist"])[2]/*[@class="title"][text()="title"]', output, 1
|
4076
4319
|
end
|
@@ -4078,6 +4321,18 @@ term2:: def2
|
|
4078
4321
|
end
|
4079
4322
|
|
4080
4323
|
context 'Callout lists' do
|
4324
|
+
test 'does not recognize callout list denoted by markers that only have a trailing bracket' do
|
4325
|
+
input = <<-EOS
|
4326
|
+
----
|
4327
|
+
require 'asciidoctor' # <1>
|
4328
|
+
----
|
4329
|
+
1> Not a callout list item
|
4330
|
+
EOS
|
4331
|
+
|
4332
|
+
output = convert_string_to_embedded input
|
4333
|
+
assert_css '.colist', output, 0
|
4334
|
+
end
|
4335
|
+
|
4081
4336
|
test 'listing block with sequential callouts followed by adjacent callout list' do
|
4082
4337
|
input = <<-EOS
|
4083
4338
|
[source, ruby]
|
@@ -4090,7 +4345,7 @@ puts doc.convert # <3>
|
|
4090
4345
|
<2> Describe the second line
|
4091
4346
|
<3> Describe the third line
|
4092
4347
|
EOS
|
4093
|
-
output =
|
4348
|
+
output = convert_string input, :attributes => {'backend' => 'docbook45'}
|
4094
4349
|
assert_xpath '//programlisting', output, 1
|
4095
4350
|
assert_xpath '//programlisting//co', output, 3
|
4096
4351
|
assert_xpath '(//programlisting//co)[1][@id = "CO1-1"]', output, 1
|
@@ -4117,7 +4372,7 @@ Paragraph.
|
|
4117
4372
|
<2> Describe the second line
|
4118
4373
|
<3> Describe the third line
|
4119
4374
|
EOS
|
4120
|
-
output =
|
4375
|
+
output = convert_string input, :attributes => {'backend' => 'docbook45'}
|
4121
4376
|
assert_xpath '//programlisting', output, 1
|
4122
4377
|
assert_xpath '//programlisting//co', output, 3
|
4123
4378
|
assert_xpath '(//programlisting//co)[1][@id = "CO1-1"]', output, 1
|
@@ -4141,7 +4396,7 @@ puts doc.convert # <2>
|
|
4141
4396
|
<1> Import the library
|
4142
4397
|
<2> Where the magic happens
|
4143
4398
|
EOS
|
4144
|
-
output =
|
4399
|
+
output = convert_string input, :attributes => {'backend' => 'docbook45'}
|
4145
4400
|
assert_xpath '//programlisting', output, 1
|
4146
4401
|
assert_xpath '//programlisting//co', output, 3
|
4147
4402
|
assert_xpath '(//programlisting//co)[1][@id = "CO1-1"]', output, 1
|
@@ -4164,7 +4419,7 @@ puts doc.convert # <1>
|
|
4164
4419
|
<2> Describe the second line
|
4165
4420
|
<3> Describe the third line
|
4166
4421
|
EOS
|
4167
|
-
output =
|
4422
|
+
output = convert_string input, :attributes => {'backend' => 'docbook45'}
|
4168
4423
|
assert_xpath '//programlisting', output, 1
|
4169
4424
|
assert_xpath '//programlisting//co', output, 3
|
4170
4425
|
assert_xpath '(//programlisting//co)[1][@id = "CO1-1"]', output, 1
|
@@ -4195,7 +4450,7 @@ puts doc.convert # <3>
|
|
4195
4450
|
<2> Describe the second line
|
4196
4451
|
<3> Describe the third line
|
4197
4452
|
EOS
|
4198
|
-
output =
|
4453
|
+
output = convert_string input, :attributes => {'backend' => 'docbook45'}
|
4199
4454
|
assert_xpath '//programlisting', output, 2
|
4200
4455
|
assert_xpath '(//programlisting)[1]//co', output, 1
|
4201
4456
|
assert_xpath '(//programlisting)[1]//co[@id = "CO1-1"]', output, 1
|
@@ -4225,7 +4480,7 @@ puts doc.convert # <2>
|
|
4225
4480
|
<1> Describe the second line
|
4226
4481
|
<2> Describe the third line
|
4227
4482
|
EOS
|
4228
|
-
output =
|
4483
|
+
output = convert_string input, :attributes => {'backend' => 'docbook45'}
|
4229
4484
|
assert_xpath '//programlisting', output, 2
|
4230
4485
|
assert_xpath '(//programlisting)[1]//co', output, 1
|
4231
4486
|
assert_xpath '(//programlisting)[1]//co[@id = "CO1-1"]', output, 1
|
@@ -4257,7 +4512,7 @@ as a RubyGem
|
|
4257
4512
|
+
|
4258
4513
|
You can write this to file rather than printing to stdout.
|
4259
4514
|
EOS
|
4260
|
-
output =
|
4515
|
+
output = convert_string_to_embedded input
|
4261
4516
|
assert_xpath '//ol/li', output, 3
|
4262
4517
|
assert_xpath %((//ol/li)[1]/p[text()="Imports the library\nas a RubyGem"]), output, 1
|
4263
4518
|
assert_xpath %((//ol/li)[2]//ul), output, 1
|
@@ -4282,7 +4537,7 @@ as a RubyGem
|
|
4282
4537
|
+
|
4283
4538
|
You can write this to file rather than printing to stdout.
|
4284
4539
|
EOS
|
4285
|
-
output =
|
4540
|
+
output = convert_string input, :attributes => {'backend' => 'docbook45'}
|
4286
4541
|
assert_xpath '//calloutlist', output, 1
|
4287
4542
|
assert_xpath '//calloutlist/callout', output, 3
|
4288
4543
|
assert_xpath '(//calloutlist/callout)[1]/*', output, 1
|
@@ -4294,13 +4549,39 @@ You can write this to file rather than printing to stdout.
|
|
4294
4549
|
|
4295
4550
|
test 'escaped callout should not be interpreted as a callout' do
|
4296
4551
|
input = <<-EOS
|
4297
|
-
[source,
|
4552
|
+
[source,text]
|
4298
4553
|
----
|
4299
4554
|
require 'asciidoctor' # \\<1>
|
4555
|
+
Asciidoctor.convert 'convert me!' \\<2>
|
4556
|
+
----
|
4557
|
+
EOS
|
4558
|
+
[{}, {'source-highlighter' => 'coderay'}].each do |attributes|
|
4559
|
+
output = convert_string_to_embedded input, :attributes => attributes
|
4560
|
+
assert_css 'pre b', output, 0
|
4561
|
+
assert_includes output, ' # <1>'
|
4562
|
+
assert_includes output, ' <2>'
|
4563
|
+
end
|
4564
|
+
end
|
4565
|
+
|
4566
|
+
test 'should autonumber <.> callouts' do
|
4567
|
+
input = <<-EOS
|
4568
|
+
[source, ruby]
|
4300
4569
|
----
|
4570
|
+
require 'asciidoctor' # <.>
|
4571
|
+
doc = Asciidoctor::Document.new('Hello, World!') # <.>
|
4572
|
+
puts doc.convert # <.>
|
4573
|
+
----
|
4574
|
+
<.> Describe the first line
|
4575
|
+
<.> Describe the second line
|
4576
|
+
<.> Describe the third line
|
4301
4577
|
EOS
|
4302
|
-
output =
|
4303
|
-
|
4578
|
+
output = convert_string_to_embedded input
|
4579
|
+
pre_html = (xmlnodes_at_css 'pre', output)[0].inner_html
|
4580
|
+
assert_includes pre_html, '(1)'
|
4581
|
+
assert_includes pre_html, '(2)'
|
4582
|
+
assert_includes pre_html, '(3)'
|
4583
|
+
assert_css '.colist ol', output, 1
|
4584
|
+
assert_css '.colist ol li', output, 3
|
4304
4585
|
end
|
4305
4586
|
|
4306
4587
|
test 'should not recognize callouts in middle of line' do
|
@@ -4310,7 +4591,7 @@ require 'asciidoctor' # \\<1>
|
|
4310
4591
|
puts "The syntax <1> at the end of the line makes a code callout"
|
4311
4592
|
----
|
4312
4593
|
EOS
|
4313
|
-
output =
|
4594
|
+
output = convert_string_to_embedded input
|
4314
4595
|
assert_xpath '//b', output, 0
|
4315
4596
|
end
|
4316
4597
|
|
@@ -4330,7 +4611,7 @@ exit 0
|
|
4330
4611
|
<5> Renders document to String
|
4331
4612
|
<6> Prints output to stdout
|
4332
4613
|
EOS
|
4333
|
-
output =
|
4614
|
+
output = convert_string_to_embedded input
|
4334
4615
|
assert_xpath '//code/b', output, 6
|
4335
4616
|
assert_match(/ <b class="conum">\(1\)<\/b>$/, output)
|
4336
4617
|
assert_match(/ <b class="conum">\(2\)<\/b> <b class="conum">\(3\)<\/b> <b class="conum">\(4\)<\/b>$/, output)
|
@@ -4349,7 +4630,7 @@ exit 0
|
|
4349
4630
|
<1> The title is required
|
4350
4631
|
<2> The content isn't
|
4351
4632
|
EOS
|
4352
|
-
output =
|
4633
|
+
output = convert_string_to_embedded input
|
4353
4634
|
assert_xpath '//b', output, 2
|
4354
4635
|
assert_xpath '//b[text()="(1)"]', output, 1
|
4355
4636
|
assert_xpath '//b[text()="(2)"]', output, 1
|
@@ -4362,7 +4643,7 @@ First line <1-->
|
|
4362
4643
|
Second line <2-->
|
4363
4644
|
----
|
4364
4645
|
EOS
|
4365
|
-
output =
|
4646
|
+
output = convert_string_to_embedded input
|
4366
4647
|
assert_xpath '//b', output, 0
|
4367
4648
|
end
|
4368
4649
|
|
@@ -4374,7 +4655,7 @@ foo::
|
|
4374
4655
|
<1> Not pointing to a callout
|
4375
4656
|
EOS
|
4376
4657
|
using_memory_logger do |logger|
|
4377
|
-
output =
|
4658
|
+
output = convert_string_to_embedded input
|
4378
4659
|
assert_xpath '//dl//b', output, 0
|
4379
4660
|
assert_xpath '//dl/dd/p[text()="bar <1>"]', output, 1
|
4380
4661
|
assert_xpath '//ol/li/p[text()="Not pointing to a callout"]', output, 1
|
@@ -4390,7 +4671,7 @@ foo::
|
|
4390
4671
|
<1> Not pointing to a callout
|
4391
4672
|
EOS
|
4392
4673
|
using_memory_logger do |logger|
|
4393
|
-
output =
|
4674
|
+
output = convert_string_to_embedded input
|
4394
4675
|
assert_xpath '//ul//b', output, 0
|
4395
4676
|
assert_xpath %(//ul/li/p[text()="foo\nbar <1>"]), output, 1
|
4396
4677
|
assert_xpath '//ol/li/p[text()="Not pointing to a callout"]', output, 1
|
@@ -4410,7 +4691,7 @@ Beans are fun.
|
|
4410
4691
|
<3> An actual bean.
|
4411
4692
|
EOS
|
4412
4693
|
using_memory_logger do |logger|
|
4413
|
-
output =
|
4694
|
+
output = convert_string_to_embedded input
|
4414
4695
|
assert_xpath '//ol/li', output, 2
|
4415
4696
|
assert_messages logger, [
|
4416
4697
|
[:WARN, '<stdin>: line 8: callout list item index: expected 2, got 3', Hash],
|
@@ -4419,7 +4700,7 @@ Beans are fun.
|
|
4419
4700
|
end
|
4420
4701
|
end
|
4421
4702
|
|
4422
|
-
test 'should
|
4703
|
+
test 'should preserve line comment chars that precede callout number if icons is not set' do
|
4423
4704
|
input = <<-EOS
|
4424
4705
|
[source,ruby]
|
4425
4706
|
----
|
@@ -4447,9 +4728,48 @@ main = putStrLn "Hello, World!" -- <1>
|
|
4447
4728
|
<1> Haskell
|
4448
4729
|
EOS
|
4449
4730
|
[{}, {'source-highlighter' => 'coderay'}].each do |attributes|
|
4450
|
-
output =
|
4731
|
+
output = convert_string_to_embedded input, :attributes => attributes
|
4451
4732
|
assert_xpath '//b', output, 4
|
4452
4733
|
nodes = xmlnodes_at_css 'pre', output
|
4734
|
+
assert_equal %(puts 'Hello, world!' # (1)), nodes[0].text
|
4735
|
+
assert_equal %(println 'Hello, world!' // (1)), nodes[1].text
|
4736
|
+
assert_equal %((def hello (fn [] "Hello, world!")) ;; (1)\n(hello)), nodes[2].text
|
4737
|
+
assert_equal %(main = putStrLn "Hello, World!" -- (1)), nodes[3].text
|
4738
|
+
end
|
4739
|
+
end
|
4740
|
+
|
4741
|
+
test 'should remove line comment chars that precede callout number if icons is font' do
|
4742
|
+
input = <<-EOS
|
4743
|
+
[source,ruby]
|
4744
|
+
----
|
4745
|
+
puts 'Hello, world!' # <1>
|
4746
|
+
----
|
4747
|
+
<1> Ruby
|
4748
|
+
|
4749
|
+
[source,groovy]
|
4750
|
+
----
|
4751
|
+
println 'Hello, world!' // <1>
|
4752
|
+
----
|
4753
|
+
<1> Groovy
|
4754
|
+
|
4755
|
+
[source,clojure]
|
4756
|
+
----
|
4757
|
+
(def hello (fn [] "Hello, world!")) ;; <1>
|
4758
|
+
(hello)
|
4759
|
+
----
|
4760
|
+
<1> Clojure
|
4761
|
+
|
4762
|
+
[source,haskell]
|
4763
|
+
----
|
4764
|
+
main = putStrLn "Hello, World!" -- <1>
|
4765
|
+
----
|
4766
|
+
<1> Haskell
|
4767
|
+
EOS
|
4768
|
+
[{}, {'source-highlighter' => 'coderay'}].each do |attributes|
|
4769
|
+
output = convert_string_to_embedded input, :attributes => attributes.merge({ 'icons' => 'font' })
|
4770
|
+
assert_css 'pre b', output, 4
|
4771
|
+
assert_css 'pre i.conum', output, 4
|
4772
|
+
nodes = xmlnodes_at_css 'pre', output
|
4453
4773
|
assert_equal %(puts 'Hello, world!' (1)), nodes[0].text
|
4454
4774
|
assert_equal %(println 'Hello, world!' (1)), nodes[1].text
|
4455
4775
|
assert_equal %((def hello (fn [] "Hello, world!")) (1)\n(hello)), nodes[2].text
|
@@ -4461,14 +4781,31 @@ main = putStrLn "Hello, World!" -- <1>
|
|
4461
4781
|
input = <<-EOS
|
4462
4782
|
[source,erlang,line-comment=%]
|
4463
4783
|
----
|
4464
|
-
hello_world() ->
|
4784
|
+
hello_world() -> % <1>
|
4785
|
+
io:fwrite("hello, world~n"). %<2>
|
4465
4786
|
----
|
4466
|
-
<1> Erlang
|
4787
|
+
<1> Erlang function clause head.
|
4788
|
+
<2> ~n adds a new line to the output.
|
4467
4789
|
EOS
|
4468
|
-
output =
|
4790
|
+
output = convert_string_to_embedded input
|
4791
|
+
assert_xpath '//b', output, 2
|
4792
|
+
nodes = xmlnodes_at_css 'pre', output
|
4793
|
+
assert_equal %(hello_world() -> % (1)\n io:fwrite("hello, world~n"). %(2)), nodes[0].text
|
4794
|
+
end
|
4795
|
+
|
4796
|
+
test 'should allow line comment chars preceding callout number to be configurable when source-highlighter is coderay' do
|
4797
|
+
input = <<-EOS
|
4798
|
+
[source,html,line-comment=-#]
|
4799
|
+
----
|
4800
|
+
-# <1>
|
4801
|
+
%p Hello
|
4802
|
+
----
|
4803
|
+
<1> Prints a paragraph with the text "Hello"
|
4804
|
+
EOS
|
4805
|
+
output = convert_string_to_embedded input, :attributes => { 'source-highlighter' => 'coderay' }
|
4469
4806
|
assert_xpath '//b', output, 1
|
4470
4807
|
nodes = xmlnodes_at_css 'pre', output
|
4471
|
-
assert_equal %(
|
4808
|
+
assert_equal %(-# (1)\n%p Hello), nodes[0].text
|
4472
4809
|
end
|
4473
4810
|
|
4474
4811
|
test 'literal block with callouts' do
|
@@ -4482,7 +4819,7 @@ Violets are blue <2>
|
|
4482
4819
|
<1> And so is Ruby
|
4483
4820
|
<2> But violet is more like purple
|
4484
4821
|
EOS
|
4485
|
-
output =
|
4822
|
+
output = convert_string input, :attributes => {'backend' => 'docbook45'}
|
4486
4823
|
assert_xpath '//literallayout', output, 1
|
4487
4824
|
assert_xpath '//literallayout//co', output, 2
|
4488
4825
|
assert_xpath '(//literallayout//co)[1][@id = "CO1-1"]', output, 1
|
@@ -4504,7 +4841,7 @@ puts doc.convert # <3>
|
|
4504
4841
|
<2> Describe the second line
|
4505
4842
|
<3> Describe the third line
|
4506
4843
|
EOS
|
4507
|
-
output =
|
4844
|
+
output = convert_string_to_embedded input, :attributes => {'icons' => ''}
|
4508
4845
|
assert_css '.listingblock code > img', output, 3
|
4509
4846
|
(1..3).each do |i|
|
4510
4847
|
assert_xpath %((/div[@class="listingblock"]//code/img)[#{i}][@src="./images/icons/callouts/#{i}.png"][@alt="#{i}"]), output, 1
|
@@ -4527,7 +4864,7 @@ puts doc.convert #<3>
|
|
4527
4864
|
<2> Describe the second line
|
4528
4865
|
<3> Describe the third line
|
4529
4866
|
EOS
|
4530
|
-
output =
|
4867
|
+
output = convert_string_to_embedded input, :attributes => {'icons' => 'font'}
|
4531
4868
|
assert_css '.listingblock code > i', output, 3
|
4532
4869
|
(1..3).each do |i|
|
4533
4870
|
assert_xpath %((/div[@class="listingblock"]//code/i)[#{i}]), output, 1
|
@@ -4541,6 +4878,40 @@ puts doc.convert #<3>
|
|
4541
4878
|
assert_xpath %((/div[@class="colist arabic"]//td/i)[#{i}]/following-sibling::b[text() = "#{i}"]), output, 1
|
4542
4879
|
end
|
4543
4880
|
end
|
4881
|
+
|
4882
|
+
test 'should match trailing line separator in text of list item' do
|
4883
|
+
input = <<-EOS.chomp
|
4884
|
+
----
|
4885
|
+
A <1>
|
4886
|
+
B <2>
|
4887
|
+
C <3>
|
4888
|
+
----
|
4889
|
+
<1> a
|
4890
|
+
<2> b#{decode_char 8232}
|
4891
|
+
<3> c
|
4892
|
+
EOS
|
4893
|
+
|
4894
|
+
output = convert_string input
|
4895
|
+
assert_css 'li', output, 3
|
4896
|
+
assert_xpath %((//li)[2]/p[text()="b#{decode_char 8232}"]), output, 1
|
4897
|
+
end
|
4898
|
+
|
4899
|
+
test 'should match line separator in text of list item' do
|
4900
|
+
input = <<-EOS.chomp
|
4901
|
+
----
|
4902
|
+
A <1>
|
4903
|
+
B <2>
|
4904
|
+
C <3>
|
4905
|
+
----
|
4906
|
+
<1> a
|
4907
|
+
<2> b#{decode_char 8232}b
|
4908
|
+
<3> c
|
4909
|
+
EOS
|
4910
|
+
|
4911
|
+
output = convert_string input
|
4912
|
+
assert_css 'li', output, 3
|
4913
|
+
assert_xpath %((//li)[2]/p[text()="b#{decode_char 8232}b"]), output, 1
|
4914
|
+
end
|
4544
4915
|
end
|
4545
4916
|
|
4546
4917
|
context 'Checklists' do
|
@@ -4579,7 +4950,7 @@ context 'Checklists' do
|
|
4579
4950
|
- plain
|
4580
4951
|
EOS
|
4581
4952
|
|
4582
|
-
output =
|
4953
|
+
output = convert_string_to_embedded input, :attributes => {'icons' => 'font'}
|
4583
4954
|
assert_css '.ulist.checklist', output, 1
|
4584
4955
|
assert_css '.ulist.checklist li i.fa-check-square-o', output, 1
|
4585
4956
|
assert_css '.ulist.checklist li i.fa-square-o', output, 1
|