diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2021-10-07 02:51:06 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-07 02:51:06 -0600 |
| commit | 79424ceca876ae741716b64bd8bda5d514b0de57 (patch) | |
| tree | 387bcc9e5aa8f6ac9d836ebd797fcf0394be54e6 /test | |
| parent | 0bbc3ef717620180fc0f8b1a708cef6147a3a2e2 (diff) | |
resolves #4151 don't promote level-0 special section at start of document to document title (PR #4152)
Diffstat (limited to 'test')
| -rw-r--r-- | test/sections_test.rb | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/test/sections_test.rb b/test/sections_test.rb index 84ecd485..c28e53b1 100644 --- a/test/sections_test.rb +++ b/test/sections_test.rb @@ -616,9 +616,25 @@ context 'Sections' do assert_xpath '//a[text()="Reference Manual"]', output, 1 end - test 'should discard style, role and options shorthand attributes defined on document title' do + test 'should not interpret level-0 section as document title if it has a style' do input = <<~'EOS' - [style#idname.rolename%optionname] + [glossary] + = Document Title + + content + EOS + using_memory_logger do |logger| + doc = document_from_string input + assert_message logger, :ERROR, '<stdin>: line 2: level 0 sections can only be used when doctype is book', Hash + refute doc.header? + assert_nil doc.attributes['title'] + assert_equal 'glossary', doc.blocks[0].attributes['style'] + end + end + + test 'should discard role and options shorthand attributes defined on document title' do + input = <<~'EOS' + [#idname.rolename%optionname] = Document Title content @@ -2111,6 +2127,24 @@ context 'Sections' do assert appendix.numbered end + test 'should not promote level-0 special section in book doctype to document title' do + input = <<~'EOS' + :doctype: book + + [appendix] + = Installation + + Installation details here. + EOS + + doc = document_from_string input + refute doc.header? + assert_nil doc.attributes['title'] + appendix = doc.blocks[0] + assert_equal 'appendix', appendix.sectname + assert_equal 'Appendix A: ', appendix.caption + end + test 'should prefix appendix title by numbered label even when section numbering is disabled' do input = <<~'EOS' [appendix] |
