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/sections_test.rb
CHANGED
@@ -11,6 +11,17 @@ context 'Sections' do
|
|
11
11
|
assert_equal '_section_one', sec.id
|
12
12
|
end
|
13
13
|
|
14
|
+
test 'duplicate synthetic id is automatically enumerated' do
|
15
|
+
doc = document_from_string <<-EOS
|
16
|
+
== Section One
|
17
|
+
|
18
|
+
== Section One
|
19
|
+
EOS
|
20
|
+
assert_equal 2, doc.blocks.size
|
21
|
+
assert_equal '_section_one', doc.blocks[0].id
|
22
|
+
assert_equal '_section_one_2', doc.blocks[1].id
|
23
|
+
end
|
24
|
+
|
14
25
|
test 'synthetic id removes non-word characters' do
|
15
26
|
sec = block_from_string("== We’re back!")
|
16
27
|
assert_equal '_were_back', sec.id
|
@@ -294,6 +305,28 @@ content
|
|
294
305
|
end
|
295
306
|
end
|
296
307
|
|
308
|
+
test 'should warn if explicit section ID matches auto-generated section ID' do
|
309
|
+
input = <<-EOS
|
310
|
+
== Do Not Repeat Yourself
|
311
|
+
|
312
|
+
content
|
313
|
+
|
314
|
+
[#_do_not_repeat_yourself]
|
315
|
+
== Do Not Repeat Yourself
|
316
|
+
|
317
|
+
content
|
318
|
+
EOS
|
319
|
+
|
320
|
+
using_memory_logger do |logger|
|
321
|
+
doc = document_from_string input
|
322
|
+
reftext = doc.catalog[:ids]['_do_not_repeat_yourself']
|
323
|
+
refute_nil reftext
|
324
|
+
assert_equal 'Do Not Repeat Yourself', reftext
|
325
|
+
assert_message logger, :WARN, '<stdin>: line 6: id assigned to section already in use: _do_not_repeat_yourself', Hash
|
326
|
+
assert_equal 2, (doc.convert.scan 'id="_do_not_repeat_yourself"').size
|
327
|
+
end
|
328
|
+
end
|
329
|
+
|
297
330
|
test 'duplicate block id should not overwrite existing section id entry in references table' do
|
298
331
|
input = <<-EOS
|
299
332
|
[#install]
|
@@ -319,22 +352,22 @@ content
|
|
319
352
|
test "document title with multiline syntax" do
|
320
353
|
title = "My Title"
|
321
354
|
chars = "=" * title.length
|
322
|
-
assert_xpath "//h1[not(@id)][text() = 'My Title']",
|
323
|
-
assert_xpath "//h1[not(@id)][text() = 'My Title']",
|
355
|
+
assert_xpath "//h1[not(@id)][text() = 'My Title']", convert_string(title + "\n" + chars)
|
356
|
+
assert_xpath "//h1[not(@id)][text() = 'My Title']", convert_string(title + "\n" + chars + "\n")
|
324
357
|
end
|
325
358
|
|
326
359
|
test "document title with multiline syntax, give a char" do
|
327
360
|
title = "My Title"
|
328
361
|
chars = "=" * (title.length + 1)
|
329
|
-
assert_xpath "//h1[not(@id)][text() = 'My Title']",
|
330
|
-
assert_xpath "//h1[not(@id)][text() = 'My Title']",
|
362
|
+
assert_xpath "//h1[not(@id)][text() = 'My Title']", convert_string(title + "\n" + chars)
|
363
|
+
assert_xpath "//h1[not(@id)][text() = 'My Title']", convert_string(title + "\n" + chars + "\n")
|
331
364
|
end
|
332
365
|
|
333
366
|
test "document title with multiline syntax, take a char" do
|
334
367
|
title = "My Title"
|
335
368
|
chars = "=" * (title.length - 1)
|
336
|
-
assert_xpath "//h1[not(@id)][text() = 'My Title']",
|
337
|
-
assert_xpath "//h1[not(@id)][text() = 'My Title']",
|
369
|
+
assert_xpath "//h1[not(@id)][text() = 'My Title']", convert_string(title + "\n" + chars)
|
370
|
+
assert_xpath "//h1[not(@id)][text() = 'My Title']", convert_string(title + "\n" + chars + "\n")
|
338
371
|
end
|
339
372
|
|
340
373
|
test 'document title with multiline syntax and unicode characters' do
|
@@ -346,7 +379,7 @@ Author Name
|
|
346
379
|
preamble
|
347
380
|
EOS
|
348
381
|
|
349
|
-
result =
|
382
|
+
result = convert_string input
|
350
383
|
assert_xpath '//h1', result, 1
|
351
384
|
assert_xpath '//h1[text()="AsciiDoc Writer’s Guide"]', result, 1
|
352
385
|
end
|
@@ -355,11 +388,11 @@ preamble
|
|
355
388
|
title = "My Title"
|
356
389
|
chars = "=" * (title.length - 2)
|
357
390
|
using_memory_logger do |logger|
|
358
|
-
output =
|
391
|
+
output = convert_string(title + "\n" + chars)
|
359
392
|
assert_xpath '//h1', output, 0
|
360
393
|
refute logger.empty?
|
361
394
|
logger.clear
|
362
|
-
output =
|
395
|
+
output = convert_string(title + "\n" + chars + "\n")
|
363
396
|
assert_xpath '//h1', output, 0
|
364
397
|
refute logger.empty?
|
365
398
|
end
|
@@ -369,11 +402,11 @@ preamble
|
|
369
402
|
title = "My Title"
|
370
403
|
chars = "=" * (title.length + 2)
|
371
404
|
using_memory_logger do |logger|
|
372
|
-
output =
|
405
|
+
output = convert_string(title + "\n" + chars)
|
373
406
|
assert_xpath '//h1', output, 0
|
374
407
|
refute logger.empty?
|
375
408
|
logger.clear
|
376
|
-
output =
|
409
|
+
output = convert_string(title + "\n" + chars + "\n")
|
377
410
|
assert_xpath '//h1', output, 0
|
378
411
|
refute logger.empty?
|
379
412
|
end
|
@@ -383,26 +416,26 @@ preamble
|
|
383
416
|
title = ".My Title"
|
384
417
|
chars = "=" * title.length
|
385
418
|
using_memory_logger do |logger|
|
386
|
-
output =
|
419
|
+
output = convert_string(title + "\n" + chars)
|
387
420
|
assert_xpath '//h1', output, 0
|
388
421
|
refute logger.empty?
|
389
422
|
end
|
390
423
|
end
|
391
424
|
|
392
425
|
test "document title with atx syntax" do
|
393
|
-
assert_xpath "//h1[not(@id)][text() = 'My Title']",
|
426
|
+
assert_xpath "//h1[not(@id)][text() = 'My Title']", convert_string("= My Title")
|
394
427
|
end
|
395
428
|
|
396
429
|
test "document title with symmetric syntax" do
|
397
|
-
assert_xpath "//h1[not(@id)][text() = 'My Title']",
|
430
|
+
assert_xpath "//h1[not(@id)][text() = 'My Title']", convert_string("= My Title =")
|
398
431
|
end
|
399
432
|
|
400
433
|
test 'document title created from leveloffset shift defined in document' do
|
401
|
-
assert_xpath "//h1[not(@id)][text() = 'Document Title']",
|
434
|
+
assert_xpath "//h1[not(@id)][text() = 'Document Title']", convert_string(%(:leveloffset: -1\n== Document Title))
|
402
435
|
end
|
403
436
|
|
404
437
|
test 'document title created from leveloffset shift defined in API' do
|
405
|
-
assert_xpath "//h1[not(@id)][text() = 'Document Title']",
|
438
|
+
assert_xpath "//h1[not(@id)][text() = 'Document Title']", convert_string('== Document Title', :attributes => { 'leveloffset' => '-1@' })
|
406
439
|
end
|
407
440
|
|
408
441
|
test 'should assign id on document title to body' do
|
@@ -412,7 +445,7 @@ preamble
|
|
412
445
|
|
413
446
|
content
|
414
447
|
EOS
|
415
|
-
output =
|
448
|
+
output = convert_string input
|
416
449
|
assert_css 'body#idname', output, 1
|
417
450
|
end
|
418
451
|
|
@@ -423,7 +456,7 @@ content
|
|
423
456
|
|
424
457
|
content
|
425
458
|
EOS
|
426
|
-
output =
|
459
|
+
output = convert_string input
|
427
460
|
assert_css 'body#idname', output, 1
|
428
461
|
end
|
429
462
|
|
@@ -434,7 +467,7 @@ content
|
|
434
467
|
|
435
468
|
content
|
436
469
|
EOS
|
437
|
-
output =
|
470
|
+
output = convert_string input
|
438
471
|
assert_css 'body#idname-block', output, 1
|
439
472
|
end
|
440
473
|
|
@@ -485,7 +518,7 @@ content
|
|
485
518
|
|
486
519
|
context "level 1" do
|
487
520
|
test "with multiline syntax" do
|
488
|
-
assert_xpath "//h2[@id='_my_section'][text() = 'My Section']",
|
521
|
+
assert_xpath "//h2[@id='_my_section'][text() = 'My Section']", convert_string("My Section\n-----------")
|
489
522
|
end
|
490
523
|
|
491
524
|
test 'should not recognize underline containing a mix of characters as setext section title' do
|
@@ -494,7 +527,7 @@ My Section
|
|
494
527
|
----^^----
|
495
528
|
EOS
|
496
529
|
|
497
|
-
result =
|
530
|
+
result = convert_string_to_embedded input
|
498
531
|
assert_xpath '//h2[@id="_my_section"][text() = "My Section"]', result, 0
|
499
532
|
assert_includes result, '----^^----'
|
500
533
|
end
|
@@ -506,7 +539,7 @@ ifdef::asciidoctor[]
|
|
506
539
|
-------------
|
507
540
|
endif::[]
|
508
541
|
EOS
|
509
|
-
result =
|
542
|
+
result = convert_string_to_embedded input
|
510
543
|
assert_xpath '//h2', result, 1
|
511
544
|
end
|
512
545
|
|
@@ -514,53 +547,53 @@ endif::[]
|
|
514
547
|
title = ".My Title"
|
515
548
|
chars = "-" * title.length
|
516
549
|
using_memory_logger do |logger|
|
517
|
-
output =
|
550
|
+
output = convert_string(title + "\n" + chars)
|
518
551
|
assert_xpath '//h2', output, 0
|
519
552
|
refute logger.empty?
|
520
553
|
end
|
521
554
|
end
|
522
555
|
|
523
556
|
test "with atx syntax" do
|
524
|
-
assert_xpath "//h2[@id='_my_title'][text() = 'My Title']",
|
557
|
+
assert_xpath "//h2[@id='_my_title'][text() = 'My Title']", convert_string("== My Title")
|
525
558
|
end
|
526
559
|
|
527
560
|
test "with atx symmetric syntax" do
|
528
|
-
assert_xpath "//h2[@id='_my_title'][text() = 'My Title']",
|
561
|
+
assert_xpath "//h2[@id='_my_title'][text() = 'My Title']", convert_string("== My Title ==")
|
529
562
|
end
|
530
563
|
|
531
564
|
test "with atx non-matching symmetric syntax" do
|
532
|
-
assert_xpath "//h2[@id='_my_title'][text() = 'My Title ===']",
|
565
|
+
assert_xpath "//h2[@id='_my_title'][text() = 'My Title ===']", convert_string("== My Title ===")
|
533
566
|
end
|
534
567
|
|
535
568
|
test "with XML entity" do
|
536
|
-
assert_xpath "//h2[@id='_whats_new'][text() = \"What#{decode_char 8217}s new?\"]",
|
569
|
+
assert_xpath "//h2[@id='_whats_new'][text() = \"What#{decode_char 8217}s new?\"]", convert_string("== What's new?")
|
537
570
|
end
|
538
571
|
|
539
572
|
test "with non-word character" do
|
540
|
-
assert_xpath "//h2[@id='_whats_new'][text() = \"What’s new?\"]",
|
573
|
+
assert_xpath "//h2[@id='_whats_new'][text() = \"What’s new?\"]", convert_string("== What’s new?")
|
541
574
|
end
|
542
575
|
|
543
576
|
test "with sequential non-word characters" do
|
544
|
-
assert_xpath "//h2[@id='_what_the_is_this'][text() = 'What the \#@$ is this?']",
|
577
|
+
assert_xpath "//h2[@id='_what_the_is_this'][text() = 'What the \#@$ is this?']", convert_string('== What the #@$ is this?')
|
545
578
|
end
|
546
579
|
|
547
580
|
test "with trailing whitespace" do
|
548
|
-
assert_xpath "//h2[@id='_my_title'][text() = 'My Title']",
|
581
|
+
assert_xpath "//h2[@id='_my_title'][text() = 'My Title']", convert_string("== My Title ")
|
549
582
|
end
|
550
583
|
|
551
584
|
test "with custom blank idprefix" do
|
552
|
-
assert_xpath "//h2[@id='my_title'][text() = 'My Title']",
|
585
|
+
assert_xpath "//h2[@id='my_title'][text() = 'My Title']", convert_string(":idprefix:\n\n== My Title ")
|
553
586
|
end
|
554
587
|
|
555
588
|
test "with custom non-blank idprefix" do
|
556
|
-
assert_xpath "//h2[@id='ref_my_title'][text() = 'My Title']",
|
589
|
+
assert_xpath "//h2[@id='ref_my_title'][text() = 'My Title']", convert_string(":idprefix: ref_\n\n== My Title ")
|
557
590
|
end
|
558
591
|
|
559
592
|
test 'with multibyte characters' do
|
560
593
|
input = <<-EOS
|
561
594
|
== Asciidoctor in 中文
|
562
595
|
EOS
|
563
|
-
output =
|
596
|
+
output = convert_string input
|
564
597
|
if ::RUBY_MIN_VERSION_1_9
|
565
598
|
assert_xpath '//h2[@id="_asciidoctor_in_中文"][text()="Asciidoctor in 中文"]', output
|
566
599
|
else
|
@@ -572,7 +605,7 @@ endif::[]
|
|
572
605
|
input = <<-EOS
|
573
606
|
== 视图
|
574
607
|
EOS
|
575
|
-
output =
|
608
|
+
output = convert_string_to_embedded input
|
576
609
|
assert_xpath '//h2[@id="_视图"][text()="视图"]', output
|
577
610
|
end if ::RUBY_MIN_VERSION_1_9
|
578
611
|
|
@@ -588,7 +621,7 @@ content
|
|
588
621
|
|
589
622
|
content
|
590
623
|
EOS
|
591
|
-
output =
|
624
|
+
output = convert_string_to_embedded input
|
592
625
|
assert_xpath '//h2[@id="_视图"][text()="视图"]', output
|
593
626
|
assert_xpath '//h2[@id="_连接器"][text()="连接器"]', output
|
594
627
|
end if ::RUBY_MIN_VERSION_1_9
|
@@ -596,37 +629,37 @@ content
|
|
596
629
|
|
597
630
|
context "level 2" do
|
598
631
|
test "with multiline syntax" do
|
599
|
-
assert_xpath "//h3[@id='_my_section'][text() = 'My Section']",
|
632
|
+
assert_xpath "//h3[@id='_my_section'][text() = 'My Section']", convert_string(":fragment:\nMy Section\n~~~~~~~~~~~")
|
600
633
|
end
|
601
634
|
|
602
635
|
test "with atx line syntax" do
|
603
|
-
assert_xpath "//h3[@id='_my_title'][text() = 'My Title']",
|
636
|
+
assert_xpath "//h3[@id='_my_title'][text() = 'My Title']", convert_string(":fragment:\n=== My Title")
|
604
637
|
end
|
605
638
|
end
|
606
639
|
|
607
640
|
context "level 3" do
|
608
641
|
test "with multiline syntax" do
|
609
|
-
assert_xpath "//h4[@id='_my_section'][text() = 'My Section']",
|
642
|
+
assert_xpath "//h4[@id='_my_section'][text() = 'My Section']", convert_string(":fragment:\nMy Section\n^^^^^^^^^^")
|
610
643
|
end
|
611
644
|
|
612
645
|
test "with atx line syntax" do
|
613
|
-
assert_xpath "//h4[@id='_my_title'][text() = 'My Title']",
|
646
|
+
assert_xpath "//h4[@id='_my_title'][text() = 'My Title']", convert_string(":fragment:\n==== My Title")
|
614
647
|
end
|
615
648
|
end
|
616
649
|
|
617
650
|
context "level 4" do
|
618
651
|
test "with multiline syntax" do
|
619
|
-
assert_xpath "//h5[@id='_my_section'][text() = 'My Section']",
|
652
|
+
assert_xpath "//h5[@id='_my_section'][text() = 'My Section']", convert_string(":fragment:\nMy Section\n++++++++++")
|
620
653
|
end
|
621
654
|
|
622
655
|
test "with atx line syntax" do
|
623
|
-
assert_xpath "//h5[@id='_my_title'][text() = 'My Title']",
|
656
|
+
assert_xpath "//h5[@id='_my_title'][text() = 'My Title']", convert_string(":fragment:\n===== My Title")
|
624
657
|
end
|
625
658
|
end
|
626
659
|
|
627
660
|
context "level 5" do
|
628
661
|
test "with atx line syntax" do
|
629
|
-
assert_xpath "//h6[@id='_my_title'][text() = 'My Title']",
|
662
|
+
assert_xpath "//h6[@id='_my_title'][text() = 'My Title']", convert_string(":fragment:\n====== My Title")
|
630
663
|
end
|
631
664
|
end
|
632
665
|
|
@@ -647,7 +680,7 @@ content
|
|
647
680
|
EOS
|
648
681
|
|
649
682
|
using_memory_logger do |logger|
|
650
|
-
result =
|
683
|
+
result = convert_string_to_embedded input
|
651
684
|
assert_xpath '//h4[text()="Nested Section"]', result, 1
|
652
685
|
assert_message logger, :WARN, '<stdin>: line 5: section title out of sequence: expected level 2, got level 3', Hash
|
653
686
|
end
|
@@ -664,7 +697,7 @@ content
|
|
664
697
|
EOS
|
665
698
|
|
666
699
|
using_memory_logger do |logger|
|
667
|
-
result =
|
700
|
+
result = convert_string_to_embedded input
|
668
701
|
assert_xpath '//h3[text()="Not a Chapter"]', result, 1
|
669
702
|
assert_message logger, :WARN, '<stdin>: line 4: section title out of sequence: expected levels 0 or 1, got level 2', Hash
|
670
703
|
end
|
@@ -680,7 +713,7 @@ content
|
|
680
713
|
EOS
|
681
714
|
|
682
715
|
using_memory_logger do |logger|
|
683
|
-
|
716
|
+
convert_string_to_embedded input, :attributes => { 'fragment' => '' }
|
684
717
|
assert logger.empty?
|
685
718
|
end
|
686
719
|
end
|
@@ -695,7 +728,7 @@ content
|
|
695
728
|
EOS
|
696
729
|
|
697
730
|
using_memory_logger do |logger|
|
698
|
-
|
731
|
+
convert_string_to_embedded input, :attributes => { 'fragment' => '' }
|
699
732
|
assert_message logger, :WARN, '<stdin>: line 5: section title out of sequence: expected level 3, got level 4', Hash
|
700
733
|
end
|
701
734
|
end
|
@@ -732,7 +765,7 @@ not allowed
|
|
732
765
|
EOS
|
733
766
|
|
734
767
|
using_memory_logger do |logger|
|
735
|
-
|
768
|
+
convert_string_to_embedded input
|
736
769
|
assert_messages logger, [
|
737
770
|
[:ERROR, '<stdin>: line 19: glossary sections do not support nested sections', Hash],
|
738
771
|
[:ERROR, '<stdin>: line 26: bibliography sections do not support nested sections', Hash],
|
@@ -804,7 +837,7 @@ not allowed
|
|
804
837
|
EOS
|
805
838
|
|
806
839
|
using_memory_logger do |logger|
|
807
|
-
|
840
|
+
convert_string_to_embedded input
|
808
841
|
assert_messages logger, [
|
809
842
|
[:ERROR, '<stdin>: line 14: colophon sections do not support nested sections', Hash],
|
810
843
|
[:ERROR, '<stdin>: line 21: dedication sections do not support nested sections', Hash],
|
@@ -820,7 +853,7 @@ not allowed
|
|
820
853
|
input = <<-EOS
|
821
854
|
# Document Title
|
822
855
|
EOS
|
823
|
-
output =
|
856
|
+
output = convert_string input
|
824
857
|
assert_xpath "//h1[not(@id)][text() = 'Document Title']", output, 1
|
825
858
|
end
|
826
859
|
|
@@ -828,7 +861,7 @@ not allowed
|
|
828
861
|
input = <<-EOS
|
829
862
|
# Document Title #
|
830
863
|
EOS
|
831
|
-
output =
|
864
|
+
output = convert_string input
|
832
865
|
assert_xpath "//h1[not(@id)][text() = 'Document Title']", output, 1
|
833
866
|
end
|
834
867
|
|
@@ -838,7 +871,7 @@ not allowed
|
|
838
871
|
|
839
872
|
blah blah
|
840
873
|
EOS
|
841
|
-
output =
|
874
|
+
output = convert_string input
|
842
875
|
assert_xpath "//h2[@id='_section_one'][text() = 'Section One']", output, 1
|
843
876
|
end
|
844
877
|
|
@@ -848,7 +881,7 @@ blah blah
|
|
848
881
|
|
849
882
|
blah blah
|
850
883
|
EOS
|
851
|
-
output =
|
884
|
+
output = convert_string input
|
852
885
|
assert_xpath "//h2[@id='_section_one'][text() = 'Section One']", output, 1
|
853
886
|
end
|
854
887
|
|
@@ -856,7 +889,7 @@ blah blah
|
|
856
889
|
input = <<-EOS
|
857
890
|
=#= My Title
|
858
891
|
EOS
|
859
|
-
output =
|
892
|
+
output = convert_string_to_embedded input
|
860
893
|
assert_xpath "//h3[@id='_my_title'][text() = 'My Title']", output, 0
|
861
894
|
assert_includes output, '<p>=#= My Title</p>'
|
862
895
|
end
|
@@ -871,7 +904,7 @@ blah blah
|
|
871
904
|
not in section
|
872
905
|
EOS
|
873
906
|
|
874
|
-
output =
|
907
|
+
output = convert_string_to_embedded input
|
875
908
|
assert_xpath '/h1[@id="_independent_heading"]', output, 1
|
876
909
|
assert_xpath '/h1[@class="float"]', output, 1
|
877
910
|
assert_xpath %(/h1[@class="float"][text()="Independent Heading!"]), output, 1
|
@@ -888,7 +921,7 @@ not in section
|
|
888
921
|
not in section
|
889
922
|
EOS
|
890
923
|
|
891
|
-
output =
|
924
|
+
output = convert_string_to_embedded input
|
892
925
|
assert_xpath '/h3', output, 1
|
893
926
|
assert_xpath '/h3[@id="_independent_heading"]', output, 1
|
894
927
|
assert_xpath '/h3[@class="discrete"]', output, 1
|
@@ -906,7 +939,7 @@ not in section
|
|
906
939
|
not in section
|
907
940
|
EOS
|
908
941
|
|
909
|
-
output =
|
942
|
+
output = convert_string_to_embedded input
|
910
943
|
assert_xpath '/h3', output, 1
|
911
944
|
assert_xpath '/h3[@class="discrete"][@id="_heading"]', output, 1
|
912
945
|
assert_xpath '/h3[@class="discrete"][@id="_heading"][text()=" Heading "]', output, 1
|
@@ -920,7 +953,7 @@ not in section
|
|
920
953
|
not in section
|
921
954
|
EOS
|
922
955
|
|
923
|
-
output =
|
956
|
+
output = convert_string_to_embedded input
|
924
957
|
assert_xpath '/h1[@id="first"]', output, 1
|
925
958
|
assert_xpath '/h1[@class="float independent"]', output, 1
|
926
959
|
assert_xpath %(/h1[@class="float independent"][text()="Independent Heading!"]), output, 1
|
@@ -937,7 +970,7 @@ not in section
|
|
937
970
|
not in section
|
938
971
|
EOS
|
939
972
|
|
940
|
-
output =
|
973
|
+
output = convert_string_to_embedded input
|
941
974
|
assert_xpath '/h1[@id="first"]', output, 1
|
942
975
|
assert_xpath '/h1[@class="discrete independent"]', output, 1
|
943
976
|
assert_xpath %(/h1[@class="discrete independent"][text()="Independent Heading!"]), output, 1
|
@@ -970,7 +1003,7 @@ ifdef::asciidoctor[]
|
|
970
1003
|
-------------
|
971
1004
|
endif::[]
|
972
1005
|
EOS
|
973
|
-
result =
|
1006
|
+
result = convert_string_to_embedded input
|
974
1007
|
assert_xpath '//h2', result, 1
|
975
1008
|
end
|
976
1009
|
|
@@ -1001,7 +1034,7 @@ not in section
|
|
1001
1034
|
== Section Two
|
1002
1035
|
EOS
|
1003
1036
|
|
1004
|
-
output =
|
1037
|
+
output = convert_string input
|
1005
1038
|
assert_xpath '//*[@id="toc"]', output, 1
|
1006
1039
|
assert_xpath %(//*[@id="toc"]//a[contains(text(), "Section ")]), output, 2
|
1007
1040
|
assert_xpath %(//*[@id="toc"]//a[text()="Miss Independent"]), output, 0
|
@@ -1015,7 +1048,7 @@ not in section
|
|
1015
1048
|
not in section
|
1016
1049
|
EOS
|
1017
1050
|
|
1018
|
-
output =
|
1051
|
+
output = convert_string_to_embedded input, :attributes => {'sectids' => nil}
|
1019
1052
|
assert_xpath '/h3', output, 1
|
1020
1053
|
assert_xpath '/h3[@id="_independent_heading"]', output, 0
|
1021
1054
|
assert_xpath '/h3[@class="float"]', output, 1
|
@@ -1030,7 +1063,7 @@ not in section
|
|
1030
1063
|
not in section
|
1031
1064
|
EOS
|
1032
1065
|
|
1033
|
-
output =
|
1066
|
+
output = convert_string_to_embedded input
|
1034
1067
|
assert_xpath '/h2', output, 1
|
1035
1068
|
assert_xpath '/h2[@id="free"]', output, 1
|
1036
1069
|
assert_xpath '/h2[@class="float"]', output, 1
|
@@ -1044,7 +1077,7 @@ not in section
|
|
1044
1077
|
not in section
|
1045
1078
|
EOS
|
1046
1079
|
|
1047
|
-
output =
|
1080
|
+
output = convert_string_to_embedded input
|
1048
1081
|
assert_xpath '/h2', output, 1
|
1049
1082
|
assert_xpath '/h2[@id="_independent_heading"]', output, 1
|
1050
1083
|
assert_xpath '/h2[@class="float isolated"]', output, 1
|
@@ -1126,7 +1159,7 @@ text in standalone
|
|
1126
1159
|
EOS
|
1127
1160
|
|
1128
1161
|
using_memory_logger do |logger|
|
1129
|
-
|
1162
|
+
convert_string input
|
1130
1163
|
assert_message logger, :ERROR, '<stdin>: line 7: level 0 sections can only be used when doctype is book', Hash
|
1131
1164
|
end
|
1132
1165
|
end
|
@@ -1160,7 +1193,7 @@ Master section text.
|
|
1160
1193
|
|
1161
1194
|
output = nil
|
1162
1195
|
using_memory_logger do |logger|
|
1163
|
-
output =
|
1196
|
+
output = convert_string input
|
1164
1197
|
assert logger.empty?
|
1165
1198
|
end
|
1166
1199
|
|
@@ -1182,7 +1215,7 @@ Doc Writer
|
|
1182
1215
|
= Discrete Heading
|
1183
1216
|
EOS
|
1184
1217
|
|
1185
|
-
output =
|
1218
|
+
output = convert_string input
|
1186
1219
|
assert_xpath '//h2[@class="float"][text() = "Discrete Heading"]', output, 1
|
1187
1220
|
end
|
1188
1221
|
|
@@ -1204,7 +1237,7 @@ Standalone preamble.
|
|
1204
1237
|
== Level 1 Section
|
1205
1238
|
EOS
|
1206
1239
|
|
1207
|
-
output =
|
1240
|
+
output = convert_string input
|
1208
1241
|
assert_xpath '//*[@class = "sect1"]/h2[text() = "Standalone Document"]', output, 1
|
1209
1242
|
assert_xpath '//*[@class = "sect1"]/h2[text() = "Level 1 Section"]', output, 1
|
1210
1243
|
end
|
@@ -1229,7 +1262,7 @@ content
|
|
1229
1262
|
content
|
1230
1263
|
EOS
|
1231
1264
|
|
1232
|
-
output =
|
1265
|
+
output = convert_string input
|
1233
1266
|
assert_xpath '//*[@class = "sect1"]/h2[text() = "Chapter 1"]', output, 1
|
1234
1267
|
assert_xpath '//*[@class = "sect2"]/h3[text() = "Standalone Section"]', output, 1
|
1235
1268
|
end
|
@@ -1286,7 +1319,7 @@ content
|
|
1286
1319
|
assert_equal '1:1:1', sect1_1_1.sectnum(':', false)
|
1287
1320
|
end
|
1288
1321
|
|
1289
|
-
test 'should
|
1322
|
+
test 'should output section numbers when sectnums attribute is set' do
|
1290
1323
|
input = <<-EOS
|
1291
1324
|
= Title
|
1292
1325
|
:sectnums:
|
@@ -1316,7 +1349,7 @@ text
|
|
1316
1349
|
text
|
1317
1350
|
EOS
|
1318
1351
|
|
1319
|
-
output =
|
1352
|
+
output = convert_string input
|
1320
1353
|
assert_xpath '//h2[@id="_section_1"][starts-with(text(), "1. ")]', output, 1
|
1321
1354
|
assert_xpath '//h3[@id="_section_1_1"][starts-with(text(), "1.1. ")]', output, 1
|
1322
1355
|
assert_xpath '//h4[@id="_section_1_1_1"][starts-with(text(), "1.1.1. ")]', output, 1
|
@@ -1325,7 +1358,7 @@ text
|
|
1325
1358
|
assert_xpath '//h3[@id="_section_2_2"][starts-with(text(), "2.2. ")]', output, 1
|
1326
1359
|
end
|
1327
1360
|
|
1328
|
-
test 'should
|
1361
|
+
test 'should output section numbers when numbered attribute is set' do
|
1329
1362
|
input = <<-EOS
|
1330
1363
|
= Title
|
1331
1364
|
:numbered:
|
@@ -1355,7 +1388,7 @@ text
|
|
1355
1388
|
text
|
1356
1389
|
EOS
|
1357
1390
|
|
1358
|
-
output =
|
1391
|
+
output = convert_string input
|
1359
1392
|
assert_xpath '//h2[@id="_section_1"][starts-with(text(), "1. ")]', output, 1
|
1360
1393
|
assert_xpath '//h3[@id="_section_1_1"][starts-with(text(), "1.1. ")]', output, 1
|
1361
1394
|
assert_xpath '//h4[@id="_section_1_1_1"][starts-with(text(), "1.1.1. ")]', output, 1
|
@@ -1364,6 +1397,24 @@ text
|
|
1364
1397
|
assert_xpath '//h3[@id="_section_2_2"][starts-with(text(), "2.2. ")]', output, 1
|
1365
1398
|
end
|
1366
1399
|
|
1400
|
+
test 'should not crash if child section of part is out of sequence and part numbering is disabled' do
|
1401
|
+
input = <<-EOS
|
1402
|
+
= Document Title
|
1403
|
+
:doctype: book
|
1404
|
+
:sectnums:
|
1405
|
+
|
1406
|
+
= Part
|
1407
|
+
|
1408
|
+
=== Out of Sequence Section
|
1409
|
+
EOS
|
1410
|
+
|
1411
|
+
using_memory_logger do |logger|
|
1412
|
+
output = convert_string input
|
1413
|
+
assert_xpath '//h1[text()="Part"]', output, 1
|
1414
|
+
assert_xpath '//h3[text()=".1. Out of Sequence Section"]', output, 1
|
1415
|
+
end
|
1416
|
+
end
|
1417
|
+
|
1367
1418
|
test 'should number parts when doctype is book and partnums attributes is set' do
|
1368
1419
|
input = <<-EOS
|
1369
1420
|
= Book Title
|
@@ -1384,9 +1435,61 @@ content
|
|
1384
1435
|
content
|
1385
1436
|
EOS
|
1386
1437
|
|
1387
|
-
output =
|
1388
|
-
assert_xpath '//h1[@id="_language"][text() = "I
|
1389
|
-
assert_xpath '//h1[@id="_processor"][text() = "II
|
1438
|
+
output = convert_string input
|
1439
|
+
assert_xpath '//h1[@id="_language"][text() = "I: Language"]', output, 1
|
1440
|
+
assert_xpath '//h1[@id="_processor"][text() = "II: Processor"]', output, 1
|
1441
|
+
end
|
1442
|
+
|
1443
|
+
test 'should prepend value of part-signifier attribute to title of numbered part' do
|
1444
|
+
input = <<-EOS
|
1445
|
+
= Book Title
|
1446
|
+
:doctype: book
|
1447
|
+
:sectnums:
|
1448
|
+
:partnums:
|
1449
|
+
:part-signifier: Part
|
1450
|
+
|
1451
|
+
= Language
|
1452
|
+
|
1453
|
+
== Syntax
|
1454
|
+
|
1455
|
+
content
|
1456
|
+
|
1457
|
+
= Processor
|
1458
|
+
|
1459
|
+
== CLI
|
1460
|
+
|
1461
|
+
content
|
1462
|
+
EOS
|
1463
|
+
|
1464
|
+
output = convert_string input
|
1465
|
+
assert_xpath '//h1[@id="_language"][text() = "Part I: Language"]', output, 1
|
1466
|
+
assert_xpath '//h1[@id="_processor"][text() = "Part II: Processor"]', output, 1
|
1467
|
+
end
|
1468
|
+
|
1469
|
+
test 'should prepend value of chapter-signifier attribute to title of numbered chapter' do
|
1470
|
+
input = <<-EOS
|
1471
|
+
= Book Title
|
1472
|
+
:doctype: book
|
1473
|
+
:sectnums:
|
1474
|
+
:partnums:
|
1475
|
+
:chapter-signifier: Chapter
|
1476
|
+
|
1477
|
+
= Language
|
1478
|
+
|
1479
|
+
== Syntax
|
1480
|
+
|
1481
|
+
content
|
1482
|
+
|
1483
|
+
= Processor
|
1484
|
+
|
1485
|
+
== CLI
|
1486
|
+
|
1487
|
+
content
|
1488
|
+
EOS
|
1489
|
+
|
1490
|
+
output = convert_string input
|
1491
|
+
assert_xpath '//h2[@id="_syntax"][text() = "Chapter 1. Syntax"]', output, 1
|
1492
|
+
assert_xpath '//h2[@id="_cli"][text() = "Chapter 2. CLI"]', output, 1
|
1390
1493
|
end
|
1391
1494
|
|
1392
1495
|
test 'blocks should have level' do
|
@@ -1435,7 +1538,7 @@ paragraph
|
|
1435
1538
|
== Section Three
|
1436
1539
|
EOS
|
1437
1540
|
|
1438
|
-
output =
|
1541
|
+
output = convert_string input
|
1439
1542
|
assert_xpath '//h1[text()="Document Title"]', output, 1
|
1440
1543
|
assert_xpath '//h2[@id="_colophon_section"][text()="Colophon Section"]', output, 1
|
1441
1544
|
assert_xpath '//h2[@id="_another_colophon_section"][text()="Another Colophon Section"]', output, 1
|
@@ -1469,7 +1572,7 @@ paragraph
|
|
1469
1572
|
== Section Three
|
1470
1573
|
EOS
|
1471
1574
|
|
1472
|
-
output =
|
1575
|
+
output = convert_string input, :attributes => {'numbered' => ''}
|
1473
1576
|
assert_xpath '//h1[text()="Document Title"]', output, 1
|
1474
1577
|
assert_xpath '//h2[@id="_colophon_section"][text()="Colophon Section"]', output, 1
|
1475
1578
|
assert_xpath '//h2[@id="_another_colophon_section"][text()="Another Colophon Section"]', output, 1
|
@@ -1503,7 +1606,7 @@ paragraph
|
|
1503
1606
|
== Section Three
|
1504
1607
|
EOS
|
1505
1608
|
|
1506
|
-
output =
|
1609
|
+
output = convert_string input, :attributes => {'numbered!' => ''}
|
1507
1610
|
assert_xpath '//h1[text()="Document Title"]', output, 1
|
1508
1611
|
assert_xpath '//h2[@id="_colophon_section"][text()="Colophon Section"]', output, 1
|
1509
1612
|
assert_xpath '//h2[@id="_another_colophon_section"][text()="Another Colophon Section"]', output, 1
|
@@ -1537,7 +1640,7 @@ paragraph
|
|
1537
1640
|
== Section Three
|
1538
1641
|
EOS
|
1539
1642
|
|
1540
|
-
output =
|
1643
|
+
output = convert_string input
|
1541
1644
|
assert_xpath '//h1[text()="Document Title"]', output, 1
|
1542
1645
|
assert_xpath '//h2[@id="_colophon_section"][text()="Colophon Section"]', output, 1
|
1543
1646
|
assert_xpath '//h2[@id="_another_colophon_section"][text()="Another Colophon Section"]', output, 1
|
@@ -1566,7 +1669,7 @@ a|content
|
|
1566
1669
|
content
|
1567
1670
|
EOS
|
1568
1671
|
|
1569
|
-
output =
|
1672
|
+
output = convert_string input
|
1570
1673
|
assert_xpath '//h2[@id="_section_one"]', output, 1
|
1571
1674
|
assert_xpath '//h2[@id="_section_one"][text()="1. Section One"]', output, 1
|
1572
1675
|
assert_xpath '//h2[@id="_section_two"]', output, 1
|
@@ -1592,7 +1695,7 @@ content
|
|
1592
1695
|
content
|
1593
1696
|
EOS
|
1594
1697
|
|
1595
|
-
output =
|
1698
|
+
output = convert_string input
|
1596
1699
|
assert_xpath '(//h1)[1][text()="Document Title"]', output, 1
|
1597
1700
|
assert_xpath '(//h1)[2][text()="Part 1"]', output, 1
|
1598
1701
|
assert_xpath '(//h1)[3][text()="Part 2"]', output, 1
|
@@ -1627,7 +1730,7 @@ content
|
|
1627
1730
|
content
|
1628
1731
|
EOS
|
1629
1732
|
|
1630
|
-
result =
|
1733
|
+
result = convert_string input
|
1631
1734
|
(1..4).each do |num|
|
1632
1735
|
assert_xpath %(//h2[@id="_chapter_#{num}"]), result, 1
|
1633
1736
|
assert_xpath %(//h2[@id="_chapter_#{num}"][text()="#{num}. Chapter #{num}"]), result, 1
|
@@ -1654,9 +1757,27 @@ content
|
|
1654
1757
|
sections = doc.sections
|
1655
1758
|
[0, 1, 2].each do |index|
|
1656
1759
|
assert_equal index, sections[index].index
|
1760
|
+
assert_equal index + 1, sections[index].numeral
|
1657
1761
|
assert_equal index + 1, sections[index].number
|
1658
1762
|
end
|
1659
1763
|
end
|
1764
|
+
|
1765
|
+
test 'should allow sections to be renumbered using deprecated number property' do
|
1766
|
+
input = <<-EOS
|
1767
|
+
== Somewhere in the Middle
|
1768
|
+
|
1769
|
+
== The End
|
1770
|
+
EOS
|
1771
|
+
|
1772
|
+
doc = document_from_string input, :attributes => { 'sectnums' => '' }
|
1773
|
+
doc.sections.each do |sect|
|
1774
|
+
sect.number += 1
|
1775
|
+
end
|
1776
|
+
|
1777
|
+
output = doc.convert :header_footer => false
|
1778
|
+
assert_xpath '//h2[text()="2. Somewhere in the Middle"]', output, 1
|
1779
|
+
assert_xpath '//h2[text()="3. The End"]', output, 1
|
1780
|
+
end
|
1660
1781
|
end
|
1661
1782
|
|
1662
1783
|
context 'Links and anchors' do
|
@@ -1671,7 +1792,7 @@ Installation section.
|
|
1671
1792
|
Linux installation instructions.
|
1672
1793
|
EOS
|
1673
1794
|
|
1674
|
-
output =
|
1795
|
+
output = convert_string_to_embedded input, :attributes => {'sectanchors' => ''}
|
1675
1796
|
assert_xpath '/*[@class="sect1"]/h2[@id="_installation"]/a', output, 1
|
1676
1797
|
assert_xpath '/*[@class="sect1"]/h2[@id="_installation"]/a[@class="anchor"][@href="#_installation"]', output, 1
|
1677
1798
|
assert_xpath '/*[@class="sect1"]/h2[@id="_installation"]/a/following-sibling::text()="Installation"', output, true
|
@@ -1691,7 +1812,7 @@ Installation section.
|
|
1691
1812
|
Linux installation instructions.
|
1692
1813
|
EOS
|
1693
1814
|
|
1694
|
-
output =
|
1815
|
+
output = convert_string_to_embedded input, :attributes => {'sectanchors' => 'after'}
|
1695
1816
|
assert_xpath '/*[@class="sect1"]/h2[@id="_installation"]/a', output, 1
|
1696
1817
|
assert_xpath '/*[@class="sect1"]/h2[@id="_installation"]/a[@class="anchor"][@href="#_installation"]', output, 1
|
1697
1818
|
assert_xpath '/*[@class="sect1"]/h2[@id="_installation"]/a/preceding-sibling::text()="Installation"', output, true
|
@@ -1711,7 +1832,7 @@ Installation section.
|
|
1711
1832
|
Linux installation instructions.
|
1712
1833
|
EOS
|
1713
1834
|
|
1714
|
-
output =
|
1835
|
+
output = convert_string_to_embedded input, :attributes => {'sectlinks' => ''}
|
1715
1836
|
assert_xpath '/*[@class="sect1"]/h2[@id="_installation"]/a', output, 1
|
1716
1837
|
assert_xpath '/*[@class="sect1"]/h2[@id="_installation"]/a[@class="link"][@href="#_installation"]', output, 1
|
1717
1838
|
assert_xpath '/*[@class="sect1"]/h2[@id="_installation"]/a[text()="Installation"]', output, 1
|
@@ -1733,6 +1854,7 @@ Details
|
|
1733
1854
|
appendix = block_from_string input
|
1734
1855
|
assert_equal 'appendix', appendix.sectname
|
1735
1856
|
assert_equal 'Appendix A: ', appendix.caption
|
1857
|
+
assert_equal 'A', appendix.numeral
|
1736
1858
|
assert_equal 'A', appendix.number
|
1737
1859
|
assert_equal true, appendix.numbered
|
1738
1860
|
end
|
@@ -1745,7 +1867,7 @@ Details
|
|
1745
1867
|
Details
|
1746
1868
|
EOS
|
1747
1869
|
|
1748
|
-
output =
|
1870
|
+
output = convert_string_to_embedded input
|
1749
1871
|
assert_xpath '//h2[text()="Appendix A: Attribute Options"]', output, 1
|
1750
1872
|
end
|
1751
1873
|
|
@@ -1758,7 +1880,7 @@ Details
|
|
1758
1880
|
Details
|
1759
1881
|
EOS
|
1760
1882
|
|
1761
|
-
output =
|
1883
|
+
output = convert_string_to_embedded input
|
1762
1884
|
assert_xpath '//h2[text()="Appendix A: Attribute Options"]', output, 1
|
1763
1885
|
end
|
1764
1886
|
|
@@ -1771,7 +1893,7 @@ Details
|
|
1771
1893
|
Details
|
1772
1894
|
EOS
|
1773
1895
|
|
1774
|
-
output =
|
1896
|
+
output = convert_string_to_embedded input
|
1775
1897
|
assert_xpath '//h2[@id="attribute-options"][text()="Appendix A: Attribute Options"]', output, 1
|
1776
1898
|
end
|
1777
1899
|
|
@@ -1785,7 +1907,7 @@ Details
|
|
1785
1907
|
Details
|
1786
1908
|
EOS
|
1787
1909
|
|
1788
|
-
output =
|
1910
|
+
output = convert_string_to_embedded input
|
1789
1911
|
assert_xpath '//h2[text()="App A: Attribute Options"]', output, 1
|
1790
1912
|
end
|
1791
1913
|
|
@@ -1800,7 +1922,7 @@ Details
|
|
1800
1922
|
Details
|
1801
1923
|
EOS
|
1802
1924
|
|
1803
|
-
output =
|
1925
|
+
output = convert_string_to_embedded input
|
1804
1926
|
assert_xpath '//h2[text()="A. Attribute Options"]', output, 1
|
1805
1927
|
end
|
1806
1928
|
|
@@ -1817,7 +1939,7 @@ Details
|
|
1817
1939
|
Details
|
1818
1940
|
EOS
|
1819
1941
|
|
1820
|
-
output =
|
1942
|
+
output = convert_string_to_embedded input
|
1821
1943
|
assert_xpath '(//h2)[1][text()="Appendix A: Attribute Options"]', output, 1
|
1822
1944
|
assert_xpath '(//h2)[2][text()="Appendix B: Migration"]', output, 1
|
1823
1945
|
end
|
@@ -1840,7 +1962,7 @@ content
|
|
1840
1962
|
content
|
1841
1963
|
EOS
|
1842
1964
|
|
1843
|
-
output =
|
1965
|
+
output = convert_string_to_embedded input
|
1844
1966
|
assert_xpath '(//h2)[1][text()="1. First Section"]', output, 1
|
1845
1967
|
assert_xpath '(//h2)[2][text()="Appendix A: Attribute Options"]', output, 1
|
1846
1968
|
assert_xpath '(//h2)[3][text()="2. Migration"]', output, 1
|
@@ -1860,7 +1982,7 @@ Details
|
|
1860
1982
|
Details
|
1861
1983
|
EOS
|
1862
1984
|
|
1863
|
-
output =
|
1985
|
+
output = convert_string_to_embedded input
|
1864
1986
|
assert_xpath '(//h2)[1][text()="Appendix A: Attribute Options"]', output, 1
|
1865
1987
|
assert_xpath '(//h3)[1][text()="A.1. Optional Attributes"]', output, 1
|
1866
1988
|
end
|
@@ -1879,7 +2001,7 @@ Details
|
|
1879
2001
|
|
1880
2002
|
text
|
1881
2003
|
EOS
|
1882
|
-
output =
|
2004
|
+
output = convert_string_to_embedded input
|
1883
2005
|
assert_xpath '//h5', output, 1
|
1884
2006
|
assert_xpath '//h5[text()="Level_4"]', output, 1
|
1885
2007
|
end
|
@@ -1899,7 +2021,7 @@ text
|
|
1899
2021
|
|
1900
2022
|
text
|
1901
2023
|
EOS
|
1902
|
-
output =
|
2024
|
+
output = convert_string_to_embedded input
|
1903
2025
|
assert_xpath '//h2', output, 1
|
1904
2026
|
assert_xpath '//h2[text()="1. Level_1"]', output, 1
|
1905
2027
|
assert_xpath '//h3', output, 1
|
@@ -1938,7 +2060,7 @@ Details
|
|
1938
2060
|
Terms
|
1939
2061
|
EOS
|
1940
2062
|
|
1941
|
-
output =
|
2063
|
+
output = convert_string_to_embedded input
|
1942
2064
|
assert_xpath '(//h2)[1][text()="1. Section One"]', output, 1
|
1943
2065
|
assert_xpath '(//h2)[2][text()="Appendix A: Attribute Options"]', output, 1
|
1944
2066
|
assert_xpath '(//h2)[3][text()="Appendix B: Migration"]', output, 1
|
@@ -1975,7 +2097,7 @@ Details
|
|
1975
2097
|
Terms
|
1976
2098
|
EOS
|
1977
2099
|
|
1978
|
-
output =
|
2100
|
+
output = convert_string input
|
1979
2101
|
assert_xpath '//*[@id="toc"]/ul//li/a[text()="1. Section One"]', output, 1
|
1980
2102
|
assert_xpath '//*[@id="toc"]/ul//li/a[text()="Appendix A: Attribute Options"]', output, 1
|
1981
2103
|
assert_xpath '//*[@id="toc"]/ul//li/a[text()="Appendix B: Migration"]', output, 1
|
@@ -1997,7 +2119,7 @@ Terms
|
|
1997
2119
|
==== Level 3
|
1998
2120
|
EOS
|
1999
2121
|
|
2000
|
-
output =
|
2122
|
+
output = convert_string input
|
2001
2123
|
assert_xpath '//*[@id="toc"]//a[@href="#_level_1"][text()="1. Level 1"]', output, 1
|
2002
2124
|
assert_xpath '//*[@id="toc"]//a[@href="#_level_2"][text()="1.1. Level 2"]', output, 1
|
2003
2125
|
assert_xpath '//*[@id="toc"]//a[@href="#_level_3"][text()="Level 3"]', output, 1
|
@@ -2039,7 +2161,7 @@ Details
|
|
2039
2161
|
Terms
|
2040
2162
|
EOS
|
2041
2163
|
|
2042
|
-
output =
|
2164
|
+
output = convert_string_to_embedded input
|
2043
2165
|
assert_xpath '(//h2)[1][text()="Preface"]', output, 1
|
2044
2166
|
assert_xpath '(//h3)[1][text()="Preface Subsection"]', output, 1
|
2045
2167
|
assert_xpath '(//h2)[2][text()="1. Section One"]', output, 1
|
@@ -2086,7 +2208,7 @@ Details
|
|
2086
2208
|
Terms
|
2087
2209
|
EOS
|
2088
2210
|
|
2089
|
-
output =
|
2211
|
+
output = convert_string input
|
2090
2212
|
assert_xpath '//*[@id="toc"]/ul//li/a[text()="Preface"]', output, 1
|
2091
2213
|
assert_xpath '//*[@id="toc"]/ul//li/a[text()="Preface Subsection"]', output, 1
|
2092
2214
|
assert_xpath '//*[@id="toc"]/ul//li/a[text()="1. Section One"]', output, 1
|
@@ -2132,7 +2254,7 @@ Details
|
|
2132
2254
|
Terms
|
2133
2255
|
EOS
|
2134
2256
|
|
2135
|
-
output =
|
2257
|
+
output = convert_string_to_embedded input
|
2136
2258
|
assert_xpath '(//h2)[1][text()="1. Preface"]', output, 1
|
2137
2259
|
assert_xpath '(//h3)[1][text()="1.1. Preface Subsection"]', output, 1
|
2138
2260
|
assert_xpath '(//h2)[2][text()="2. Section One"]', output, 1
|
@@ -2179,7 +2301,7 @@ Details
|
|
2179
2301
|
Terms
|
2180
2302
|
EOS
|
2181
2303
|
|
2182
|
-
output =
|
2304
|
+
output = convert_string input
|
2183
2305
|
assert_xpath '//*[@id="toc"]/ul//li/a[text()="1. Preface"]', output, 1
|
2184
2306
|
assert_xpath '//*[@id="toc"]/ul//li/a[text()="1.1. Preface Subsection"]', output, 1
|
2185
2307
|
assert_xpath '//*[@id="toc"]/ul//li/a[text()="2. Section One"]', output, 1
|
@@ -2189,7 +2311,7 @@ Terms
|
|
2189
2311
|
assert_xpath '//*[@id="toc"]/ul//li/a[text()="3. Glossary"]', output, 1
|
2190
2312
|
end
|
2191
2313
|
|
2192
|
-
test 'level 0 special sections in multipart book should be
|
2314
|
+
test 'level 0 special sections in multipart book should be coerced to level 1' do
|
2193
2315
|
input = <<-EOS
|
2194
2316
|
= Multipart Book
|
2195
2317
|
Doc Writer
|
@@ -2206,7 +2328,7 @@ Preface text
|
|
2206
2328
|
Appendix text
|
2207
2329
|
EOS
|
2208
2330
|
|
2209
|
-
output =
|
2331
|
+
output = convert_string input
|
2210
2332
|
assert_xpath '//h2[@id = "_preface"]', output, 1
|
2211
2333
|
assert_xpath '//h2[@id = "_appendix"]', output, 1
|
2212
2334
|
end
|
@@ -2291,7 +2413,7 @@ Colophon content
|
|
2291
2413
|
= Index Title
|
2292
2414
|
EOS
|
2293
2415
|
|
2294
|
-
output =
|
2416
|
+
output = convert_string_to_embedded input, :backend => 'docbook45'
|
2295
2417
|
assert_xpath '/chapter[@id="abstract_title"]', output, 1
|
2296
2418
|
assert_xpath '/chapter[@id="abstract_title"]/title[text()="Abstract Title"]', output, 1
|
2297
2419
|
assert_xpath '/chapter/following-sibling::dedication[@id="dedication_title"]', output, 1
|
@@ -2331,7 +2453,7 @@ Colophon content
|
|
2331
2453
|
Abstract content
|
2332
2454
|
EOS
|
2333
2455
|
|
2334
|
-
output =
|
2456
|
+
output = convert_string_to_embedded input, :backend => 'docbook45'
|
2335
2457
|
assert_xpath '/abstract[@id="abstract_title"]', output, 1
|
2336
2458
|
assert_xpath '/abstract[@id="abstract_title"]/title[text()="Abstract Title"]', output, 1
|
2337
2459
|
end
|
@@ -2357,7 +2479,7 @@ A second glossary term::
|
|
2357
2479
|
The corresponding definition.
|
2358
2480
|
EOS
|
2359
2481
|
|
2360
|
-
output =
|
2482
|
+
output = convert_string input, :backend => :docbook
|
2361
2483
|
assert_xpath '//glossary', output, 1
|
2362
2484
|
assert_xpath '//chapter/glossary', output, 1
|
2363
2485
|
assert_xpath '//glossary/title[text()="Glossary A"]', output, 1
|
@@ -2372,7 +2494,7 @@ The corresponding definition.
|
|
2372
2494
|
content
|
2373
2495
|
EOS
|
2374
2496
|
|
2375
|
-
output =
|
2497
|
+
output = convert_string_to_embedded input, :backend => :docbook
|
2376
2498
|
assert_xpath '/dedication', output, 1
|
2377
2499
|
assert_xpath '/dedication/title', output, 0
|
2378
2500
|
end
|
@@ -2390,7 +2512,7 @@ code
|
|
2390
2512
|
|
2391
2513
|
fin.
|
2392
2514
|
EOS
|
2393
|
-
output =
|
2515
|
+
output = convert_string input
|
2394
2516
|
assert_xpath "//h2", output, 1
|
2395
2517
|
end
|
2396
2518
|
|
@@ -2405,7 +2527,7 @@ ha
|
|
2405
2527
|
|
2406
2528
|
fin.
|
2407
2529
|
EOS
|
2408
|
-
output =
|
2530
|
+
output = convert_string input
|
2409
2531
|
assert_xpath "//h2", output, 1
|
2410
2532
|
end
|
2411
2533
|
|
@@ -2421,7 +2543,7 @@ preamble
|
|
2421
2543
|
This should be a tip, not a heading.
|
2422
2544
|
====
|
2423
2545
|
EOS
|
2424
|
-
output =
|
2546
|
+
output = convert_string input
|
2425
2547
|
assert_xpath "//*[@class='admonitionblock tip']//p[text() = 'This should be a tip, not a heading.']", output, 1
|
2426
2548
|
end
|
2427
2549
|
|
@@ -2443,7 +2565,7 @@ term3:: def
|
|
2443
2565
|
|
2444
2566
|
fin.
|
2445
2567
|
EOS
|
2446
|
-
output =
|
2568
|
+
output = convert_string input
|
2447
2569
|
assert_xpath "//h2", output, 1
|
2448
2570
|
assert_xpath "//dl", output, 1
|
2449
2571
|
end
|
@@ -2465,7 +2587,7 @@ list = [1, 2, 3];
|
|
2465
2587
|
|
2466
2588
|
fin.
|
2467
2589
|
EOS
|
2468
|
-
output =
|
2590
|
+
output = convert_string input
|
2469
2591
|
assert_xpath "//h2", output, 1
|
2470
2592
|
assert_xpath "//ul", output, 1
|
2471
2593
|
end
|
@@ -2478,14 +2600,14 @@ fin.
|
|
2478
2600
|
|
2479
2601
|
====
|
2480
2602
|
EOS
|
2481
|
-
output =
|
2603
|
+
output = convert_string input
|
2482
2604
|
assert_xpath "//h2", output, 0
|
2483
2605
|
assert_xpath "//*[@class='exampleblock']//p[text() = '== not a heading']", output, 1
|
2484
2606
|
end
|
2485
2607
|
end
|
2486
2608
|
|
2487
2609
|
context 'Table of Contents' do
|
2488
|
-
test 'should
|
2610
|
+
test 'should output unnumbered table of contents in header if toc attribute is set' do
|
2489
2611
|
input = <<-EOS
|
2490
2612
|
= Article
|
2491
2613
|
:toc:
|
@@ -2506,7 +2628,7 @@ While they were waiting...
|
|
2506
2628
|
|
2507
2629
|
That's all she wrote!
|
2508
2630
|
EOS
|
2509
|
-
output =
|
2631
|
+
output = convert_string input
|
2510
2632
|
assert_xpath '//*[@id="header"]//*[@id="toc"][@class="toc"]', output, 1
|
2511
2633
|
assert_xpath '//*[@id="header"]//*[@id="toc"]/*[@id="toctitle"][text()="Table of Contents"]', output, 1
|
2512
2634
|
assert_xpath '//*[@id="header"]//*[@id="toc"]/ul', output, 1
|
@@ -2521,7 +2643,7 @@ That's all she wrote!
|
|
2521
2643
|
assert_xpath '((//*[@id="header"]//*[@id="toc"]/ul)[1]/li)[3]/a[@href="#_section_three"][text()="Section Three"]', output, 1
|
2522
2644
|
end
|
2523
2645
|
|
2524
|
-
test 'should
|
2646
|
+
test 'should output numbered table of contents in header if toc and numbered attributes are set' do
|
2525
2647
|
input = <<-EOS
|
2526
2648
|
= Article
|
2527
2649
|
:toc:
|
@@ -2543,7 +2665,7 @@ While they were waiting...
|
|
2543
2665
|
|
2544
2666
|
That's all she wrote!
|
2545
2667
|
EOS
|
2546
|
-
output =
|
2668
|
+
output = convert_string input
|
2547
2669
|
assert_xpath '//*[@id="header"]//*[@id="toc"][@class="toc"]', output, 1
|
2548
2670
|
assert_xpath '//*[@id="header"]//*[@id="toc"]/*[@id="toctitle"][text()="Table of Contents"]', output, 1
|
2549
2671
|
assert_xpath '//*[@id="header"]//*[@id="toc"]/ul', output, 1
|
@@ -2555,7 +2677,7 @@ That's all she wrote!
|
|
2555
2677
|
assert_xpath '((//*[@id="header"]//*[@id="toc"]/ul)[1]/li)[3]/a[@href="#_section_three"][text()="3. Section Three"]', output, 1
|
2556
2678
|
end
|
2557
2679
|
|
2558
|
-
test 'should
|
2680
|
+
test 'should output a table of contents that honors numbered setting at position of section in document' do
|
2559
2681
|
input = <<-EOS
|
2560
2682
|
= Article
|
2561
2683
|
:toc:
|
@@ -2579,7 +2701,7 @@ While they were waiting...
|
|
2579
2701
|
|
2580
2702
|
That's all she wrote!
|
2581
2703
|
EOS
|
2582
|
-
output =
|
2704
|
+
output = convert_string input
|
2583
2705
|
assert_xpath '//*[@id="header"]//*[@id="toc"][@class="toc"]', output, 1
|
2584
2706
|
assert_xpath '//*[@id="header"]//*[@id="toc"]/*[@id="toctitle"][text()="Table of Contents"]', output, 1
|
2585
2707
|
assert_xpath '//*[@id="header"]//*[@id="toc"]/ul', output, 1
|
@@ -2613,7 +2735,7 @@ blah
|
|
2613
2735
|
blah
|
2614
2736
|
EOS
|
2615
2737
|
|
2616
|
-
output =
|
2738
|
+
output = convert_string input
|
2617
2739
|
assert_xpath '//*[@id="toc"]', output, 1
|
2618
2740
|
assert_xpath '//*[@id="toc"]/ul', output, 1
|
2619
2741
|
assert_xpath '//*[@id="toc"]/ul[@class="sectlevel0"]', output, 1
|
@@ -2626,7 +2748,7 @@ blah
|
|
2626
2748
|
assert_xpath '((//*[@id="toc"]/ul[@class="sectlevel0"]/li)[1]/ul/li)[1]/a[text()="1. First Section of Part 1"]', output, 1
|
2627
2749
|
end
|
2628
2750
|
|
2629
|
-
test 'should
|
2751
|
+
test 'should output table of contents in header if toc2 attribute is set' do
|
2630
2752
|
input = <<-EOS
|
2631
2753
|
= Article
|
2632
2754
|
:toc2:
|
@@ -2641,7 +2763,7 @@ It was a dark and stormy night...
|
|
2641
2763
|
They couldn't believe their eyes when...
|
2642
2764
|
EOS
|
2643
2765
|
|
2644
|
-
output =
|
2766
|
+
output = convert_string input
|
2645
2767
|
assert_xpath '//body[@class="article toc2 toc-left"]', output, 1
|
2646
2768
|
assert_xpath '//*[@id="header"]//*[@id="toc"][@class="toc2"]', output, 1
|
2647
2769
|
assert_xpath '//*[@id="header"]//*[@id="toc"]/ul/li[1]/a[@href="#_section_one"][text()="1. Section One"]', output, 1
|
@@ -2662,7 +2784,7 @@ It was a dark and stormy night...
|
|
2662
2784
|
They couldn't believe their eyes when...
|
2663
2785
|
EOS
|
2664
2786
|
|
2665
|
-
output =
|
2787
|
+
output = convert_string input
|
2666
2788
|
assert_xpath '//body[@class="article toc2 toc-right"]', output, 1
|
2667
2789
|
assert_xpath '//*[@id="header"]//*[@id="toc"][@class="toc2"]', output, 1
|
2668
2790
|
assert_xpath '//*[@id="header"]//*[@id="toc"]/ul/li[1]/a[@href="#_section_one"][text()="1. Section One"]', output, 1
|
@@ -2684,7 +2806,7 @@ It was a dark and stormy night...
|
|
2684
2806
|
They couldn't believe their eyes when...
|
2685
2807
|
EOS
|
2686
2808
|
|
2687
|
-
output =
|
2809
|
+
output = convert_string input
|
2688
2810
|
assert_xpath '//body[@class="article toc2 toc-right"]', output, 1
|
2689
2811
|
assert_xpath '//*[@id="header"]//*[@id="toc"][@class="toc2"]', output, 1
|
2690
2812
|
assert_xpath '//*[@id="header"]//*[@id="toc"]/ul/li[1]/a[@href="#_section_one"][text()="1. Section One"]', output, 1
|
@@ -2706,7 +2828,7 @@ It was a dark and stormy night...
|
|
2706
2828
|
They couldn't believe their eyes when...
|
2707
2829
|
EOS
|
2708
2830
|
|
2709
|
-
output =
|
2831
|
+
output = convert_string input
|
2710
2832
|
assert_xpath '//body[@class="article toc2 toc-right"]', output, 1
|
2711
2833
|
assert_xpath '//*[@id="header"]//*[@id="toc"][@class="toc2"]', output, 1
|
2712
2834
|
assert_xpath '//*[@id="header"]//*[@id="toc"]/ul/li[1]/a[@href="#_section_one"][text()="1. Section One"]', output, 1
|
@@ -2727,7 +2849,7 @@ It was a dark and stormy night...
|
|
2727
2849
|
They couldn't believe their eyes when...
|
2728
2850
|
EOS
|
2729
2851
|
|
2730
|
-
output =
|
2852
|
+
output = convert_string input
|
2731
2853
|
assert_xpath '//body[@class="article toc2 toc-right"]', output, 1
|
2732
2854
|
assert_xpath '//*[@id="header"]//*[@id="toc"][@class="toc2"]', output, 1
|
2733
2855
|
assert_xpath '//*[@id="header"]//*[@id="toc"]/ul/li[1]/a[@href="#_section_one"][text()="1. Section One"]', output, 1
|
@@ -2749,7 +2871,7 @@ It was a dark and stormy night...
|
|
2749
2871
|
They couldn't believe their eyes when...
|
2750
2872
|
EOS
|
2751
2873
|
|
2752
|
-
output =
|
2874
|
+
output = convert_string input
|
2753
2875
|
assert_css '#preamble #toc', output, 1
|
2754
2876
|
assert_css '#preamble .sectionbody + #toc', output, 1
|
2755
2877
|
end
|
@@ -2776,7 +2898,7 @@ They couldn't believe their eyes when...
|
|
2776
2898
|
|
2777
2899
|
Fin.
|
2778
2900
|
EOS
|
2779
|
-
output =
|
2901
|
+
output = convert_string input
|
2780
2902
|
assert_css '#header #toc', output, 1
|
2781
2903
|
assert_css '#header #toc.toc2', output, 1
|
2782
2904
|
assert_css '#header #toc li', output, 2
|
@@ -2784,7 +2906,7 @@ Fin.
|
|
2784
2906
|
assert_xpath '//*[@id="header"]//*[@id="toc"]/*[@id="toctitle"][text()="Contents"]', output, 1
|
2785
2907
|
end
|
2786
2908
|
|
2787
|
-
test 'should not
|
2909
|
+
test 'should not output table of contents if toc-placement attribute is unset' do
|
2788
2910
|
input = <<-EOS
|
2789
2911
|
= Article
|
2790
2912
|
:toc:
|
@@ -2799,11 +2921,11 @@ It was a dark and stormy night...
|
|
2799
2921
|
They couldn't believe their eyes when...
|
2800
2922
|
EOS
|
2801
2923
|
|
2802
|
-
output =
|
2924
|
+
output = convert_string input
|
2803
2925
|
assert_xpath '//*[@id="toc"]', output, 0
|
2804
2926
|
end
|
2805
2927
|
|
2806
|
-
test 'should
|
2928
|
+
test 'should output table of contents at location of toc macro' do
|
2807
2929
|
input = <<-EOS
|
2808
2930
|
= Article
|
2809
2931
|
:toc:
|
@@ -2822,12 +2944,12 @@ It was a dark and stormy night...
|
|
2822
2944
|
They couldn't believe their eyes when...
|
2823
2945
|
EOS
|
2824
2946
|
|
2825
|
-
output =
|
2947
|
+
output = convert_string input
|
2826
2948
|
assert_css '#preamble #toc', output, 1
|
2827
2949
|
assert_css '#preamble .paragraph + #toc', output, 1
|
2828
2950
|
end
|
2829
2951
|
|
2830
|
-
test 'should
|
2952
|
+
test 'should output table of contents at location of toc macro in embedded document' do
|
2831
2953
|
input = <<-EOS
|
2832
2954
|
= Article
|
2833
2955
|
:toc:
|
@@ -2846,12 +2968,12 @@ It was a dark and stormy night...
|
|
2846
2968
|
They couldn't believe their eyes when...
|
2847
2969
|
EOS
|
2848
2970
|
|
2849
|
-
output =
|
2971
|
+
output = convert_string_to_embedded input
|
2850
2972
|
assert_css '#preamble:root #toc', output, 1
|
2851
2973
|
assert_css '#preamble:root .paragraph + #toc', output, 1
|
2852
2974
|
end
|
2853
2975
|
|
2854
|
-
test 'should
|
2976
|
+
test 'should output table of contents at default location in embedded document if toc attribute is set' do
|
2855
2977
|
input = <<-EOS
|
2856
2978
|
= Article
|
2857
2979
|
:showtitle:
|
@@ -2868,7 +2990,7 @@ It was a dark and stormy night...
|
|
2868
2990
|
They couldn't believe their eyes when...
|
2869
2991
|
EOS
|
2870
2992
|
|
2871
|
-
output =
|
2993
|
+
output = convert_string_to_embedded input
|
2872
2994
|
assert_css 'h1:root', output, 1
|
2873
2995
|
assert_css 'h1:root + #toc:root', output, 1
|
2874
2996
|
assert_css 'h1:root + #toc:root + #preamble:root', output, 1
|
@@ -2892,7 +3014,7 @@ It was a dark and stormy night...
|
|
2892
3014
|
They couldn't believe their eyes when...
|
2893
3015
|
EOS
|
2894
3016
|
|
2895
|
-
output =
|
3017
|
+
output = convert_string input
|
2896
3018
|
|
2897
3019
|
assert_css '#toc', output, 1
|
2898
3020
|
assert_css '#toctitle', output, 1
|
@@ -2918,7 +3040,7 @@ It was a dark and stormy night...
|
|
2918
3040
|
They couldn't believe their eyes when...
|
2919
3041
|
EOS
|
2920
3042
|
|
2921
|
-
output =
|
3043
|
+
output = convert_string input
|
2922
3044
|
|
2923
3045
|
assert_css '#toc', output, 1
|
2924
3046
|
assert_css '#toctitle', output, 1
|
@@ -2954,7 +3076,7 @@ toc::[]
|
|
2954
3076
|
Fin.
|
2955
3077
|
EOS
|
2956
3078
|
|
2957
|
-
output =
|
3079
|
+
output = convert_string input
|
2958
3080
|
assert_css '#toc', output, 1
|
2959
3081
|
assert_css '#toctitle', output, 1
|
2960
3082
|
assert_css '#preamble #toc', output, 1
|
@@ -2997,7 +3119,7 @@ toc::[levels={tocdepth}]
|
|
2997
3119
|
Fin.
|
2998
3120
|
EOS
|
2999
3121
|
|
3000
|
-
output =
|
3122
|
+
output = convert_string input
|
3001
3123
|
assert_css '#toc', output, 0
|
3002
3124
|
assert_css '#toctitle', output, 0
|
3003
3125
|
assert_css '#preamble #contents', output, 1
|
@@ -3029,7 +3151,7 @@ While they were waiting...
|
|
3029
3151
|
|
3030
3152
|
That's all she wrote!
|
3031
3153
|
EOS
|
3032
|
-
output =
|
3154
|
+
output = convert_string input
|
3033
3155
|
assert_xpath '//*[@id="header"]//*[@id="toc"][@class="toc"]', output, 1
|
3034
3156
|
assert_xpath '//*[@id="header"]//*[@id="toc"]/*[@id="toctitle"][text()="Table of Contents"]', output, 1
|
3035
3157
|
assert_xpath '//*[@id="header"]//*[@id="toc"]/ul', output, 1
|
@@ -3056,7 +3178,7 @@ It only has content.
|
|
3056
3178
|
|
3057
3179
|
['', 'left', 'preamble', 'macro'].each do |placement|
|
3058
3180
|
input = input_src.gsub(':toc:', "\\& #{placement}")
|
3059
|
-
output =
|
3181
|
+
output = convert_string input
|
3060
3182
|
assert_css '#toctitle', output, 0
|
3061
3183
|
end
|
3062
3184
|
end
|
@@ -3079,7 +3201,7 @@ content
|
|
3079
3201
|
content
|
3080
3202
|
EOS
|
3081
3203
|
|
3082
|
-
output =
|
3204
|
+
output = convert_string_to_embedded input
|
3083
3205
|
assert_xpath '/*[@id="toc"]', output, 1
|
3084
3206
|
toc_links = xmlnodes_at_xpath '/*[@id="toc"]//li', output
|
3085
3207
|
assert_equal 3, toc_links.size
|
@@ -3107,7 +3229,7 @@ content
|
|
3107
3229
|
content
|
3108
3230
|
EOS
|
3109
3231
|
|
3110
|
-
output =
|
3232
|
+
output = convert_string_to_embedded input, :safe => :safe
|
3111
3233
|
assert_xpath '/*[@id="toc"]', output, 1
|
3112
3234
|
toc_links = xmlnodes_at_xpath '/*[@id="toc"]//li', output
|
3113
3235
|
assert_equal 3, toc_links.size
|
@@ -3148,7 +3270,7 @@ While they were returning...
|
|
3148
3270
|
That's all she wrote!
|
3149
3271
|
EOS
|
3150
3272
|
|
3151
|
-
output =
|
3273
|
+
output = convert_string input, :backend => 'docbook'
|
3152
3274
|
assert_xpath '//part', output, 0
|
3153
3275
|
assert_xpath '//chapter', output, 0
|
3154
3276
|
assert_xpath '/article/section', output, 2
|
@@ -3192,7 +3314,7 @@ While they were waiting...
|
|
3192
3314
|
That's all she wrote!
|
3193
3315
|
EOS
|
3194
3316
|
|
3195
|
-
output =
|
3317
|
+
output = convert_string(input)
|
3196
3318
|
assert_css 'body.book', output, 1
|
3197
3319
|
assert_css 'h1', output, 4
|
3198
3320
|
assert_css '#header h1', output, 1
|
@@ -3217,7 +3339,7 @@ That's all she wrote!
|
|
3217
3339
|
EOS
|
3218
3340
|
|
3219
3341
|
using_memory_logger do |logger|
|
3220
|
-
|
3342
|
+
convert_string input
|
3221
3343
|
assert_message logger, :ERROR, '<stdin>: line 7: level 0 sections can only be used when doctype is book', Hash
|
3222
3344
|
end
|
3223
3345
|
end
|
@@ -3241,7 +3363,7 @@ content
|
|
3241
3363
|
content
|
3242
3364
|
EOS
|
3243
3365
|
|
3244
|
-
result =
|
3366
|
+
result = convert_string_to_embedded input
|
3245
3367
|
assert_css 'h1.sect0', result, 2
|
3246
3368
|
assert_css 'h1.sect0.newbie', result, 1
|
3247
3369
|
assert_css 'h1.sect0.newbie#_part_1', result, 1
|
@@ -3390,7 +3512,7 @@ While they were returning...
|
|
3390
3512
|
That's all she wrote!
|
3391
3513
|
EOS
|
3392
3514
|
|
3393
|
-
output =
|
3515
|
+
output = convert_string input, :backend => 'docbook'
|
3394
3516
|
assert_xpath '//chapter/chapter', output, 0
|
3395
3517
|
assert_xpath '/book/part', output, 2
|
3396
3518
|
assert_xpath '/book/part[1]/title[text() = "Part 1"]', output, 1
|
@@ -3437,7 +3559,7 @@ Appendix subsection content
|
|
3437
3559
|
|
3438
3560
|
output = nil
|
3439
3561
|
using_memory_logger do |logger|
|
3440
|
-
output =
|
3562
|
+
output = convert_string input, :backend => 'docbook'
|
3441
3563
|
assert logger.empty?
|
3442
3564
|
end
|
3443
3565
|
assert_xpath '/book/preface', output, 1
|