diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2022-05-15 13:15:03 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-15 13:15:03 -0600 |
| commit | 229e6428a7e244a368fe8b1ae8a946999f821695 (patch) | |
| tree | af5e37a00c5e4a513ad93f8edcb640fadc76a0bb /spec | |
| parent | d279b7615c8a143c44b71a924802a3dc4b79e3a1 (diff) | |
resolves #2161 allow hyphenation to be turned on and configured using base-hyphens key in theme (PR #2162)
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/hyphens_spec.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/hyphens_spec.rb b/spec/hyphens_spec.rb index 2317f60d..c8bd20ad 100644 --- a/spec/hyphens_spec.rb +++ b/spec/hyphens_spec.rb @@ -19,6 +19,31 @@ describe 'Asciidoctor::PDF::Converter - Hyphens', if: (gem_available? 'text-hyph (expect defined? Text::Hyphen).to be_truthy end + it 'should hyphenate text in paragraph if base-hyphens key in theme is set to truthy value' do + [true, ''].each do |base_hyphens| + pdf = to_pdf <<~'EOS', pdf_theme: { base_hyphens: base_hyphens }, analyze: true + This story chronicles the inexplicable hazards and vicious beasts a team must conquer and vanquish. + EOS + + lines = pdf.lines + (expect lines).to have_size 2 + (expect lines[0]).to end_with ?\u00ad + (expect lines[0].count ?\u00ad).to be 1 + end + end + + it 'should not hyphenate text in paragraph if base-hyphens key in theme is set but hyphens attribute is unset' do + pdf = to_pdf <<~'EOS', pdf_theme: { base_hyphens: '' }, analyze: true + :!hyphens: + + This story chronicles the inexplicable hazards and vicious beasts a team must conquer and vanquish. + EOS + + lines = pdf.lines + (expect lines).to have_size 2 + (expect lines.join ?\n).not_to include ?\u00ad + end + it 'should hyphenate text split across multiple lines' do pdf = to_pdf <<~'EOS', analyze: true :hyphens: |
