asciidoctor 1.5.5 → 1.5.6

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of asciidoctor might be problematic. Click here for more details.

Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.adoc +216 -1
  3. data/CONTRIBUTING.adoc +2 -2
  4. data/Gemfile +20 -1
  5. data/LICENSE.adoc +1 -1
  6. data/README-fr.adoc +4 -3
  7. data/README-jp.adoc +11 -10
  8. data/README-zh_CN.adoc +4 -3
  9. data/README.adoc +17 -202
  10. data/Rakefile +41 -25
  11. data/asciidoctor.gemspec +9 -10
  12. data/data/locale/attributes.adoc +216 -34
  13. data/data/stylesheets/asciidoctor-default.css +23 -16
  14. data/features/step_definitions.rb +15 -19
  15. data/features/xref.feature +584 -20
  16. data/lib/asciidoctor.rb +292 -278
  17. data/lib/asciidoctor/abstract_block.rb +155 -94
  18. data/lib/asciidoctor/abstract_node.rb +108 -94
  19. data/lib/asciidoctor/attribute_list.rb +30 -22
  20. data/lib/asciidoctor/block.rb +7 -7
  21. data/lib/asciidoctor/cli/invoker.rb +47 -34
  22. data/lib/asciidoctor/cli/options.rb +22 -11
  23. data/lib/asciidoctor/converter.rb +3 -3
  24. data/lib/asciidoctor/converter/base.rb +2 -2
  25. data/lib/asciidoctor/converter/composite.rb +1 -1
  26. data/lib/asciidoctor/converter/docbook45.rb +2 -2
  27. data/lib/asciidoctor/converter/docbook5.rb +132 -87
  28. data/lib/asciidoctor/converter/factory.rb +0 -1
  29. data/lib/asciidoctor/converter/html5.rb +116 -98
  30. data/lib/asciidoctor/converter/manpage.rb +51 -52
  31. data/lib/asciidoctor/converter/template.rb +47 -36
  32. data/lib/asciidoctor/core_ext.rb +8 -2
  33. data/lib/asciidoctor/core_ext/1.8.7/hash/key.rb +4 -0
  34. data/lib/asciidoctor/core_ext/1.8.7/io/binread.rb +6 -0
  35. data/lib/asciidoctor/core_ext/1.8.7/io/write.rb +5 -0
  36. data/lib/asciidoctor/core_ext/1.8.7/string/chr.rb +1 -1
  37. data/lib/asciidoctor/core_ext/1.8.7/string/{limit.rb → limit_bytesize.rb} +7 -6
  38. data/lib/asciidoctor/core_ext/1.8.7/symbol/empty.rb +6 -0
  39. data/lib/asciidoctor/core_ext/1.8.7/symbol/length.rb +1 -1
  40. data/lib/asciidoctor/core_ext/nil_or_empty.rb +5 -5
  41. data/lib/asciidoctor/core_ext/regexp/is_match.rb +3 -0
  42. data/lib/asciidoctor/core_ext/string/{limit.rb → limit_bytesize.rb} +2 -2
  43. data/lib/asciidoctor/document.rb +216 -213
  44. data/lib/asciidoctor/extensions.rb +318 -185
  45. data/lib/asciidoctor/helpers.rb +35 -35
  46. data/lib/asciidoctor/inline.rb +32 -1
  47. data/lib/asciidoctor/list.rb +22 -6
  48. data/lib/asciidoctor/parser.rb +1008 -1038
  49. data/lib/asciidoctor/path_resolver.rb +46 -50
  50. data/lib/asciidoctor/reader.rb +275 -251
  51. data/lib/asciidoctor/section.rb +86 -58
  52. data/lib/asciidoctor/stylesheets.rb +6 -6
  53. data/lib/asciidoctor/substitutors.rb +567 -649
  54. data/lib/asciidoctor/table.rb +163 -108
  55. data/lib/asciidoctor/version.rb +1 -1
  56. data/man/asciidoctor.1 +18 -16
  57. data/man/asciidoctor.adoc +15 -13
  58. data/test/attributes_test.rb +138 -22
  59. data/test/blocks_test.rb +377 -97
  60. data/test/converter_test.rb +13 -0
  61. data/test/document_test.rb +244 -34
  62. data/test/extensions_test.rb +409 -42
  63. data/test/fixtures/asciidoc_index.txt +521 -0
  64. data/test/fixtures/basic-docinfo-footer.html +6 -0
  65. data/test/fixtures/basic-docinfo-footer.xml +8 -0
  66. data/test/fixtures/basic-docinfo.html +1 -0
  67. data/test/fixtures/basic-docinfo.xml +4 -0
  68. data/test/fixtures/basic.asciidoc +5 -0
  69. data/test/fixtures/chapter-a.adoc +3 -0
  70. data/test/fixtures/child-include.adoc +5 -0
  71. data/test/fixtures/circle.svg +9 -0
  72. data/test/fixtures/custom-backends/erb/html5/block_paragraph.html.erb +6 -0
  73. data/test/fixtures/custom-backends/haml/docbook45/block_paragraph.xml.haml +6 -0
  74. data/test/fixtures/custom-backends/haml/html5-tweaks/block_paragraph.html.haml +1 -0
  75. data/test/fixtures/custom-backends/haml/html5/block_paragraph.html.haml +3 -0
  76. data/test/fixtures/custom-backends/haml/html5/block_sidebar.html.haml +5 -0
  77. data/test/fixtures/custom-backends/slim/docbook45/block_paragraph.xml.slim +6 -0
  78. data/test/fixtures/custom-backends/slim/html5/block_paragraph.html.slim +3 -0
  79. data/test/fixtures/custom-backends/slim/html5/block_sidebar.html.slim +5 -0
  80. data/test/fixtures/custom-docinfodir/basic-docinfo.html +1 -0
  81. data/test/fixtures/custom-docinfodir/docinfo.html +1 -0
  82. data/test/fixtures/docinfo-footer.html +1 -0
  83. data/test/fixtures/docinfo-footer.xml +9 -0
  84. data/test/fixtures/docinfo.html +1 -0
  85. data/test/fixtures/docinfo.xml +3 -0
  86. data/test/fixtures/dot.gif +0 -0
  87. data/test/fixtures/encoding.asciidoc +13 -0
  88. data/test/fixtures/grandchild-include.adoc +3 -0
  89. data/test/fixtures/hello-asciidoctor.pdf +69 -0
  90. data/test/fixtures/include-file.asciidoc +24 -0
  91. data/test/fixtures/include-file.ml +3 -0
  92. data/test/fixtures/include-file.xml +5 -0
  93. data/test/fixtures/master.adoc +5 -0
  94. data/test/fixtures/mismatched-end-tag.adoc +7 -0
  95. data/test/fixtures/parent-include-restricted.adoc +5 -0
  96. data/test/fixtures/parent-include.adoc +5 -0
  97. data/test/fixtures/sample.asciidoc +26 -0
  98. data/test/fixtures/stylesheets/custom.css +3 -0
  99. data/test/fixtures/subs-docinfo.html +2 -0
  100. data/test/fixtures/subs.adoc +7 -0
  101. data/test/fixtures/tagged-class-enclosed.rb +26 -0
  102. data/test/fixtures/tagged-class.rb +23 -0
  103. data/test/fixtures/tip.gif +0 -0
  104. data/test/invoker_test.rb +82 -4
  105. data/test/links_test.rb +312 -37
  106. data/test/lists_test.rb +204 -25
  107. data/test/manpage_test.rb +191 -4
  108. data/test/options_test.rb +18 -1
  109. data/test/paragraphs_test.rb +32 -7
  110. data/test/parser_test.rb +150 -30
  111. data/test/paths_test.rb +47 -13
  112. data/test/preamble_test.rb +1 -1
  113. data/test/reader_test.rb +366 -126
  114. data/test/sections_test.rb +203 -56
  115. data/test/substitutions_test.rb +339 -131
  116. data/test/tables_test.rb +315 -15
  117. data/test/test_helper.rb +400 -0
  118. data/test/text_test.rb +5 -5
  119. metadata +110 -22
@@ -22,10 +22,15 @@ context 'Sections' do
22
22
  end
23
23
 
24
24
  test 'synthetic id removes entities' do
25
- sec = block_from_string('== Ben & Jerry & Company "Ice Cream Brothers" ✾')
25
+ sec = block_from_string('== Ben & Jerry & Company¹ "Ice Cream Brothers" あ')
26
26
  assert_equal '_ben_jerry_company_ice_cream_brothers', sec.id
27
27
  end
28
28
 
29
+ test 'synthetic id removes adjacent entities with mixed case' do
30
+ sec = block_from_string('== a ®&© b')
31
+ assert_equal '_a_b', sec.id
32
+ end
33
+
29
34
  test 'synthetic id prefix can be customized' do
30
35
  sec = block_from_string(":idprefix: id_\n\n== Section One")
31
36
  assert_equal 'id_section_one', sec.id
@@ -77,6 +82,17 @@ context 'Sections' do
77
82
  assert_equal 'Section One', sec.title
78
83
  end
79
84
 
85
+ test 'explicit id can be defined using an embedded anchor when using setext section titles' do
86
+ input = <<-EOS
87
+ Section Title [[refid,reftext]]
88
+ -------------------------------
89
+ EOS
90
+ sec = block_from_string input
91
+ assert_equal 'Section Title', sec.title
92
+ assert_equal 'refid', sec.id
93
+ assert_equal 'reftext', (sec.attr 'reftext')
94
+ end
95
+
80
96
  test 'explicit id can be defined using an embedded anchor with reftext' do
81
97
  sec = block_from_string("== Section One [[one,Section Uno]] ==")
82
98
  assert_equal 'one', sec.id
@@ -155,7 +171,7 @@ content
155
171
  EOS
156
172
 
157
173
  doc = document_from_string input
158
- reftext = doc.references[:ids]['install']
174
+ reftext = doc.catalog[:ids]['install']
159
175
  refute_nil reftext
160
176
  assert_equal 'Install Procedure', reftext
161
177
  end
@@ -169,12 +185,28 @@ content
169
185
  EOS
170
186
 
171
187
  doc = document_from_string input
172
- reftext = doc.references[:ids]['_install']
188
+ reftext = doc.catalog[:ids]['_install']
173
189
  refute_nil reftext
174
190
  assert_equal 'Install Procedure', reftext
175
191
  end
176
192
 
177
- test 'should not overwrite existing id entry in references table' do
193
+ test 'should substitute attributes when registering reftext for section' do
194
+ input = <<-EOS
195
+ :platform-name: Linux
196
+
197
+ [[install,install on {platform-name}]]
198
+ == Install
199
+
200
+ content
201
+ EOS
202
+
203
+ doc = document_from_string input
204
+ reftext = doc.catalog[:ids]['install']
205
+ refute_nil reftext
206
+ assert_equal 'install on Linux', reftext
207
+ end
208
+
209
+ test 'duplicate section id should not overwrite existing section id entry in references table' do
178
210
  input = <<-EOS
179
211
  [#install]
180
212
  == First Install
@@ -187,13 +219,14 @@ content
187
219
  content
188
220
  EOS
189
221
 
190
- doc = document_from_string input
191
- reftext = doc.references[:ids]['install']
222
+ doc, warnings = redirect_streams {|_, err| [(document_from_string input), err.string]}
223
+ reftext = doc.catalog[:ids]['install']
192
224
  refute_nil reftext
193
225
  assert_equal 'First Install', reftext
226
+ assert_includes warnings, 'line 7: id assigned to section already in use: install'
194
227
  end
195
228
 
196
- test 'should not overwrite existing id entry with generated reftext in references table' do
229
+ test 'duplicate block id should not overwrite existing section id entry in references table' do
197
230
  input = <<-EOS
198
231
  [#install]
199
232
  == First Install
@@ -204,10 +237,11 @@ content
204
237
  content
205
238
  EOS
206
239
 
207
- doc = document_from_string input
208
- reftext = doc.references[:ids]['install']
240
+ doc, warnings = redirect_streams {|_, err| [(document_from_string input), err.string] }
241
+ reftext = doc.catalog[:ids]['install']
209
242
  refute_nil reftext
210
243
  assert_equal 'First Install', reftext
244
+ assert_includes warnings, 'line 7: id assigned to block already in use: install'
211
245
  end
212
246
  end
213
247
 
@@ -275,6 +309,14 @@ preamble
275
309
  assert_xpath "//h1[not(@id)][text() = 'My Title']", render_string("= My Title =")
276
310
  end
277
311
 
312
+ test 'document title created from leveloffset shift defined in document' do
313
+ assert_xpath "//h1[not(@id)][text() = 'Document Title']", render_string(%(:leveloffset: -1\n== Document Title))
314
+ end
315
+
316
+ test 'document title created from leveloffset shift defined in API' do
317
+ assert_xpath "//h1[not(@id)][text() = 'Document Title']", render_string('== Document Title', :attributes => { 'leveloffset' => '-1@' })
318
+ end
319
+
278
320
  test 'should assign id on document title to body' do
279
321
  input = <<-EOS
280
322
  [[idname]]
@@ -343,6 +385,17 @@ content
343
385
  assert_xpath "//h2[@id='_my_section'][text() = 'My Section']", render_string("My Section\n-----------")
344
386
  end
345
387
 
388
+ test 'should not recognize underline containing a mix of characters' do
389
+ input = <<-EOS
390
+ My Section
391
+ ----^^----
392
+ EOS
393
+
394
+ result = render_embedded_string input
395
+ assert_xpath '//h2[@id="_my_section"][text() = "My Section"]', result, 0
396
+ assert_includes result, '----^^----'
397
+ end
398
+
346
399
  test "heading title with multiline syntax cannot begin with a dot" do
347
400
  title = ".My Title"
348
401
  chars = "-" * title.length
@@ -362,7 +415,7 @@ content
362
415
  end
363
416
 
364
417
  test "with XML entity" do
365
- assert_xpath "//h2[@id='_where_s_the_love'][text() = \"Where#{[8217].pack('U*')}s the love?\"]", render_string("== Where's the love?")
418
+ assert_xpath "//h2[@id='_where_s_the_love'][text() = \"Where#{decode_char 8217}s the love?\"]", render_string("== Where's the love?")
366
419
  end
367
420
 
368
421
  test "with non-word character" do
@@ -495,6 +548,15 @@ blah blah
495
548
  output = render_string input
496
549
  assert_xpath "//h2[@id='_section_one'][text() = 'Section One']", output, 1
497
550
  end
551
+
552
+ test 'should not match mixed single-line syntax' do
553
+ input = <<-EOS
554
+ =#= My Title
555
+ EOS
556
+ output = render_embedded_string input
557
+ assert_xpath "//h3[@id='_my_title'][text() = 'My Title']", output, 0
558
+ assert_includes output, '<p>=#= My Title</p>'
559
+ end
498
560
  end
499
561
 
500
562
  context 'Floating Title' do
@@ -533,6 +595,20 @@ not in section
533
595
  assert_xpath '/h3/following-sibling::*[@class="paragraph"]/p[text()="not in section"]', output, 1
534
596
  end
535
597
 
598
+ test 'should generate id for floating title from converted title' do
599
+ input = <<-EOS
600
+ [discrete]
601
+ === {sp}Heading{sp}
602
+
603
+ not in section
604
+ EOS
605
+
606
+ output = render_embedded_string input
607
+ assert_xpath '/h3', output, 1
608
+ assert_xpath '/h3[@class="discrete"][@id="_heading"]', output, 1
609
+ assert_xpath '/h3[@class="discrete"][@id="_heading"][text()=" Heading "]', output, 1
610
+ end
611
+
536
612
  test 'should create floating title if style is float with shorthand role and id' do
537
613
  input = <<-EOS
538
614
  [float.independent#first]
@@ -581,7 +657,7 @@ not in section
581
657
  assert floatingtitle.context != :section
582
658
  assert_equal :floating_title, floatingtitle.context
583
659
  assert_equal '_independent_heading', floatingtitle.id
584
- assert doc.references[:ids].has_key?('_independent_heading')
660
+ assert doc.catalog[:ids].has_key?('_independent_heading')
585
661
  end
586
662
 
587
663
  test 'can assign explicit id to floating title' do
@@ -596,7 +672,7 @@ not in section
596
672
  doc = document_from_string input
597
673
  floating_title = doc.blocks.first
598
674
  assert_equal 'unchained', floating_title.id
599
- assert doc.references[:ids].has_key?('unchained')
675
+ assert doc.catalog[:ids].has_key?('unchained')
600
676
  end
601
677
 
602
678
  test 'should not include floating title in toc' do
@@ -660,6 +736,20 @@ not in section
660
736
  assert_xpath '/h2[@class="float isolated"]', output, 1
661
737
  end
662
738
 
739
+ test 'should ignore title attribute on discrete heading' do
740
+ input = <<-EOS
741
+ [discrete,title="Captured!"]
742
+ == Independent Heading!
743
+
744
+ not in section
745
+ EOS
746
+
747
+ doc = document_from_string input
748
+ heading = doc.blocks[0]
749
+ assert_equal 'Independent Heading!', heading.title
750
+ refute heading.attributes.key? 'title'
751
+ end
752
+
663
753
  test 'should use specified id and reftext when registering discrete section reference' do
664
754
  input = <<-EOS
665
755
  [[install,Install Procedure]]
@@ -670,7 +760,7 @@ content
670
760
  EOS
671
761
 
672
762
  doc = document_from_string input
673
- reftext = doc.references[:ids]['install']
763
+ reftext = doc.catalog[:ids]['install']
674
764
  refute_nil reftext
675
765
  assert_equal 'Install Procedure', reftext
676
766
  end
@@ -685,7 +775,7 @@ content
685
775
  EOS
686
776
 
687
777
  doc = document_from_string input
688
- reftext = doc.references[:ids]['_install']
778
+ reftext = doc.catalog[:ids]['_install']
689
779
  refute_nil reftext
690
780
  assert_equal 'Install Procedure', reftext
691
781
  end
@@ -1186,6 +1276,30 @@ content
1186
1276
  assert_xpath %(//h2[@id="_chapter_#{num}"][text()="#{num}. Chapter #{num}"]), result, 1
1187
1277
  end
1188
1278
  end
1279
+
1280
+ test 'reindex_sections should correct section enumeration after sections are modified' do
1281
+ input = <<-EOS
1282
+ :sectnums:
1283
+
1284
+ == First Section
1285
+
1286
+ content
1287
+
1288
+ == Last Section
1289
+
1290
+ content
1291
+ EOS
1292
+
1293
+ doc = document_from_string input
1294
+ second_section = Asciidoctor::Section.new doc
1295
+ doc.blocks.insert 1, second_section
1296
+ doc.reindex_sections
1297
+ sections = doc.sections
1298
+ [0, 1, 2].each do |index|
1299
+ assert_equal index, sections[index].index
1300
+ assert_equal index + 1, sections[index].number
1301
+ end
1302
+ end
1189
1303
  end
1190
1304
 
1191
1305
  context 'Links and anchors' do
@@ -1231,20 +1345,7 @@ Linux installation instructions.
1231
1345
  end
1232
1346
 
1233
1347
  context 'Special sections' do
1234
- test 'should assign sectname and caption to appendix section' do
1235
- input = <<-EOS
1236
- [appendix]
1237
- == Attribute Options
1238
-
1239
- Details
1240
- EOS
1241
-
1242
- output = block_from_string input
1243
- assert_equal 'appendix', output.sectname
1244
- assert_equal 'Appendix A: ', output.caption
1245
- end
1246
-
1247
- test 'should render appendix title prefixed with caption' do
1348
+ test 'should assign sectname, caption, and numeral to appendix section by default' do
1248
1349
  input = <<-EOS
1249
1350
  [appendix]
1250
1351
  == Attribute Options
@@ -1252,14 +1353,15 @@ Details
1252
1353
  Details
1253
1354
  EOS
1254
1355
 
1255
- output = render_embedded_string input
1256
- assert_xpath '//h2[text()="Appendix A: Attribute Options"]', output, 1
1356
+ appendix = block_from_string input
1357
+ assert_equal 'appendix', appendix.sectname
1358
+ assert_equal 'Appendix A: ', appendix.caption
1359
+ assert_equal 'A', appendix.number
1360
+ assert_equal true, appendix.numbered
1257
1361
  end
1258
1362
 
1259
- test 'should prefix appendix title by label and letter only when numbered is enabled' do
1363
+ test 'should prefix appendix title by numbered label even when section numbering is disabled' do
1260
1364
  input = <<-EOS
1261
- :numbered:
1262
-
1263
1365
  [appendix]
1264
1366
  == Attribute Options
1265
1367
 
@@ -1284,10 +1386,10 @@ Details
1284
1386
  assert_xpath '//h2[text()="App A: Attribute Options"]', output, 1
1285
1387
  end
1286
1388
 
1287
- test 'should only assign letter to appendix when numbered is enabled and appendix caption is empty' do
1389
+ test 'should only assign letter to appendix when numbered is enabled and appendix caption is not set' do
1288
1390
  input = <<-EOS
1289
1391
  :numbered:
1290
- :appendix-caption:
1392
+ :!appendix-caption:
1291
1393
 
1292
1394
  [appendix]
1293
1395
  == Attribute Options
@@ -1498,12 +1600,16 @@ Terms
1498
1600
  assert_xpath '//*[@id="toc"]//a[@href="#_level_3"][text()="Level 3"]', output, 1
1499
1601
  end
1500
1602
 
1501
- # reenable once we have :specialnumbered!: implemented
1502
- =begin
1503
- test 'should not number special sections or subsections' do
1603
+ test 'should not number special sections or their subsections by default except for appendices' do
1504
1604
  input = <<-EOS
1505
- :numbered:
1506
- :specialnumbered!:
1605
+ :sectnums:
1606
+
1607
+ [dedication]
1608
+ == Dedication
1609
+
1610
+ === Dedication Subsection
1611
+
1612
+ content
1507
1613
 
1508
1614
  == Section One
1509
1615
 
@@ -1528,19 +1634,27 @@ Terms
1528
1634
  EOS
1529
1635
 
1530
1636
  output = render_embedded_string input
1531
- assert_xpath '(//h2)[1][text()="1. Section One"]', output, 1
1532
- assert_xpath '(//h2)[2][text()="Appendix A: Attribute Options"]', output, 1
1533
- assert_xpath '(//h2)[3][text()="Appendix B: Migration"]', output, 1
1534
- assert_xpath '(//h3)[1][text()="Gotchas"]', output, 1
1535
- assert_xpath '(//h2)[4][text()="Glossary"]', output, 1
1637
+ assert_xpath '(//h2)[1][text()="Dedication"]', output, 1
1638
+ assert_xpath '(//h3)[1][text()="Dedication Subsection"]', output, 1
1639
+ assert_xpath '(//h2)[2][text()="1. Section One"]', output, 1
1640
+ assert_xpath '(//h2)[3][text()="Appendix A: Attribute Options"]', output, 1
1641
+ assert_xpath '(//h2)[4][text()="Appendix B: Migration"]', output, 1
1642
+ assert_xpath '(//h3)[2][text()="B.1. Gotchas"]', output, 1
1643
+ assert_xpath '(//h2)[5][text()="Glossary"]', output, 1
1536
1644
  end
1537
1645
 
1538
- test 'should not number special sections or subsections in toc' do
1646
+ test 'should not number special sections or their subsections in toc by default except for appendices' do
1539
1647
  input = <<-EOS
1540
- :numbered:
1541
- :specialnumbered!:
1648
+ :sectnums:
1542
1649
  :toc:
1543
1650
 
1651
+ [dedication]
1652
+ == Dedication
1653
+
1654
+ === Dedication Subsection
1655
+
1656
+ content
1657
+
1544
1658
  == Section One
1545
1659
 
1546
1660
  [appendix]
@@ -1564,13 +1678,14 @@ Terms
1564
1678
  EOS
1565
1679
 
1566
1680
  output = render_string input
1681
+ assert_xpath '//*[@id="toc"]/ul//li/a[text()="Dedication"]', output, 1
1682
+ assert_xpath '//*[@id="toc"]/ul//li/a[text()="Dedication Subsection"]', output, 1
1567
1683
  assert_xpath '//*[@id="toc"]/ul//li/a[text()="1. Section One"]', output, 1
1568
1684
  assert_xpath '//*[@id="toc"]/ul//li/a[text()="Appendix A: Attribute Options"]', output, 1
1569
1685
  assert_xpath '//*[@id="toc"]/ul//li/a[text()="Appendix B: Migration"]', output, 1
1570
- assert_xpath '//*[@id="toc"]/ul//li/a[text()="Gotchas"]', output, 1
1686
+ assert_xpath '//*[@id="toc"]/ul//li/a[text()="B.1. Gotchas"]', output, 1
1571
1687
  assert_xpath '//*[@id="toc"]/ul//li/a[text()="Glossary"]', output, 1
1572
1688
  end
1573
- =end
1574
1689
 
1575
1690
  test 'level 0 special sections in multipart book should be rendered as level 1' do
1576
1691
  input = <<-EOS
@@ -1594,7 +1709,7 @@ Appendix text
1594
1709
  assert_xpath '//h2[@id = "_appendix"]', output, 1
1595
1710
  end
1596
1711
 
1597
- test 'should output docbook elements that coorespond to special sections in book doctype' do
1712
+ test 'should output docbook elements that correspond to special sections in book doctype' do
1598
1713
  input = <<-EOS
1599
1714
  = Multipart Book
1600
1715
  :doctype: book
@@ -1730,7 +1845,7 @@ Abstract content
1730
1845
  === Glossary A
1731
1846
 
1732
1847
  Glossaries are optional.
1733
- Glossaries entries are an example of a style of AsciiDoc labeled lists.
1848
+ Glossaries entries are an example of a style of AsciiDoc description lists.
1734
1849
 
1735
1850
  [glossary]
1736
1851
  A glossary term::
@@ -1795,7 +1910,7 @@ This should be a tip, not a heading.
1795
1910
  assert_xpath "//*[@class='admonitionblock tip']//p[text() = 'This should be a tip, not a heading.']", output, 1
1796
1911
  end
1797
1912
 
1798
- test "should not match a heading in a labeled list" do
1913
+ test "should not match a heading in a description list" do
1799
1914
  input = <<-EOS
1800
1915
  Section
1801
1916
  -------
@@ -2216,7 +2331,7 @@ It was a dark and stormy night...
2216
2331
  They couldn't believe their eyes when...
2217
2332
  EOS
2218
2333
 
2219
- output = render_string input, :header_footer => false
2334
+ output = render_embedded_string input
2220
2335
  assert_css '#preamble:root #toc', output, 1
2221
2336
  assert_css '#preamble:root .paragraph + #toc', output, 1
2222
2337
  end
@@ -2238,7 +2353,7 @@ It was a dark and stormy night...
2238
2353
  They couldn't believe their eyes when...
2239
2354
  EOS
2240
2355
 
2241
- output = render_string input, :header_footer => false
2356
+ output = render_embedded_string input
2242
2357
  assert_css 'h1:root', output, 1
2243
2358
  assert_css 'h1:root + #toc:root', output, 1
2244
2359
  assert_css 'h1:root + #toc:root + #preamble:root', output, 1
@@ -2433,7 +2548,7 @@ It only has content.
2433
2548
  end
2434
2549
 
2435
2550
  context 'article doctype' do
2436
- test 'should create sections only in docbook backend' do
2551
+ test 'should create only sections in docbook backend' do
2437
2552
  input = <<-EOS
2438
2553
  = Article
2439
2554
  Doc Writer
@@ -2520,6 +2635,38 @@ That's all she wrote!
2520
2635
  assert_xpath '//h1[@id="_chapter_three"][text() = "Chapter Three"]', output, 1
2521
2636
  end
2522
2637
 
2638
+ test 'should assign appropriate sectname for section type' do
2639
+ input = <<-EOS
2640
+ = Book Title
2641
+ :doctype: book
2642
+ :idprefix:
2643
+ :idseparator: -
2644
+
2645
+ = Part Title
2646
+
2647
+ == Chapter Title
2648
+
2649
+ === Section Title
2650
+
2651
+ content
2652
+
2653
+ [appendix]
2654
+ == Appendix Title
2655
+
2656
+ === Appendix Section Title
2657
+
2658
+ content
2659
+ EOS
2660
+
2661
+ doc = document_from_string input
2662
+ assert_equal 'header', doc.header.sectname
2663
+ assert_equal 'part', (doc.find_by :id => 'part-title')[0].sectname
2664
+ assert_equal 'chapter', (doc.find_by :id => 'chapter-title')[0].sectname
2665
+ assert_equal 'section', (doc.find_by :id => 'section-title')[0].sectname
2666
+ assert_equal 'appendix', (doc.find_by :id => 'appendix-title')[0].sectname
2667
+ assert_equal 'section', (doc.find_by :id => 'appendix-section-title')[0].sectname
2668
+ end
2669
+
2523
2670
  test 'should add partintro style to child paragraph of part' do
2524
2671
  input = <<-EOS
2525
2672
  = Book