diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2022-05-17 02:50:06 -0600 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2022-05-17 02:57:13 -0600 |
| commit | 576f73949c856b16cd9fe170c18bb240f406feed (patch) | |
| tree | d784ea7090341441e99ae45e6345712c02ddbcb7 /spec | |
| parent | e33f357ca15af4b40a6f07fad9633317713a5f91 (diff) | |
add test to verify ink_general_heading can handle article doctitle
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/converter_spec.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/converter_spec.rb b/spec/converter_spec.rb index 128bfad2..8f6d7763 100644 --- a/spec/converter_spec.rb +++ b/spec/converter_spec.rb @@ -1282,6 +1282,36 @@ describe Asciidoctor::PDF::Converter do (expect pdf.images).to have_size 1 end + it 'should allow custom converter to override ink_general_heading for article doctitle' do + backend = nil + create_class (Asciidoctor::Converter.for 'pdf') do + register_for (backend = %(pdf#{object_id}).to_sym) + def ink_general_heading _sect, title, opts = {} + return super unless opts[:role] == :doctitle + theme_font :heading_doctitle do + ink_prose title, align: :center, margin: 0 + end + theme_margin :heading_doctitle, :bottom + end + end + + pdf_theme = { heading_doctitle_font_color: '0000EE', heading_doctitle_margin_bottom: 24 } + pdf = to_pdf <<~'EOS', backend: backend, pdf_theme: pdf_theme, analyze: true + = Article Title + + First paragraph of body. + First paragraph of body. + First paragraph of body. + First paragraph of body. + EOS + + (expect pdf.pages).to have_size 1 + title_text = pdf.find_unique_text 'Article Title' + (expect title_text[:font_color]).to eql '0000EE' + para_text = pdf.text[1] + (expect title_text[:y] - (para_text[:y] + para_text[:font_size])).to be > 24 + end + it 'should remap layout_ methods added by prepended module' do backend = nil converter_class = create_class (Asciidoctor::Converter.for 'pdf') do |
