summaryrefslogtreecommitdiff
path: root/spec/section_spec.rb
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2021-11-04 23:53:20 -0600
committerDan Allen <dan.j.allen@gmail.com>2021-11-05 00:43:33 -0600
commitabec0d22bba4211a6a861d098dd252cb72c1f9b2 (patch)
treedb4c1fdfe6bdb6198c47f1726569b44c816e90f2 /spec/section_spec.rb
parent5a83c9b078c8bea5cae4003982e09a23b969ebd8 (diff)
allow title of special section to be hidden by setting untitled option on section
Diffstat (limited to 'spec/section_spec.rb')
-rw-r--r--spec/section_spec.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/section_spec.rb b/spec/section_spec.rb
index a6d8a7f5..c338aeb8 100644
--- a/spec/section_spec.rb
+++ b/spec/section_spec.rb
@@ -713,6 +713,41 @@ describe 'Asciidoctor::PDF::Converter - Section' do
(expect appendix_text[:page_number]).to be 4
end
+ it 'should not output section title for special section marked with untitled option' do
+ pdf = to_pdf <<~'EOS', pdf_theme: { heading_h2_font_color: 'AA0000' }, analyze: true
+ = Document Title
+ :doctype: book
+
+ [colophon%untitled]
+ = Hide Me
+
+ Colophon with no title.
+
+ = Part
+
+ == Chapter
+
+ content
+
+ [appendix]
+ = Details
+
+ We let you know.
+ EOS
+
+ colophon_page_text = pdf.find_text page_number: 2
+ (expect colophon_page_text).to have_size 1
+ (expect colophon_page_text[0][:string]).to eql 'Colophon with no title.'
+ chapter_texts = pdf.find_text font_color: 'AA0000'
+ (expect chapter_texts).to have_size 2
+ chapter_text = chapter_texts[0]
+ (expect chapter_text[:string]).to eql 'Chapter'
+ (expect chapter_text[:page_number]).to be 4
+ appendix_text = chapter_texts[1]
+ (expect appendix_text[:string]).to eql 'Appendix A: Details'
+ (expect appendix_text[:page_number]).to be 5
+ end
+
it 'should not promote anonymous preface in book doctype to preface section if preface-title attribute is not set' do
input = <<~'EOS'
= Book Title