Skip to content

Commit

Permalink
fix crash when converting chronicles example using bare theme
Browse files Browse the repository at this point in the history
  • Loading branch information
mojavelinux committed May 4, 2022
1 parent 26b57b3 commit b56c8a5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/asciidoctor/pdf/converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@ def prepare_theme theme
theme.description_list_term_spacing ||= 0
theme.description_list_description_indent ||= 0
theme.table_border_width ||= 0.5
theme.thematic_break_border_color ||= '000000'
theme.image_border_width ||= 0
theme.code_linenum_font_color ||= '999999'
theme.callout_list_margin_top_after_code ||= 0
Expand Down Expand Up @@ -2414,7 +2415,7 @@ def @bounding_box.move_past_bottom *args # rubocop:disable Lint/NestedMethodDefi
align: :left,
inline_format: false,
margin_bottom: @theme.description_list_term_spacing,
style: @theme.description_list_term_font_style.to_sym
style: (@theme.description_list_term_font_style || 'bold').to_sym
category.terms.each {|term| convert_index_list_item term }
# NOTE: see previous note for why we can't use margin_bottom method
if @theme.prose_margin_bottom > y - reference_bounds.absolute_bottom
Expand Down
7 changes: 7 additions & 0 deletions spec/converter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,13 @@
(expect (pdf.find_text 'one')[0]).not_to be_nil
end

it 'should not crash if theme does not specify any keys when converting chronicles example' do
input_path = Pathname.new example_file 'chronicles-example.adoc'
pdf = to_pdf input_path, attribute_overrides: { 'imagesdir' => '@', 'pdf-theme' => (fixture_file 'bare-theme.yml') }
(expect pdf.pages).to have_size 14
(expect (pdf.page 1).text).to include 'Documentation Chronicles'
end

it 'should convert background position to options' do
converter = Asciidoctor::Converter.create 'pdf'
{
Expand Down

0 comments on commit b56c8a5

Please sign in to comment.