Skip to content

Commit

Permalink
resolves #388 Duplicate inline image rendering
Browse files Browse the repository at this point in the history
- decrement amount of placeholder characters if their width exceeds max width
  • Loading branch information
fap committed Dec 7, 2016
1 parent 0778f91 commit 98fc393
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/asciidoctor-pdf/formatted_text/inline_image_arranger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ def arrange_images fragments
# NOTE make room for the image by repeating the image placeholder character
# TODO could use character spacing as an alternative to repeating characters
# HACK we could use a nicer API from Prawn here to reserve width in a line
fragment[:text] = ImagePlaceholderChar * (fragment[:image_width] / spacer_w).ceil
spacer_cnt = (fragment[:image_width] / spacer_w).ceil
spacer_cnt -= 1 if spacer_cnt * spacer_w > available_width
fragment[:text] = ImagePlaceholderChar * spacer_cnt
#fragment[:width] = fragment[:image_width]
rescue => e
warn %(asciidoctor: WARNING: could not embed image: #{image_path}; #{e.message})
Expand Down

0 comments on commit 98fc393

Please sign in to comment.