diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2022-08-11 23:53:33 -0600 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2022-08-12 02:00:59 -0600 |
| commit | 6bfe9de09bd9d7dc7172d619d79eab77469a3180 (patch) | |
| tree | 481fde5bed86a331dd630b436cdb6bd839682423 | |
| parent | 55a2d6d4d54d262ac983a7c412a20e6e9ea4a139 (diff) | |
support text alignment roles on verse block
| -rw-r--r-- | CHANGELOG.adoc | 3 | ||||
| -rw-r--r-- | lib/asciidoctor/pdf/converter.rb | 2 | ||||
| -rw-r--r-- | spec/quote_spec.rb | 2 | ||||
| -rw-r--r-- | spec/verse_spec.rb | 12 |
4 files changed, 16 insertions, 3 deletions
diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index a4cbfc42..230e1514 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -20,11 +20,12 @@ Bug Fixes:: * apply text transform and formatting when computing height of background for caption * honor theme settings (`prose-margin-inner` and `prose-text-indent-inner`) for inner paragraphs in abstract * only indent text that starts at left margin (i.e., when text align is left or justify) (#2298) -* support text alignment roles on style paragraphs Compliance:: * remove support for deprecated `spread` role on table +* support text alignment roles on style paragraphs +* support text alignment roles on verse block == 2.2.0 (2022-07-22) - @mojavelinux diff --git a/lib/asciidoctor/pdf/converter.rb b/lib/asciidoctor/pdf/converter.rb index bf6c22b4..50b9ed72 100644 --- a/lib/asciidoctor/pdf/converter.rb +++ b/lib/asciidoctor/pdf/converter.rb @@ -1279,7 +1279,7 @@ module Asciidoctor content = guard_indentation node.content ink_prose content, normalize: false, - align: :left, + align: (resolve_text_align_from_role node.roles) || :left, hyphenate: true, margin_bottom: 0, bottom_gutter: (attribution ? nil : @bottom_gutters[-1][node]) diff --git a/spec/quote_spec.rb b/spec/quote_spec.rb index 78a800d7..0b212ada 100644 --- a/spec/quote_spec.rb +++ b/spec/quote_spec.rb @@ -101,7 +101,7 @@ describe 'Asciidoctor::PDF::Converter - Quote' do (expect link_annotation[:Rect][2]).to eql (citetitle_text[:x] + citetitle_text[:width]) end - it 'should honor text align role on styled paragraph' do + it 'should honor text alignment role on styled paragraph' do pdf = to_pdf <<~'EOS', analyze: true [quote.text-right] Yep. diff --git a/spec/verse_spec.rb b/spec/verse_spec.rb index 5aec7b59..917d4e47 100644 --- a/spec/verse_spec.rb +++ b/spec/verse_spec.rb @@ -64,6 +64,18 @@ describe 'Asciidoctor::PDF::Converter - Verse' do (expect lines[2]).to eql %(\u00a0 go) end + it 'should honor text alignment role' do + pdf = to_pdf <<~'EOS', analyze: true + [verse.text-right] + ____ + Over here. + ____ + EOS + + midpoint = pdf.pages[0][:size][0] * 0.5 + (expect (pdf.find_unique_text 'Over here.')[:x]).to be > midpoint + end + it 'should not draw left border if border_left_width is 0' do pdf = to_pdf <<~'EOS', pdf_theme: { verse_border_left_width: 0 }, analyze: :line [verse] |
