summaryrefslogtreecommitdiff
path: root/spec/list_spec.rb
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2022-10-29 23:57:32 -0600
committerDan Allen <dan.j.allen@gmail.com>2022-10-30 00:48:38 -0600
commit6a10b70be201a98ffd3d2fb99e5f8ef237ace3d2 (patch)
tree827cfa88ac94bd5e590c5d6f89444e889e404e4b /spec/list_spec.rb
parent22b98c054c940d10f5eef8db03169ac0fa5823b7 (diff)
switch from EOS to END as heredoc delimiter
Diffstat (limited to 'spec/list_spec.rb')
-rw-r--r--spec/list_spec.rb500
1 files changed, 250 insertions, 250 deletions
diff --git a/spec/list_spec.rb b/spec/list_spec.rb
index 433557ae..8e865168 100644
--- a/spec/list_spec.rb
+++ b/spec/list_spec.rb
@@ -5,13 +5,13 @@ require_relative 'spec_helper'
describe 'Asciidoctor::PDF::Converter - List' do
context 'Unordered' do
it 'should use different marker for first three list levels' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
* level one
** level two
*** level three
**** level four
* back to level one
- EOS
+ END
expected_lines = [
'• level one',
@@ -25,12 +25,12 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should indent each nested list' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
* level one
** level two
*** level three
* back to level one
- EOS
+ END
prev_it = nil
%w(one two three).each do |it|
@@ -45,13 +45,13 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should use list item spacing between lineal lists' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
* yak
* foo
** bar
* yin
** yang
- EOS
+ END
item_texts = pdf.find_text %r/^\p{Alpha}/
(expect item_texts).to have_size 5
@@ -63,7 +63,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should disable indent for list if list_indent is 0' do
- pdf = to_pdf <<~'EOS', pdf_theme: { list_indent: 0 }, analyze: true
+ pdf = to_pdf <<~'END', pdf_theme: { list_indent: 0 }, analyze: true
before
* a
@@ -71,7 +71,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
* c
after
- EOS
+ END
(expect pdf.lines).to include %(\u2022 a)
before_text = pdf.find_unique_text 'before'
@@ -80,24 +80,24 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should use marker specified by style' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
[square]
* one
* two
* three
- EOS
+ END
(expect pdf.lines).to eql ['▪ one', '▪ two', '▪ three']
end
it 'should emit warning if list style is unrecognized and fall back to disc' do
(expect do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
[oval]
* one
* two
* three
- EOS
+ END
(expect pdf.find_text ?\u2022).to have_size 3
end).to log_message severity: :WARN, message: 'unknown unordered list style: oval'
@@ -105,7 +105,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
it 'should not emit warning if list style is unrecognized in scratch document' do
(expect do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
[%unbreakable]
--
[foobarbaz]
@@ -113,21 +113,21 @@ describe 'Asciidoctor::PDF::Converter - List' do
* bar
* baz
--
- EOS
+ END
(expect pdf.find_text ?\u2022).to have_size 3
end).to log_message severity: :WARN, message: 'unknown unordered list style: foobarbaz' # asserts count of 1
end
it 'should make bullets invisible if list has no-bullet style' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
reference
[no-bullet]
* wood
* hammer
* nail
- EOS
+ END
(expect pdf.lines[1..-1]).to eql %w(wood hammer nail)
left_margin = pdf.text[0][:x]
@@ -138,7 +138,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should disable indent for no-bullet list if list_indent is 0' do
- pdf = to_pdf <<~'EOS', pdf_theme: { list_indent: 0 }, analyze: true
+ pdf = to_pdf <<~'END', pdf_theme: { list_indent: 0 }, analyze: true
before
[no-bullet]
@@ -147,7 +147,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
* c
after
- EOS
+ END
(expect pdf.lines).to include 'a'
before_text = pdf.find_unique_text 'before'
@@ -156,7 +156,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should apply proper indentation for each list style that hides the marker' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
reference
[unstyled]
@@ -167,7 +167,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
[none]
* none
- EOS
+ END
(expect pdf.text).to have_size 4
left_margin = (pdf.find_unique_text 'reference')[:x]
@@ -181,7 +181,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
it 'should not indent list with no marker if list indent is not set or set to 0 in theme' do
[nil, 0].each do |indent|
- pdf = to_pdf <<~'EOS', pdf_theme: { list_indent: indent }, analyze: true
+ pdf = to_pdf <<~'END', pdf_theme: { list_indent: indent }, analyze: true
before
[no-bullet]
@@ -190,7 +190,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
* c
after
- EOS
+ END
left_margin = (pdf.find_unique_text 'before')[:x]
none_item = pdf.find_unique_text 'a'
@@ -205,22 +205,22 @@ describe 'Asciidoctor::PDF::Converter - List' do
ulist_marker_square_content: '$',
}
- pdf = to_pdf <<~'EOS', pdf_theme: pdf_theme, analyze: true
+ pdf = to_pdf <<~'END', pdf_theme: pdf_theme, analyze: true
* diamond
** dotted circle
*** dollar
- EOS
+ END
(expect pdf.lines).to eql [%(\u25ca diamond), %(\u25cc dotted circle), '$ dollar']
end
it 'should allow theme to change marker color for ulist' do
[:list_marker_font_color, :ulist_marker_font_color].each do |key|
- pdf = to_pdf <<~'EOS', pdf_theme: { key => '00FF00' }, analyze: true
+ pdf = to_pdf <<~'END', pdf_theme: { key => '00FF00' }, analyze: true
* all
* the
* things
- EOS
+ END
marker_colors = (pdf.find_text ?\u2022).map {|it| it[:font_color] }.uniq
(expect marker_colors).to eql ['00FF00']
@@ -235,11 +235,11 @@ describe 'Asciidoctor::PDF::Converter - List' do
ulist_marker_line_height: 0.625,
}
- pdf = to_pdf <<~'EOS', pdf_theme: pdf_theme, analyze: true
+ pdf = to_pdf <<~'END', pdf_theme: pdf_theme, analyze: true
* all
* the
* things
- EOS
+ END
marker = (pdf.find_text %(\u2022))[0]
text = pdf.find_unique_text 'all'
@@ -251,11 +251,11 @@ describe 'Asciidoctor::PDF::Converter - List' do
it 'should allow theme to change marker font style for ulist' do
pdf_theme = { ulist_marker_font_style: 'bold' }
- pdf = to_pdf <<~'EOS', pdf_theme: pdf_theme, analyze: true
+ pdf = to_pdf <<~'END', pdf_theme: pdf_theme, analyze: true
* one
* two
* three
- EOS
+ END
marker = (pdf.find_text ?\u2022)[0]
(expect marker[:font_name]).to eql 'NotoSerif-Bold'
@@ -264,12 +264,12 @@ describe 'Asciidoctor::PDF::Converter - List' do
it 'should allow theme to change specific marker font style for ulist' do
pdf_theme = { ulist_marker_circle_font_style: 'bold' }
- pdf = to_pdf <<~'EOS', pdf_theme: pdf_theme, analyze: true
+ pdf = to_pdf <<~'END', pdf_theme: pdf_theme, analyze: true
[circle]
* one
* two
* three
- EOS
+ END
marker = (pdf.find_text ?\u25e6)[0]
(expect marker[:font_name]).to eql 'NotoSerif-Bold'
@@ -280,9 +280,9 @@ describe 'Asciidoctor::PDF::Converter - List' do
extends: 'default-with-font-fallbacks',
ulist_marker_disc_content: ?\u2055,
}
- pdf = to_pdf <<~'EOS', pdf_theme: pdf_theme, analyze: true
+ pdf = to_pdf <<~'END', pdf_theme: pdf_theme, analyze: true
* missing marker
- EOS
+ END
marker_text = pdf.find_unique_text ?\u2055
(expect marker_text[:width]).to eql 5.25
@@ -295,9 +295,9 @@ describe 'Asciidoctor::PDF::Converter - List' do
ulist_marker_disc_content: ?\uf192,
}
- pdf = to_pdf <<~'EOS', pdf_theme: pdf_theme, analyze: true
+ pdf = to_pdf <<~'END', pdf_theme: pdf_theme, analyze: true
* bullseye!
- EOS
+ END
(expect pdf.lines).to eql [%(\uf192 bullseye!)]
marker_text = pdf.find_unique_text ?\uf192
@@ -307,11 +307,11 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should not insert extra blank line if list item text is forced to break' do
- pdf = to_pdf <<~EOS, analyze: true
+ pdf = to_pdf <<~END, analyze: true
* #{'a' * 100}
* b +
b
- EOS
+ END
a1_marker_text, b1_marker_text = pdf.find_text ?\u2022
a1_text, a2_text = pdf.find_text %r/^a+$/
@@ -322,11 +322,11 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should use consistent line height even if list item is entirely monospace' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
* foo
* `mono`
* bar
- EOS
+ END
mark_texts = pdf.find_text '•'
(expect mark_texts).to have_size 3
@@ -336,12 +336,12 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should apply consistent line height to wrapped line that only contained monospaced text' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
* A list item containing a `short code phrase` and a `slightly longer code phrase` and a `very long code phrase that wraps to the next line`
* B +
`code phrase for reference`
* C
- EOS
+ END
mark_texts = pdf.find_text ?\u2022
a1_text = pdf.find_unique_text %r/^A /
@@ -355,11 +355,11 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should apply correct margin if primary text of list item is blank' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
* foo
* {blank}
* bar
- EOS
+ END
mark_texts = pdf.find_text '•'
(expect mark_texts).to have_size 3
@@ -369,11 +369,11 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should align first block of list item with marker if primary text is blank' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
* {blank}
+
text
- EOS
+ END
text = pdf.text
(expect text).to have_size 2
@@ -381,7 +381,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should keep list marker with primary text' do
- pdf = to_pdf <<~EOS, analyze: true
+ pdf = to_pdf <<~END, analyze: true
:pdf-page-size: 52mm x 74mm
:pdf-page-margin: 0
@@ -390,7 +390,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
....
* list item
- EOS
+ END
marker_text = pdf.find_unique_text ?\u2022
(expect marker_text[:page_number]).to be 2
@@ -399,7 +399,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should position marker correctly when media is prepress and list item is advanced to next page' do
- pdf = to_pdf <<~'EOS', pdf_theme: { prose_margin_bottom: 705.5 }, analyze: true
+ pdf = to_pdf <<~'END', pdf_theme: { prose_margin_bottom: 705.5 }, analyze: true
:media: prepress
filler
@@ -407,7 +407,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
* first
* middle
* last
- EOS
+ END
marker_texts = pdf.find_text '•', page_number: 2
(expect marker_texts).to have_size 2
@@ -415,7 +415,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should position marker correctly when media is prepress and list item is split across page' do
- pdf = to_pdf <<~'EOS', pdf_theme: { prose_margin_bottom: 705 }, analyze: true
+ pdf = to_pdf <<~'END', pdf_theme: { prose_margin_bottom: 705 }, analyze: true
:media: prepress
filler
@@ -424,7 +424,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
* middle +
more middle
* last
- EOS
+ END
(expect (pdf.find_unique_text 'middle')[:page_number]).to be 1
(expect (pdf.find_text '•')[1][:page_number]).to be 1
@@ -434,7 +434,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
it 'should reuse next page of block with background when positioning marker when media is prepress' do
filler = ['filler']
filler_list_item = ['* Ex nam suas nemore dignissim, vel apeirian democritum et. At ornatus splendide sed, phaedrum omittantur usu an, vix an noster voluptatibus.']
- pdf = to_pdf <<~EOS
+ pdf = to_pdf <<~END
:media: prepress
.Sidebar
@@ -457,7 +457,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
[%hardbreaks]
#{filler * 5 * ?\n}
- EOS
+ END
pages = pdf.pages
(expect pages).to have_size 3
@@ -473,27 +473,27 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should allow text alignment to be set using role', visual: true do
- to_file = to_pdf_file <<~EOS, 'list-text-left-role.pdf'
+ to_file = to_pdf_file <<~END, 'list-text-left-role.pdf'
[.text-left]
* #{lorem_ipsum '2-sentences-1-paragraph'}
- EOS
+ END
(expect to_file).to visually_match 'list-text-left.pdf'
end
it 'should allow text alignment to be set using theme', visual: true do
- to_file = to_pdf_file <<~EOS, 'list-text-left-theme.pdf', pdf_theme: { list_text_align: 'left' }
+ to_file = to_pdf_file <<~END, 'list-text-left-theme.pdf', pdf_theme: { list_text_align: 'left' }
* #{lorem_ipsum '2-sentences-1-paragraph'}
- EOS
+ END
(expect to_file).to visually_match 'list-text-left.pdf'
end
end
context 'Checklist' do
it 'should replace markers with checkboxes in checklist' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
* [ ] todo
* [x] done
- EOS
+ END
(expect pdf.lines).to eql [%(\u2610 todo), %(\u2611 done)]
end
@@ -504,10 +504,10 @@ describe 'Asciidoctor::PDF::Converter - List' do
ulist_marker_checked_content: ?\u25d9,
}
- pdf = to_pdf <<~'EOS', pdf_theme: pdf_theme, analyze: true
+ pdf = to_pdf <<~'END', pdf_theme: pdf_theme, analyze: true
* [ ] todo
* [x] done
- EOS
+ END
(expect pdf.lines).to eql [%(\u25d8 todo), %(\u25d9 done)]
end
@@ -517,9 +517,9 @@ describe 'Asciidoctor::PDF::Converter - List' do
extends: 'default-with-font-fallbacks',
ulist_marker_checked_content: ?\u303c,
}
- to_file = to_pdf_file <<~'EOS', 'list-checked-glyph-fallback.pdf', pdf_theme: pdf_theme
+ to_file = to_pdf_file <<~'END', 'list-checked-glyph-fallback.pdf', pdf_theme: pdf_theme
* [x] done
- EOS
+ END
(expect to_file).to visually_match 'list-checked-glyph-fallback.pdf'
end
@@ -533,10 +533,10 @@ describe 'Asciidoctor::PDF::Converter - List' do
ulist_marker_checked_content: ?\uf046,
}
- pdf = to_pdf <<~'EOS', pdf_theme: pdf_theme, analyze: true
+ pdf = to_pdf <<~'END', pdf_theme: pdf_theme, analyze: true
* [ ] todo
* [x] done
- EOS
+ END
(expect pdf.lines).to eql [%(\uf096 todo), %(\uf046 done)]
unchecked_marker_text = pdf.find_unique_text ?\uf096
@@ -551,7 +551,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
context 'Ordered' do
it 'should number list items using arabic, loweralpha, lowerroman, upperalpha, upperroman numbering by default' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
. 1
.. a
... i
@@ -559,13 +559,13 @@ describe 'Asciidoctor::PDF::Converter - List' do
..... I
. 2
. 3
- EOS
+ END
(expect pdf.lines).to eql ['1. 1', 'a. a', 'i. i', 'A. A', 'I. I', '2. 2', '3. 3']
end
it 'should indent each nested list' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
. 1
.. a
... i
@@ -573,7 +573,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
..... I
. 2
. 3
- EOS
+ END
prev_it = nil
%w(1 a i A I).each do |it|
@@ -588,24 +588,24 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should use marker specified by style' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
[lowerroman]
. one
. two
. three
- EOS
+ END
(expect pdf.lines).to eql ['i. one', 'ii. two', 'iii. three']
end
it 'should fall back to arabic if list style is unknown' do
(expect do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
[binary]
. one
. two
. three
- EOS
+ END
(expect pdf.lines[0]).to eql '1. one'
end).to not_log_message
@@ -613,10 +613,10 @@ describe 'Asciidoctor::PDF::Converter - List' do
it 'should support decimal marker style' do
blank_line = %(\n\n)
- pdf = to_pdf <<~EOS, analyze: true
+ pdf = to_pdf <<~END, analyze: true
[decimal]
#{(?a..?z).map {|c| '. ' + c }.join blank_line}
- EOS
+ END
lines = pdf.lines
(expect lines).to have_size 26
@@ -626,10 +626,10 @@ describe 'Asciidoctor::PDF::Converter - List' do
it 'should support decimal marker style when start value has two digits' do
blank_line = %(\n\n)
- pdf = to_pdf <<~EOS, analyze: true
+ pdf = to_pdf <<~END, analyze: true
[decimal,start=10]
#{(?a..?z).map {|c| '. ' + c }.join blank_line}
- EOS
+ END
lines = pdf.lines
(expect lines).to have_size 26
@@ -639,11 +639,11 @@ describe 'Asciidoctor::PDF::Converter - List' do
it 'should allow theme to change marker color for olist' do
[:list_marker_font_color, :olist_marker_font_color].each do |key|
- pdf = to_pdf <<~'EOS', pdf_theme: { key => '00FF00' }, analyze: true
+ pdf = to_pdf <<~'END', pdf_theme: { key => '00FF00' }, analyze: true
. one
. two
. three
- EOS
+ END
marker_colors = (pdf.find_text %r/\d\./).map {|it| it[:font_color] }.uniq
(expect marker_colors).to eql ['00FF00']
@@ -657,11 +657,11 @@ describe 'Asciidoctor::PDF::Converter - List' do
olist_marker_line_height: 0.976,
}
- pdf = to_pdf <<~'EOS', pdf_theme: pdf_theme, analyze: true
+ pdf = to_pdf <<~'END', pdf_theme: pdf_theme, analyze: true
. one
. two
. three
- EOS
+ END
marker = pdf.find_unique_text '1.'
text = pdf.find_unique_text 'one'
@@ -673,22 +673,22 @@ describe 'Asciidoctor::PDF::Converter - List' do
it 'should allow theme to change marker font style for olist' do
pdf_theme = { olist_marker_font_style: 'bold' }
- pdf = to_pdf <<~'EOS', pdf_theme: pdf_theme, analyze: true
+ pdf = to_pdf <<~'END', pdf_theme: pdf_theme, analyze: true
. one
. two
. three
- EOS
+ END
marker = pdf.find_unique_text '1.'
(expect marker[:font_name]).to eql 'NotoSerif-Bold'
end
it 'should use consistent line height even if list item is entirely monospace' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
. foo
. `mono`
. bar
- EOS
+ END
mark_texts = pdf.text.select {|it| it[:string].end_with? '.' }
(expect mark_texts).to have_size 3
@@ -698,7 +698,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should align list numbers to right and extend towards left margin' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
. one
. two
. three
@@ -709,7 +709,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
. eight
. nine
. ten
- EOS
+ END
nine_text = pdf.find_unique_text 'nine'
ten_text = pdf.find_unique_text 'ten'
@@ -730,10 +730,10 @@ describe 'Asciidoctor::PDF::Converter - List' do
'loweralpha' => %w(j a),
'upperalpha' => %w(J A),
}.each do |style, (last, first)|
- pdf = to_pdf <<~EOS, analyze: true
+ pdf = to_pdf <<~END, analyze: true
[#{style}%reversed]
#{items.map {|it| %(. #{it}) }.join ?\n}
- EOS
+ END
lines = pdf.lines
expect(lines[0]).to eql %(#{last}. ten)
expect(lines[-1]).to eql %(#{first}. one)
@@ -744,11 +744,11 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should start numbering at value of start attribute if specified' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
[start=9]
. nine
. ten
- EOS
+ END
no1_text = pdf.find_unique_text '1.'
(expect no1_text).to be_nil
@@ -759,11 +759,11 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should start numbering at value of specified start attribute using specified numeration style' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
[upperroman,start=9]
. nine
. ten
- EOS
+ END
no1_text = pdf.find_unique_text 'I.'
(expect no1_text).to be_nil
@@ -774,83 +774,83 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should ignore start attribute if marker is disabled' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
[unstyled,start=10]
. a
. b
. c
- EOS
+ END
(expect pdf.lines).to eql %w(a b c)
end
it 'should ignore start value of 1' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
[start=1]
. one
. two
. three
- EOS
+ END
(expect pdf.lines).to eql ['1. one', '2. two', '3. three']
end
it 'should allow start value to be less than 1 for list with arabic numbering' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
[start=-1]
. negative one
. zero
. positive one
- EOS
+ END
(expect pdf.lines).to eql ['-1. negative one', '0. zero', '1. positive one']
end
it 'should allow start value to be less than 1 for list with roman numbering' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
[lowerroman,start=-1]
. negative one
. zero
. positive one
- EOS
+ END
(expect pdf.lines).to eql ['-1. negative one', '0. zero', 'i. positive one']
end
it 'should allow start value to be less than 1 for list with decimal numbering' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
[decimal,start=-3]
. on
. our
. way
. to
. one
- EOS
+ END
(expect pdf.lines).to eql ['-03. on', '-02. our', '-01. way', '00. to', '01. one']
end
# FIXME: this should be -1, 0, a
it 'should ignore start value less than 1 for list with alpha numbering' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
[loweralpha,start=-1]
. negative one
. zero
. positive one
- EOS
+ END
(expect pdf.lines).to eql ['a. negative one', 'b. zero', 'c. positive one']
end
it 'should make numbers invisible if list has unnumbered style' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
reference
[unnumbered]
. one
. two
. three
- EOS
+ END
(expect pdf.lines[1..-1]).to eql %w(one two three)
left_margin = pdf.text[0][:x]
@@ -861,7 +861,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should apply proper indentation for each list style that hides the marker' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
reference
[unstyled]
@@ -875,7 +875,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
[none]
. none
- EOS
+ END
(expect pdf.text).to have_size 5
left_margin = (pdf.find_unique_text 'reference')[:x]
@@ -890,7 +890,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should keep list marker with primary text' do
- pdf = to_pdf <<~EOS, analyze: true
+ pdf = to_pdf <<~END, analyze: true
:pdf-page-size: 52mm x 74mm
:pdf-page-margin: 0
@@ -899,7 +899,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
....
. list item
- EOS
+ END
marker_text = pdf.find_unique_text '1.'
(expect marker_text[:page_number]).to be 2
@@ -910,7 +910,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
context 'Mixed' do
it 'should use correct default markers for mixed nested lists' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
* l1
. l2
** l3
@@ -918,14 +918,14 @@ describe 'Asciidoctor::PDF::Converter - List' do
*** l5
... l6
* l1
- EOS
+ END
(expect pdf.lines).to eql ['• l1', '1. l2', '▪ l3', 'a. l4', '▪ l5', 'i. l6', '• l1']
end
# NOTE: expand this test as necessary to cover the various permutations
it 'should not insert excess space between nested lists or list items with block content', visual: true do
- to_file = to_pdf_file <<~'EOS', 'list-complex-nested.pdf'
+ to_file = to_pdf_file <<~'END', 'list-complex-nested.pdf'
* list item
. first
+
@@ -940,7 +940,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
attached paragraph
* list item
- EOS
+ END
(expect to_file).to visually_match 'list-complex-nested.pdf'
end
@@ -948,7 +948,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
context 'Description' do
it 'should keep term with primary text' do
- pdf = to_pdf <<~EOS, analyze: true
+ pdf = to_pdf <<~END, analyze: true
:pdf-page-size: 52mm x 80mm
:pdf-page-margin: 0
@@ -958,7 +958,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
term::
desc
- EOS
+ END
term_text = pdf.find_unique_text 'term'
(expect term_text[:page_number]).to be 2
@@ -967,7 +967,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should keep all terms with primary text' do
- pdf = to_pdf <<~EOS, analyze: true
+ pdf = to_pdf <<~END, analyze: true
:pdf-page-size: 52mm x 87.5mm
:pdf-page-margin: 0
@@ -978,7 +978,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
term 1::
term 2::
desc
- EOS
+ END
term1_text = pdf.find_unique_text 'term 1'
(expect term1_text[:page_number]).to be 2
@@ -1011,11 +1011,11 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should allow theme to control line height of term' do
- input = <<~'EOS'
+ input = <<~'END'
first term::
second term::
description
- EOS
+ END
pdf = to_pdf input, analyze: true
@@ -1030,7 +1030,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should support complex content', visual: true do
- to_file = to_pdf_file <<~'EOS', 'list-complex-dlist.pdf'
+ to_file = to_pdf_file <<~'END', 'list-complex-dlist.pdf'
term::
desc
+
@@ -1040,14 +1040,14 @@ describe 'Asciidoctor::PDF::Converter - List' do
yin::
yang
- EOS
+ END
(expect to_file).to visually_match 'list-complex-dlist.pdf'
end
it 'should put margin below description when item has an attached block' do
pdf_theme = { base_line_height: 1, sidebar_background_color: 'transparent' }
- input = <<~'EOS'
+ input = <<~'END'
term:: desc
+
****
@@ -1057,7 +1057,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
****
after
****
- EOS
+ END
pdf = to_pdf input, pdf_theme: pdf_theme, analyze: true
horizontal_lines = (to_pdf input, pdf_theme: pdf_theme, analyze: :line).lines
@@ -1068,11 +1068,11 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should use narrow spacing around lineal list' do
- pdf = to_pdf <<~'EOS', pdf_theme: { extends: 'base', base_line_height: 1 }, analyze: true
+ pdf = to_pdf <<~'END', pdf_theme: { extends: 'base', base_line_height: 1 }, analyze: true
yin::
* foobar
yang::
- EOS
+ END
spacing_above = (pdf.find_unique_text %r/^yin/)[:y] - (pdf.find_unique_text 'foobar').yield_self {|it| it[:y] + it[:font_size] }
spacing_below = (pdf.find_unique_text 'foobar')[:y] - (pdf.find_unique_text 'yang').yield_self {|it| it[:y] + it[:font_size] }
@@ -1081,12 +1081,12 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should put margin below description when item has a single nested list' do
- input = <<~'EOS'
+ input = <<~'END'
term:: desc
* nested item
after
- EOS
+ END
pdf = to_pdf input, pdf_theme: { base_line_height: 1 }, analyze: true
desc_text = pdf.find_unique_text 'desc'
@@ -1099,10 +1099,10 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should support last item with no description' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
yin:: yang
foo::
- EOS
+ END
(expect pdf.lines).to eql %w(yin yang foo)
(expect pdf.find_text 'foo').not_to be_empty
@@ -1112,7 +1112,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should apply correct margin to last item with no description' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
[cols=2*a]
|===
|
@@ -1124,7 +1124,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
|
term:: desc
|===
- EOS
+ END
after_text = pdf.find_unique_text 'after'
desc_text = pdf.find_unique_text 'desc'
@@ -1135,10 +1135,10 @@ describe 'Asciidoctor::PDF::Converter - List' do
context 'Horizontal' do
it 'should not modify original document model during conversion' do
- doc = Asciidoctor.load <<~'EOS', backend: 'pdf'
+ doc = Asciidoctor.load <<~'END', backend: 'pdf'
[horizontal]
foo:: bar
- EOS
+ END
original_dlist = doc.blocks[0]
original_term, original_desc = (original_item = (original_items = original_dlist.items)[0])
@@ -1153,11 +1153,11 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should arrange horizontal list in two columns' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
[horizontal]
foo:: bar
yin:: yang
- EOS
+ END
foo_text = pdf.find_unique_text 'foo'
bar_text = pdf.find_unique_text 'bar'
@@ -1171,10 +1171,10 @@ describe 'Asciidoctor::PDF::Converter - List' do
description_list_term_font_color: 'AA0000',
description_list_term_text_transform: 'uppercase',
}
- pdf = to_pdf <<~'EOS', pdf_theme: pdf_theme, analyze: true
+ pdf = to_pdf <<~'END', pdf_theme: pdf_theme, analyze: true
[horizontal]
term:: desc
- EOS
+ END
term_text = pdf.find_unique_text 'TERM'
(expect term_text[:font_name]).to eql 'NotoSerif-Italic'
@@ -1182,12 +1182,12 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should allow theme to control line height of term' do
- input = <<~'EOS'
+ input = <<~'END'
[horizontal]
first term::
second term::
description
- EOS
+ END
pdf = to_pdf input, analyze: true
@@ -1202,12 +1202,12 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should include title above horizontal list' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
.Balance
[horizontal]
foo:: bar
yin:: yang
- EOS
+ END
title_text = pdf.find_text 'Balance'
(expect title_text).to have_size 1
@@ -1218,10 +1218,10 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should inherit term font styles from theme' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
[horizontal]
__f__oo:: bar
- EOS
+ END
text = pdf.text
(expect text).to have_size 3
@@ -1232,10 +1232,10 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should apply inline formatted to term even if font style is set to normal by theme' do
- pdf = to_pdf <<~'EOS', pdf_theme: { description_list_term_font_style: 'normal' }, analyze: true
+ pdf = to_pdf <<~'END', pdf_theme: { description_list_term_font_style: 'normal' }, analyze: true
[horizontal]
**f**oo:: bar
- EOS
+ END
text = pdf.text
(expect text).to have_size 3
@@ -1246,11 +1246,11 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should support item with no desc' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
[horizontal]
yin:: yang
foo::
- EOS
+ END
(expect pdf.find_text 'foo').not_to be_empty
yin_text = pdf.find_unique_text 'yin'
@@ -1259,14 +1259,14 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should support item with only blocks' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
[horizontal]
yin::
+
yang
foo:: bar
- EOS
+ END
(expect pdf.lines).to eql ['yin yang', 'foo bar']
yin_text = pdf.find_unique_text 'yin'
@@ -1277,13 +1277,13 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should support multiple terms in horizontal list' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
[horizontal]
foo::
bar::
baz::
desc
- EOS
+ END
(expect pdf.find_text 'foo').not_to be_empty
(expect pdf.find_text 'bar').not_to be_empty
@@ -1295,14 +1295,14 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should align term to top when description spans multiple lines' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
[horizontal]
foo::
desc +
_more desc_
+
even more desc
- EOS
+ END
(expect pdf.find_text 'foo').not_to be_empty
(expect pdf.find_text 'desc').not_to be_empty
@@ -1314,25 +1314,25 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should not break term that does not extend past the midpoint of the page' do
- pdf = to_pdf <<~EOS, analyze: true
+ pdf = to_pdf <<~END, analyze: true
[horizontal]
handoverallthekeystoyourkingdom:: #{(['submit'] * 50).join ' '}
- EOS
+ END
(expect pdf.lines[0]).to start_with 'handoverallthekeystoyourkingdom submit submit'
end
it 'should break term that extends past the midpoint of the page' do
- pdf = to_pdf <<~EOS, analyze: true
+ pdf = to_pdf <<~END, analyze: true
[horizontal]
handoverallthekeystoyourkingdomtomenow:: #{(['submit'] * 50).join ' '}
- EOS
+ END
(expect pdf.lines[0]).not_to start_with 'handoverallthekeystoyourkingdomtomenow'
end
it 'should support complex content in horizontal list', visual: true do
- to_file = to_pdf_file <<~'EOS', 'list-horizontal-dlist.pdf'
+ to_file = to_pdf_file <<~'END', 'list-horizontal-dlist.pdf'
[horizontal]
term::
desc
@@ -1343,14 +1343,14 @@ describe 'Asciidoctor::PDF::Converter - List' do
yin::
yang
- EOS
+ END
(expect to_file).to visually_match 'list-horizontal-dlist.pdf'
end
it 'should correctly compute height of attached delimited block inside dlist at page top' do
pdf_theme = { sidebar_background_color: 'transparent' }
- input = <<~'EOS'
+ input = <<~'END'
[horizontal]
first term::
+
@@ -1361,7 +1361,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
****
sidebar outside list
****
- EOS
+ END
horizontal_lines = (to_pdf input, pdf_theme: pdf_theme, analyze: :line).lines
.select {|it| it[:from][:y] == it[:to][:y] }.sort_by {|it| -it[:from][:y] }
@@ -1373,7 +1373,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
it 'should correctly compute height of attached delimited block inside dlist below page top' do
pdf_theme = { sidebar_background_color: 'transparent' }
- input = <<~'EOS'
+ input = <<~'END'
****
sidebar outside list
****
@@ -1384,7 +1384,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
****
sidebar inside list
****
- EOS
+ END
horizontal_lines = (to_pdf input, pdf_theme: pdf_theme, analyze: :line).lines
.select {|it| it[:from][:y] == it[:to][:y] }.sort_by {|it| -it[:from][:y] }
@@ -1396,7 +1396,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
it 'should leave correct spacing after last attached block' do
pdf_theme = { sidebar_background_color: 'transparent' }
- input = <<~'EOS'
+ input = <<~'END'
[horizontal]
first term::
+
@@ -1413,7 +1413,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
****
sidebar outside list
****
- EOS
+ END
horizontal_lines = (to_pdf input, pdf_theme: pdf_theme, analyze: :line).lines
.select {|it| it[:from][:y] == it[:to][:y] }.sort_by {|it| -it[:from][:y] }
@@ -1426,7 +1426,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
it 'should convert horizontal dlist inside AsciiDoc table cell and not add bottom margin' do
pdf_theme = { sidebar_background_color: 'transparent' }
- input = <<~'EOS'
+ input = <<~'END'
[frame=ends,grid=none]
|===
a|
@@ -1437,7 +1437,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
sidebar for term
****
|===
- EOS
+ END
horizontal_lines = (to_pdf input, pdf_theme: pdf_theme, analyze: :line).lines
.select {|it| it[:from][:y] == it[:to][:y] }.sort_by {|it| -it[:from][:y] }
@@ -1447,7 +1447,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should apply correct margin to last item with no description' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
[cols=2*a]
|===
|
@@ -1463,7 +1463,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
[]
after horizontal
|===
- EOS
+ END
term_texts = pdf.find_text 'term'
(expect term_texts).to have_size 2
@@ -1474,7 +1474,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should use prose margin around dlist nested in regular list' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
[cols=2*a]
|===
|
@@ -1492,7 +1492,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
second list item
|===
- EOS
+ END
['list item', 'term', 'second list item'].each do |string|
texts = pdf.find_text string
@@ -1504,7 +1504,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
context 'Unordered' do
it 'should layout unordered description list like an unordered list with subject in bold' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
[unordered]
item a:: about item a
+
@@ -1516,7 +1516,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
item c::
+
details about item c
- EOS
+ END
(expect pdf.lines).to eql [
'• item a: about item a',
@@ -1531,7 +1531,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should allow subject stop to be customized using subject-stop attribute' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
[unordered,subject-stop=.]
item a:: about item a
+
@@ -1539,13 +1539,13 @@ describe 'Asciidoctor::PDF::Converter - List' do
item b::
about item b
- EOS
+ END
(expect pdf.lines).to eql ['• item a. about item a', 'more about item a', '• item b. about item b']
end
it 'should not add subject stop if subject ends with stop punctuation' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
[unordered,subject-stop=.]
item a.:: about item a
+
@@ -1556,23 +1556,23 @@ describe 'Asciidoctor::PDF::Converter - List' do
well?::
yes
- EOS
+ END
(expect pdf.lines).to eql ['• item a. about item a', 'more about item a', '• item b: about item b', '• well? yes']
end
it 'should add subject stop if subject ends with character reference' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
[unordered]
&:: ampersand
>:: greater than
- EOS
+ END
(expect pdf.lines).to eql ['• &: ampersand', '• >: greater than']
end
it 'should stack subject on top of text if stack role is present' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
[unordered.stack]
item a:: about item a
+
@@ -1580,17 +1580,17 @@ describe 'Asciidoctor::PDF::Converter - List' do
item b::
about item b
- EOS
+ END
(expect pdf.lines).to eql ['• item a', 'about item a', 'more about item a', '• item b', 'about item b']
end
it 'should support item with no desc' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
[unordered]
yin:: yang
foo::
- EOS
+ END
(expect pdf.find_text 'foo').not_to be_empty
yin_text = pdf.find_unique_text 'yin:'
@@ -1601,7 +1601,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
context 'Ordered' do
it 'should layout ordered description list like an ordered list with subject in bold' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
[ordered]
item a:: about item a
+
@@ -1613,7 +1613,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
item c::
+
details about item c
- EOS
+ END
(expect pdf.lines).to eql [
'1. item a: about item a',
@@ -1628,7 +1628,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should allow subject stop to be customized using subject-stop attribute' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
[ordered,subject-stop=.]
item a:: about item a
+
@@ -1636,13 +1636,13 @@ describe 'Asciidoctor::PDF::Converter - List' do
item b::
about item b
- EOS
+ END
(expect pdf.lines).to eql ['1. item a. about item a', 'more about item a', '2. item b. about item b']
end
it 'should not add subject stop if subject ends with stop punctuation' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
[ordered,subject-stop=.]
item a.:: about item a
+
@@ -1653,23 +1653,23 @@ describe 'Asciidoctor::PDF::Converter - List' do
well?::
yes
- EOS
+ END
(expect pdf.lines).to eql ['1. item a. about item a', 'more about item a', '2. item b: about item b', '3. well? yes']
end
it 'should add subject stop if subject ends with character reference' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
[ordered]
&:: ampersand
>:: greater than
- EOS
+ END
(expect pdf.lines).to eql ['1. &: ampersand', '2. >: greater than']
end
it 'should stack subject on top of text if stack role is present' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
[ordered.stack]
item a:: about item a
+
@@ -1677,7 +1677,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
item b::
about item b
- EOS
+ END
(expect pdf.lines).to eql ['1. item a', 'about item a', 'more about item a', '2. item b', 'about item b']
end
@@ -1686,14 +1686,14 @@ describe 'Asciidoctor::PDF::Converter - List' do
context 'Q & A' do
it 'should convert qanda to ordered list' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
[qanda]
What is Asciidoctor?::
An implementation of the AsciiDoc processor in Ruby.
What is the answer to the Ultimate Question?::
42
- EOS
+ END
(expect pdf.strings).to eql [
'1.',
'What is Asciidoctor?',
@@ -1705,20 +1705,20 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should layout Q & A list like a description list with questions in italic', visual: true do
- to_file = to_pdf_file <<~'EOS', 'list-qanda.pdf'
+ to_file = to_pdf_file <<~'END', 'list-qanda.pdf'
[qanda]
What's the answer to the ultimate question?:: 42
Do you have an opinion?::
Would you like to share it?::
Yes and no.
- EOS
+ END
(expect to_file).to visually_match 'list-qanda.pdf'
end
it 'should convert question with only block answer in Q & A list' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
[qanda]
Ultimate Question::
+
@@ -1729,7 +1729,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
Only at the end will you come to understand that the answer is 42.
--
- EOS
+ END
(expect pdf.lines).to eql ['1. Ultimate Question', 'How much time do you have?', 'You must embark on a journey.', 'Only at the end will you come to understand that the answer is 42.']
unanswerable_q_text = pdf.find_unique_text 'Ultimate Question'
@@ -1741,11 +1741,11 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should convert question with no answer in Q & A list' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
[qanda]
Question:: Answer
Unanswerable Question::
- EOS
+ END
unanswerable_q_text = pdf.find_unique_text 'Unanswerable Question'
(expect pdf.lines).to eql ['1. Question', 'Answer', '2. Unanswerable Question']
@@ -1755,7 +1755,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
context 'Callout' do
it 'should use callout numbers as list markers and in referenced block' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
....
line one <1>
line two
@@ -1763,7 +1763,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
....
<1> First line
<2> Last line
- EOS
+ END
one_text = pdf.find_text ?\u2460
two_text = pdf.find_text ?\u2461
@@ -1777,7 +1777,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should use consistent line height even if list item is entirely monospace' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
....
line one <1>
line two <2>
@@ -1786,7 +1786,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
<1> describe one
<2> `describe two`
<3> describe three
- EOS
+ END
mark_texts = [(pdf.find_text ?\u2460)[-1], (pdf.find_text ?\u2461)[-1], (pdf.find_text ?\u2462)[-1]]
(expect mark_texts).to have_size 3
@@ -1797,7 +1797,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
it 'should only separate colist and listing or literal block by list_item_spacing value' do
%w(---- ....).each do |block_delim|
- input = <<~EOS
+ input = <<~END
#{block_delim}
line one <1>
line two
@@ -1805,7 +1805,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
#{block_delim}
<1> First line
<2> Last line
- EOS
+ END
pdf = to_pdf input, analyze: :line
bottom_line_y = pdf.lines[2][:from][:y]
@@ -1822,7 +1822,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should allow theme to control top margin of callout lists that immediately follows a code block', visual: true do
- input = <<~'EOS'
+ input = <<~'END'
----
line one <1>
line two
@@ -1830,7 +1830,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
----
<1> First line
<2> Last line
- EOS
+ END
pdf_theme = { callout_list_margin_top_after_code: 0 }
@@ -1854,17 +1854,17 @@ describe 'Asciidoctor::PDF::Converter - List' do
sidebar_background_color: 'transparent',
}
- ref_input = <<~'EOS'
+ ref_input = <<~'END'
****
. describe first line
****
- EOS
+ END
ref_top_line_y = (to_pdf ref_input, pdf_theme: pdf_theme, analyze: :line).lines.map {|it| it[:from][:y] }.max
ref_text_top = (to_pdf ref_input, pdf_theme: pdf_theme, analyze: true).text[0].yield_self {|it| it[:y] + it[:font_size] }
expected_top_padding = ref_top_line_y - ref_text_top
- input = <<~'EOS'
+ input = <<~'END'
----
line 1 <1>
line 2 <2>
@@ -1878,7 +1878,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
code
----
****
- EOS
+ END
lines = (to_pdf input, pdf_theme: pdf_theme, analyze: :line).lines
pdf = to_pdf input, pdf_theme: pdf_theme, analyze: true
@@ -1897,7 +1897,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
conum_font_size: nil,
}
- pdf = to_pdf <<~'EOS', pdf_theme: pdf_theme, analyze: true
+ pdf = to_pdf <<~'END', pdf_theme: pdf_theme, analyze: true
----
site:
url: https://docs.example.org # <1>
@@ -1905,7 +1905,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
----
<1> The base URL where the site is published.
<2> Allow search engines to crawl the site.
- EOS
+ END
conum_1_text = pdf.find_text ?\u2460
(expect conum_1_text).to have_size 2
@@ -1922,7 +1922,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should not move cursor if callout list appears at top of page' do
- pdf = to_pdf <<~EOS, analyze: true
+ pdf = to_pdf <<~END, analyze: true
key-value pair
----
@@ -1931,7 +1931,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
#{(['- item'] * 46).join ?\n}
----
<1> key-value pair
- EOS
+ END
key_val_texts = pdf.find_text 'key-value pair'
(expect key_val_texts).to have_size 2
@@ -1941,7 +1941,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should not collapse top margin if previous block is not a verbatim block' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
before
----
@@ -1951,11 +1951,11 @@ describe 'Asciidoctor::PDF::Converter - List' do
'''
key-value pair
- EOS
+ END
reference_y = (pdf.find_unique_text 'key-value pair')[:y]
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
before
----
@@ -1965,14 +1965,14 @@ describe 'Asciidoctor::PDF::Converter - List' do
'''
<1> key-value pair
- EOS
+ END
actual_y = (pdf.find_unique_text 'key-value pair')[:y]
(expect actual_y).to eql reference_y
end
it 'should allow conum font color to be customized by theme' do
- pdf = to_pdf <<~'EOS', pdf_theme: { conum_font_color: '0000ff' }, analyze: true
+ pdf = to_pdf <<~'END', pdf_theme: { conum_font_color: '0000ff' }, analyze: true
....
line one <1>
line two
@@ -1980,7 +1980,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
....
<1> First line
<2> Last line
- EOS
+ END
one_text = pdf.find_text ?\u2460
(expect one_text).to have_size 2
@@ -1991,7 +1991,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should allow conum font size and line height in colist to be customized by theme' do
- pdf = to_pdf <<~'EOS', pdf_theme: { conum_font_size: 8, conum_line_height: 1.8 }, analyze: true
+ pdf = to_pdf <<~'END', pdf_theme: { conum_font_size: 8, conum_line_height: 1.8 }, analyze: true
....
line one <1>
line two
@@ -1999,7 +1999,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
....
<1> First line
<2> Last line
- EOS
+ END
one_text = pdf.find_text ?\u2460
(expect one_text).to have_size 2
@@ -2011,7 +2011,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should support filled conum glyphs if specified in theme' do
- pdf = to_pdf <<~'EOS', pdf_theme: { conum_glyphs: 'filled' }, analyze: true
+ pdf = to_pdf <<~'END', pdf_theme: { conum_glyphs: 'filled' }, analyze: true
....
line one <1>
line two
@@ -2019,7 +2019,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
....
<1> First line
<2> Last line
- EOS
+ END
one_text = pdf.find_text ?\u2776
two_text = pdf.find_text ?\u2777
@@ -2032,7 +2032,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should allow conum glyphs to be specified explicitly using numeric range' do
- pdf = to_pdf <<~'EOS', pdf_theme: { conum_glyphs: '1-20' }, analyze: true
+ pdf = to_pdf <<~'END', pdf_theme: { conum_glyphs: '1-20' }, analyze: true
....
line one <1>
line two
@@ -2040,14 +2040,14 @@ describe 'Asciidoctor::PDF::Converter - List' do
....
<1> First line
<2> Last line
- EOS
+ END
one_text = pdf.find_text '1'
(expect one_text).to have_size 2
end
it 'should allow conum glyphs to be specified explicitly using unicode range' do
- pdf = to_pdf <<~'EOS', pdf_theme: { conum_glyphs: '\u0031-\u0039' }, analyze: true
+ pdf = to_pdf <<~'END', pdf_theme: { conum_glyphs: '\u0031-\u0039' }, analyze: true
....
line one <1>
line two
@@ -2055,7 +2055,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
....
<1> First line
<2> Last line
- EOS
+ END
one_text = pdf.find_text '1'
(expect one_text).to have_size 2
@@ -2066,7 +2066,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should allow conum glyphs to be specified explicitly using multiple unicode ranges' do
- pdf = to_pdf <<~'EOS', pdf_theme: { conum_glyphs: '\u2776-\u277a, \u2465-\u2468' }, analyze: true
+ pdf = to_pdf <<~'END', pdf_theme: { conum_glyphs: '\u2776-\u277a, \u2465-\u2468' }, analyze: true
----
1 <1>
2 <2>
@@ -2087,7 +2087,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
<7> 7
<8> 8
<9> 9
- EOS
+ END
conum_lines = pdf.lines.map {|l| l.delete ' 1-9' }
(expect conum_lines).to have_size 18
@@ -2095,14 +2095,14 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should allow conum glyphs to be specified as single unicode character' do
- pdf = to_pdf <<~'EOS', pdf_theme: { conum_glyphs: '\u2776' }, analyze: true
+ pdf = to_pdf <<~'END', pdf_theme: { conum_glyphs: '\u2776' }, analyze: true
....
the one and only line <1>
no conum here <2>
....
<1> That's all we have time for
<2> This conum is not supported
- EOS
+ END
one_text = pdf.find_text ?\u2776
(expect one_text).to have_size 2
@@ -2116,7 +2116,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should keep list marker with primary text' do
- pdf = to_pdf <<~EOS, analyze: true
+ pdf = to_pdf <<~END, analyze: true
:pdf-page-size: 52mm x 72.25mm
:pdf-page-margin: 0
@@ -2126,7 +2126,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
....
<1> description
- EOS
+ END
marker_text = (pdf.find_text ?\u2460)[-1]
(expect marker_text[:page_number]).to be 2
@@ -2135,37 +2135,37 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should allow text alignment to be set using role', visual: true do
- to_file = to_pdf_file <<~EOS, 'colist-text-align-left-role.pdf'
+ to_file = to_pdf_file <<~END, 'colist-text-align-left-role.pdf'
----
data <1>
----
[.text-left]
<1> #{lorem_ipsum '2-sentences-1-paragraph'}
- EOS
+ END
(expect to_file).to visually_match 'colist-text-align-left.pdf'
end
it 'should allow text alignment to be set using theme', visual: true do
- to_file = to_pdf_file <<~EOS, 'colist-text-align-left-theme.pdf', pdf_theme: { list_text_align: 'left' }
+ to_file = to_pdf_file <<~END, 'colist-text-align-left-theme.pdf', pdf_theme: { list_text_align: 'left' }
----
data <1>
----
<1> #{lorem_ipsum '2-sentences-1-paragraph'}
- EOS
+ END
(expect to_file).to visually_match 'colist-text-align-left.pdf'
end
end
context 'Bibliography' do
it 'should reference bibliography entry using ID in square brackets by default' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
The recommended reading includes <<bar>>.
[bibliography]
== Bibliography
* [[[bar]]] Bar, Foo. All The Things. 2010.
- EOS
+ END
lines = pdf.lines
@@ -2174,14 +2174,14 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should reference bibliography entry using custom reftext square brackets' do
- pdf = to_pdf <<~'EOS', analyze: true
+ pdf = to_pdf <<~'END', analyze: true
The recommended reading includes <<bar>>.
[bibliography]
== Bibliography
* [[[bar,1]]] Bar, Foo. All The Things. 2010.
- EOS
+ END
lines = pdf.lines
(expect lines).to include 'The recommended reading includes [1].'
@@ -2189,7 +2189,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
end
it 'should create bidirectional links between first bibref reference and entry' do
- pdf = to_pdf <<~'EOS'
+ pdf = to_pdf <<~'END'
The recommended reading includes <<bar>>.
Did you read <<bar>>?
@@ -2201,7 +2201,7 @@ describe 'Asciidoctor::PDF::Converter - List' do
* [[[bar]]] Bar, Foo. All The Things. 2010.
* [[[baz]]] Baz. The Rest of the Story. 2020.
- EOS
+ END
forward_refs = get_annotations pdf, 1
(expect forward_refs).to have_size 2