diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2019-02-10 20:17:59 -0700 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2019-02-10 20:17:59 -0700 |
| commit | 91bb5bab0dbe66c8bbb522cc934800bf5b1ff1fa (patch) | |
| tree | 95194bbb2cdcd54bb955c786740c6e091456abb5 /test | |
| parent | 05e5b49ebedff5ebbc7a2d17860c0705a731d707 (diff) | |
use indented (squiggly) heredoc strings in lists_test
Diffstat (limited to 'test')
| -rw-r--r-- | test/lists_test.rb | 3658 |
1 files changed, 1825 insertions, 1833 deletions
diff --git a/test/lists_test.rb b/test/lists_test.rb index 4eeb80be..59962a33 100644 --- a/test/lists_test.rb +++ b/test/lists_test.rb @@ -4,13 +4,13 @@ require_relative 'test_helper' context "Bulleted lists (:ulist)" do context "Simple lists" do test "dash elements with no blank lines" do - input = <<-EOS -List -==== + input = <<~'EOS' + List + ==== -- Foo -- Boo -- Blech + - Foo + - Boo + - Blech EOS output = convert_string input assert_xpath '//ul', output, 1 @@ -18,10 +18,10 @@ List end test 'indented dash elements using spaces' do - input = <<-EOS - - Foo - - Boo - - Blech + input = <<~EOS + - Foo + - Boo + - Blech EOS output = convert_string input assert_xpath '//ul', output, 1 @@ -29,10 +29,10 @@ List end test 'indented dash elements using tabs' do - input = <<-EOS -\t-\tFoo -\t-\tBoo -\t-\tBlech + input = <<~EOS + \t-\tFoo + \t-\tBoo + \t-\tBlech EOS output = convert_string input assert_xpath '//ul', output, 1 @@ -40,16 +40,16 @@ List end test "dash elements separated by blank lines should merge lists" do - input = <<-EOS -List -==== + input = <<~'EOS' + List + ==== -- Foo + - Foo -- Boo + - Boo -- Blech + - Blech EOS output = convert_string input assert_xpath '//ul', output, 1 @@ -57,17 +57,17 @@ List end test 'dash elements with interspersed line comments should be skipped and not break list' do - input = <<-EOS -== List - -- Foo -// line comment -// another line comment -- Boo -// line comment -more text -// another line comment -- Blech + input = <<~'EOS' + == List + + - Foo + // line comment + // another line comment + - Boo + // line comment + more text + // another line comment + - Blech EOS output = convert_string_to_embedded input assert_xpath '//ul', output, 1 @@ -76,16 +76,16 @@ more text end test "dash elements separated by a line comment offset by blank lines should not merge lists" do - input = <<-EOS -List -==== + input = <<~'EOS' + List + ==== -- Foo -- Boo + - Foo + - Boo -// + // -- Blech + - Blech EOS output = convert_string input assert_xpath '//ul', output, 2 @@ -94,15 +94,15 @@ List end test "dash elements separated by a block title offset by a blank line should not merge lists" do - input = <<-EOS -List -==== + input = <<~'EOS' + List + ==== -- Foo -- Boo + - Foo + - Boo -.Also -- Blech + .Also + - Blech EOS output = convert_string input assert_xpath '//ul', output, 2 @@ -112,14 +112,14 @@ List end test "dash elements separated by an attribute entry offset by a blank line should not merge lists" do - input = <<-EOS -== List + input = <<~'EOS' + == List -- Foo -- Boo + - Foo + - Boo -:foo: bar -- Blech + :foo: bar + - Blech EOS output = convert_string_to_embedded input assert_xpath '//ul', output, 2 @@ -128,14 +128,14 @@ List end test 'a non-indented wrapped line is folded into text of list item' do - input = <<-EOS -List -==== + input = <<~'EOS' + List + ==== -- Foo -wrapped content -- Boo -- Blech + - Foo + wrapped content + - Boo + - Blech EOS output = convert_string input assert_xpath '//ul', output, 1 @@ -144,13 +144,13 @@ wrapped content end test 'a non-indented wrapped line that resembles a block title is folded into text of list item' do - input = <<-EOS -== List + input = <<~'EOS' + == List -- Foo -.wrapped content -- Boo -- Blech + - Foo + .wrapped content + - Boo + - Blech EOS output = convert_string_to_embedded input assert_xpath '//ul', output, 1 @@ -159,13 +159,13 @@ wrapped content end test 'a non-indented wrapped line that resembles an attribute entry is folded into text of list item' do - input = <<-EOS -== List + input = <<~'EOS' + == List -- Foo -:foo: bar -- Boo -- Blech + - Foo + :foo: bar + - Boo + - Blech EOS output = convert_string_to_embedded input assert_xpath '//ul', output, 1 @@ -174,10 +174,10 @@ wrapped content end test 'a list item with a nested marker terminates non-indented paragraph for text of list item' do - input = <<-EOS -- Foo -Bar -* Foo + input = <<~'EOS' + - Foo + Bar + * Foo EOS output = convert_string_to_embedded input @@ -186,18 +186,18 @@ Bar end test 'a list item for a different list terminates non-indented paragraph for text of list item' do - input = <<-EOS -== Example 1 + input = <<~'EOS' + == Example 1 -- Foo -Bar -. Foo + - Foo + Bar + . Foo -== Example 2 + == Example 2 -* Item -text -term:: def + * Item + text + term:: def EOS output = convert_string_to_embedded input @@ -208,14 +208,14 @@ term:: def end test 'an indented wrapped line is unindented and folded into text of list item' do - input = <<-EOS -List -==== + input = <<~'EOS' + List + ==== -- Foo - wrapped content -- Boo -- Blech + - Foo + wrapped content + - Boo + - Blech EOS output = convert_string input assert_xpath '//ul', output, 1 @@ -224,13 +224,13 @@ List end test 'wrapped list item with hanging indent followed by non-indented line' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -- list item 1 - // not line comment -second wrapped line -- list item 2 + - list item 1 + // not line comment + second wrapped line + - list item 2 EOS output = convert_string_to_embedded input assert_css 'ul', output, 1 @@ -244,10 +244,10 @@ second wrapped line end test 'a list item with a nested marker terminates indented paragraph for text of list item' do - input = <<-EOS -- Foo - Bar -* Foo + input = <<~EOS + - Foo + Bar + * Foo EOS output = convert_string_to_embedded input @@ -256,9 +256,9 @@ second wrapped line end test 'a list item that starts with a sequence of list markers characters should not match a nested list' do - input = <<-EOS - * first item - *. normal text + input = <<~EOS + * first item + *. normal text EOS output = convert_string_to_embedded input @@ -268,18 +268,18 @@ second wrapped line end test 'a list item for a different list terminates indented paragraph for text of list item' do - input = <<-EOS -== Example 1 + input = <<~EOS + == Example 1 -- Foo - Bar -. Foo + - Foo + Bar + . Foo -== Example 2 + == Example 2 -* Item - text -term:: def + * Item + text + term:: def EOS output = convert_string_to_embedded input @@ -290,16 +290,16 @@ term:: def end test "a literal paragraph offset by blank lines in list content is appended as a literal block" do - input = <<-EOS -List -==== + input = <<~EOS + List + ==== -- Foo + - Foo - literal + literal -- Boo -- Blech + - Boo + - Blech EOS output = convert_string input assert_xpath '//ul', output, 1 @@ -311,18 +311,18 @@ List end test "a literal paragraph offset by a blank line in list content followed by line with continuation is appended as two blocks" do - input = <<-EOS -List -==== + input = <<~EOS + List + ==== -- Foo + - Foo - literal -+ -para + literal + + + para -- Boo -- Blech + - Boo + - Blech EOS output = convert_string input assert_xpath '//ul', output, 1 @@ -336,11 +336,11 @@ para end test 'an admonition paragraph attached by a line continuation to a list item with wrapped text should produce admonition' do - input = <<-EOS -- first-line text - wrapped text -+ -NOTE: This is a note. + input = <<~EOS + - first-line text + wrapped text + + + NOTE: This is a note. EOS output = convert_string_to_embedded input @@ -353,18 +353,18 @@ NOTE: This is a note. end test 'paragraph-like blocks attached to an ancestory list item by a list continuation should produce blocks' do - input = <<-EOS -* parent - ** child + input = <<~EOS + * parent + ** child -+ -NOTE: This is a note. + + + NOTE: This is a note. -* another parent - ** another child + * another parent + ** another child -+ -''' + + + ''' EOS output = convert_string_to_embedded input @@ -375,14 +375,14 @@ NOTE: This is a note. end test 'should not inherit block attributes from previous block when block is attached using a list continuation' do - input = <<-EOS -* complex list item -+ -[source,xml] ----- -<name>value</name> <!--1--> ----- -<1> a configuration value + input = <<~'EOS' + * complex list item + + + [source,xml] + ---- + <name>value</name> <!--1--> + ---- + <1> a configuration value EOS doc = document_from_string input @@ -398,18 +398,18 @@ NOTE: This is a note. end test 'should continue to parse blocks attached by a list continuation after block is dropped' do - input = <<-EOS -* item -+ -paragraph -+ -[comment] -comment -+ -==== -example -==== -''' + input = <<~'EOS' + * item + + + paragraph + + + [comment] + comment + + + ==== + example + ==== + ''' EOS output = convert_string_to_embedded input @@ -418,13 +418,13 @@ example end test 'appends line as paragraph if attached by continuation following line comment' do - input = <<-EOS -- list item 1 -// line comment -+ -paragraph in list item 1 + input = <<~'EOS' + - list item 1 + // line comment + + + paragraph in list item 1 -- list item 2 + - list item 2 EOS output = convert_string_to_embedded input assert_css 'ul', output, 1 @@ -436,15 +436,15 @@ paragraph in list item 1 end test "a literal paragraph with a line that appears as a list item that is followed by a continuation should create two blocks" do - input = <<-EOS -* Foo -+ - literal -. still literal -+ -para + input = <<~EOS + * Foo + + + literal + . still literal + + + para -* Bar + * Bar EOS output = convert_string input assert_xpath '//ul', output, 1 @@ -458,19 +458,19 @@ para end test "consecutive literal paragraph offset by blank lines in list content are appended as a literal blocks" do - input = <<-EOS -List -==== + input = <<~EOS + List + ==== -- Foo + - Foo - literal + literal - more - literal + more + literal -- Boo -- Blech + - Boo + - Blech EOS output = convert_string input assert_xpath '//ul', output, 1 @@ -483,15 +483,15 @@ List end test "a literal paragraph without a trailing blank line consumes following list items" do - input = <<-EOS -List -==== + input = <<~EOS + List + ==== -- Foo + - Foo - literal -- Boo -- Blech + literal + - Boo + - Blech EOS output = convert_string input assert_xpath '//ul', output, 1 @@ -503,13 +503,13 @@ List end test "asterisk elements with no blank lines" do - input = <<-EOS -List -==== + input = <<~'EOS' + List + ==== -* Foo -* Boo -* Blech + * Foo + * Boo + * Blech EOS output = convert_string input assert_xpath '//ul', output, 1 @@ -517,10 +517,10 @@ List end test 'indented asterisk elements using spaces' do - input = <<-EOS - * Foo - * Boo - * Blech + input = <<~EOS + * Foo + * Boo + * Blech EOS output = convert_string input assert_xpath '//ul', output, 1 @@ -528,10 +528,10 @@ List end test 'indented unicode bullet elements using spaces' do - input = <<-EOS - • Foo - • Boo - • Blech + input = <<~EOS + • Foo + • Boo + • Blech EOS output = convert_string input assert_xpath '//ul', output, 1 @@ -539,10 +539,10 @@ List end test 'indented asterisk elements using tabs' do - input = <<-EOS -\t*\tFoo -\t*\tBoo -\t*\tBlech + input = <<~EOS + \t*\tFoo + \t*\tBoo + \t*\tBlech EOS output = convert_string input assert_xpath '//ul', output, 1 @@ -551,11 +551,11 @@ List test 'should represent block style as style class' do ['disc', 'square', 'circle'].each do |style| - input = <<-EOS -[#{style}] -* a -* b -* c + input = <<~EOS + [#{style}] + * a + * b + * c EOS output = convert_string_to_embedded input assert_css ".ulist.#{style}", output, 1 @@ -564,16 +564,16 @@ List end test "asterisk elements separated by blank lines should merge lists" do - input = <<-EOS -List -==== + input = <<~'EOS' + List + ==== -* Foo + * Foo -* Boo + * Boo -* Blech + * Blech EOS output = convert_string input assert_xpath '//ul', output, 1 @@ -581,17 +581,17 @@ List end test 'asterisk elements with interspersed line comments should be skipped and not break list' do - input = <<-EOS -== List - -* Foo -// line comment -// another line comment -* Boo -// line comment -more text -// another line comment -* Blech + input = <<~'EOS' + == List + + * Foo + // line comment + // another line comment + * Boo + // line comment + more text + // another line comment + * Blech EOS output = convert_string_to_embedded input assert_xpath '//ul', output, 1 @@ -600,16 +600,16 @@ more text end test "asterisk elements separated by a line comment offset by blank lines should not merge lists" do - input = <<-EOS -List -==== + input = <<~'EOS' + List + ==== -* Foo -* Boo + * Foo + * Boo -// + // -* Blech + * Blech EOS output = convert_string input assert_xpath '//ul', output, 2 @@ -618,15 +618,15 @@ List end test "asterisk elements separated by a block title offset by a blank line should not merge lists" do - input = <<-EOS -List -==== + input = <<~'EOS' + List + ==== -* Foo -* Boo + * Foo + * Boo -.Also -* Blech + .Also + * Blech EOS output = convert_string input assert_xpath '//ul', output, 2 @@ -636,14 +636,14 @@ List end test "asterisk elements separated by an attribute entry offset by a blank line should not merge lists" do - input = <<-EOS -== List + input = <<~'EOS' + == List -* Foo -* Boo + * Foo + * Boo -:foo: bar -* Blech + :foo: bar + * Blech EOS output = convert_string_to_embedded input assert_xpath '//ul', output, 2 @@ -652,16 +652,16 @@ List end test "list should terminate before next lower section heading" do - input = <<-EOS -List -==== + input = <<~'EOS' + List + ==== -* first -item -* second -item + * first + item + * second + item -== Section + == Section EOS output = convert_string input assert_xpath '//ul', output, 1 @@ -670,17 +670,17 @@ item end test "list should terminate before next lower section heading with implicit id" do - input = <<-EOS -List -==== + input = <<~'EOS' + List + ==== -* first -item -* second -item + * first + item + * second + item -[[sec]] -== Section + [[sec]] + == Section EOS output = convert_string input assert_xpath '//ul', output, 1 @@ -689,10 +689,10 @@ item end test 'should not find section title immediately below last list item' do - input = <<-EOS -* first -* second -== Not a section + input = <<~'EOS' + * first + * second + == Not a section EOS output = convert_string_to_embedded input @@ -704,10 +704,10 @@ item end test 'should match trailing line separator in text of list item' do - input = <<-EOS.chomp -* a -* b#{decode_char 8232} -* c + input = <<~EOS.chomp + * a + * b#{decode_char 8232} + * c EOS output = convert_string input @@ -716,10 +716,10 @@ item end test 'should match line separator in text of list item' do - input = <<-EOS.chomp -* a -* b#{decode_char 8232}b -* c + input = <<~EOS.chomp + * a + * b#{decode_char 8232}b + * c EOS output = convert_string input @@ -730,13 +730,13 @@ item context "Lists with inline markup" do test "quoted text" do - input = <<-EOS -List -==== + input = <<~'EOS' + List + ==== -- I am *strong*. -- I am _stressed_. -- I am `flexible`. + - I am *strong*. + - I am _stressed_. + - I am `flexible`. EOS output = convert_string input assert_xpath '//ul', output, 1 @@ -747,13 +747,13 @@ List end test "attribute substitutions" do - input = <<-EOS -List -==== -:foo: bar + input = <<~'EOS' + List + ==== + :foo: bar -- side a {vbar} side b -- Take me to a {foo}. + - side a {vbar} side b + - Take me to a {foo}. EOS output = convert_string input assert_xpath '//ul', output, 1 @@ -763,10 +763,10 @@ List end test "leading dot is treated as text not block title" do - input = <<-EOS -* .first -* .second -* .third + input = <<~'EOS' + * .first + * .second + * .third EOS output = convert_string input assert_xpath '//ul', output, 1 @@ -777,10 +777,10 @@ List end test "word ending sentence on continuing line not treated as a list item" do - input = <<-EOS -A. This is the story about - AsciiDoc. It begins here. -B. And it ends here. + input = <<~EOS + A. This is the story about + AsciiDoc. It begins here. + B. And it ends here. EOS output = convert_string input assert_xpath '//ol', output, 1 @@ -788,14 +788,14 @@ B. And it ends here. end test 'should discover anchor at start of unordered list item text and register it as a reference' do - input = <<-EOS -The highest peak in the Front Range is <<grays-peak>>, which tops <<mount-evans>> by just a few feet. + input = <<~'EOS' + The highest peak in the Front Range is <<grays-peak>>, which tops <<mount-evans>> by just a few feet. -* [[mount-evans,Mount Evans]]At 14,271 feet, Mount Evans is the highest summit of the Chicago Peaks in the Front Range of the Rocky Mountains. -* [[grays-peak,Grays Peak]] -Grays Peak rises to 14,278 feet, making it the highest summit in the Front Range of the Rocky Mountains. -* Longs Peak is a 14,259-foot high, prominent mountain summit in the northern Front Range of the Rocky Mountains. -* Pikes Peak is the highest summit of the southern Front Range of the Rocky Mountains at 14,115 feet. + * [[mount-evans,Mount Evans]]At 14,271 feet, Mount Evans is the highest summit of the Chicago Peaks in the Front Range of the Rocky Mountains. + * [[grays-peak,Grays Peak]] + Grays Peak rises to 14,278 feet, making it the highest summit in the Front Range of the Rocky Mountains. + * Longs Peak is a 14,259-foot high, prominent mountain summit in the northern Front Range of the Rocky Mountains. + * Pikes Peak is the highest summit of the southern Front Range of the Rocky Mountains at 14,115 feet. EOS doc = document_from_string input @@ -808,14 +808,14 @@ Grays Peak rises to 14,278 feet, making it the highest summit in the Front Range end test 'should discover anchor at start of ordered list item text and register it as a reference' do - input = <<-EOS -This is a cross-reference to <<step-2>>. -This is a cross-reference to <<step-4>>. + input = <<~'EOS' + This is a cross-reference to <<step-2>>. + This is a cross-reference to <<step-4>>. -. Ordered list, item 1, without anchor -. [[step-2,Step 2]]Ordered list, item 2, with anchor -. Ordered list, item 3, without anchor -. [[step-4,Step 4]]Ordered list, item 4, with anchor + . Ordered list, item 1, without anchor + . [[step-2,Step 2]]Ordered list, item 2, with anchor + . Ordered list, item 3, without anchor + . [[step-4,Step 4]]Ordered list, item 4, with anchor EOS doc = document_from_string input @@ -830,13 +830,13 @@ This is a cross-reference to <<step-4>>. context "Nested lists" do test "asterisk element mixed with dash elements should be nested" do - input = <<-EOS -List -==== + input = <<~'EOS' + List + ==== -- Foo -* Boo -- Blech + - Foo + * Boo + - Blech EOS output = convert_string input assert_xpath '//ul', output, 2 @@ -846,13 +846,13 @@ List end test "dash element mixed with asterisks elements should be nested" do - input = <<-EOS -List -==== + input = <<~'EOS' + List + ==== -* Foo -- Boo -* Blech + * Foo + - Boo + * Blech EOS output = convert_string input assert_xpath '//ul', output, 2 @@ -862,16 +862,16 @@ List end test "lines prefixed with alternating list markers separated by blank lines should be nested" do - input = <<-EOS -List -==== + input = <<~'EOS' + List + ==== -- Foo + - Foo -* Boo + * Boo -- Blech + - Blech EOS output = convert_string input assert_xpath '//ul', output, 2 @@ -881,13 +881,13 @@ List end test "nested elements (2) with asterisks" do - input = <<-EOS -List -==== + input = <<~'EOS' + List + ==== -* Foo -** Boo -* Blech + * Foo + ** Boo + * Blech EOS output = convert_string input assert_xpath '//ul', output, 2 @@ -897,14 +897,14 @@ List end test "nested elements (3) with asterisks" do - input = <<-EOS -List -==== + input = <<~'EOS' + List + ==== -* Foo -** Boo -*** Snoo -* Blech + * Foo + ** Boo + *** Snoo + * Blech EOS output = convert_string input assert_xpath '//ul', output, 3 @@ -914,15 +914,15 @@ List end test "nested elements (4) with asterisks" do - input = <<-EOS -List -==== + input = <<~'EOS' + List + ==== -* Foo -** Boo -*** Snoo -**** Froo -* Blech + * Foo + ** Boo + *** Snoo + **** Froo + * Blech EOS output = convert_string input assert_xpath '//ul', output, 4 @@ -933,16 +933,16 @@ List end test "nested elements (5) with asterisks" do - input = <<-EOS -List -==== + input = <<~'EOS' + List + ==== -* Foo -** Boo -*** Snoo -**** Froo -***** Groo -* Blech + * Foo + ** Boo + *** Snoo + **** Froo + ***** Groo + * Blech EOS output = convert_string input assert_xpath '//ul', output, 5 @@ -964,18 +964,18 @@ List end test 'level of unordered list should match section level' do - input = <<-EOS -== Parent Section + input = <<~EOS + == Parent Section -* item 1.1 - ** item 2.1 - *** item 3.1 - ** item 2.2 -* item 1.2 + * item 1.1 + ** item 2.1 + *** item 3.1 + ** item 2.2 + * item 1.2 -=== Nested Section + === Nested Section -* item 1.1 + * item 1.1 EOS doc = document_from_string input @@ -987,22 +987,20 @@ List end test 'does not recognize lists with repeating unicode bullets' do - input = <<-EOS -•• Boo - EOS + input = '•• Boo' output = convert_string input assert_xpath '//ul', output, 0 assert_includes output, '•' end test "nested ordered elements (2)" do - input = <<-EOS -List -==== + input = <<~'EOS' + List + ==== -. Foo -.. Boo -. Blech + . Foo + .. Boo + . Blech EOS output = convert_string input assert_xpath '//ol', output, 2 @@ -1012,14 +1010,14 @@ List end test "nested ordered elements (3)" do - input = <<-EOS -List -==== + input = <<~'EOS' + List + ==== -. Foo -.. Boo -... Snoo -. Blech + . Foo + .. Boo + ... Snoo + . Blech EOS output = convert_string input assert_xpath '//ol', output, 3 @@ -1039,18 +1037,18 @@ List end test 'level of ordered list should match section level' do - input = <<-EOS -== Parent Section + input = <<~EOS + == Parent Section -. item 1.1 - .. item 2.1 - ... item 3.1 - .. item 2.2 -. item 1.2 + . item 1.1 + .. item 2.1 + ... item 3.1 + .. item 2.2 + . item 1.2 -=== Nested Section + === Nested Section -. item 1.1 + . item 1.1 EOS doc = document_from_string input @@ -1062,13 +1060,13 @@ List end test "nested unordered inside ordered elements" do - input = <<-EOS -List -==== + input = <<~'EOS' + List + ==== -. Foo -* Boo -. Blech + . Foo + * Boo + . Blech EOS output = convert_string input assert_xpath '//ol', output, 1 @@ -1078,13 +1076,13 @@ List end test "nested ordered inside unordered elements" do - input = <<-EOS -List -==== + input = <<~'EOS' + List + ==== -* Foo -. Boo -* Blech + * Foo + . Boo + * Blech EOS output = convert_string input assert_xpath '//ul', output, 1 @@ -1094,13 +1092,13 @@ List end test 'three levels of alternating unordered and ordered elements' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -* bullet 1 -. numbered 1.1 -** bullet 1.1.1 -* bullet 2 + * bullet 1 + . numbered 1.1 + ** bullet 1.1.1 + * bullet 2 EOS output = convert_string_to_embedded input @@ -1115,16 +1113,16 @@ List end test "lines with alternating markers of unordered and ordered list types separated by blank lines should be nested" do - input = <<-EOS -List -==== + input = <<~'EOS' + List + ==== -* Foo + * Foo -. Boo + . Boo -* Blech + * Blech EOS output = convert_string input assert_xpath '//ul', output, 1 @@ -1134,17 +1132,17 @@ List end test 'list item with literal content should not consume nested list of different type' do - input = <<-EOS -List -==== + input = <<~EOS + List + ==== -- bullet + - bullet - literal - but not - hungry + literal + but not + hungry -. numbered + . numbered EOS output = convert_string input assert_xpath '//ul', output, 1 @@ -1159,18 +1157,18 @@ List end test 'nested list item does not eat the title of the following detached block' do - input = <<-EOS -List -==== + input = <<~EOS + List + ==== -- bullet - * nested bullet 1 - * nested bullet 2 + - bullet + * nested bullet 1 + * nested bullet 2 -.Title -.... -literal -.... + .Title + .... + literal + .... EOS # use convert_string so we can match all ulists easier output = convert_string input @@ -1180,15 +1178,15 @@ literal end test "lines with alternating markers of bulleted and description list types separated by blank lines should be nested" do - input = <<-EOS -List -==== + input = <<~'EOS' + List + ==== -* Foo + * Foo -term1:: def1 + term1:: def1 -* Blech + * Blech EOS output = convert_string input assert_xpath '//ul', output, 1 @@ -1199,14 +1197,14 @@ term1:: def1 end test "nested ordered with attribute inside unordered elements" do - input = <<-EOS -Blah -==== + input = <<~'EOS' + Blah + ==== -* Foo -[start=2] -. Boo -* Blech + * Foo + [start=2] + . Boo + * Blech EOS output = convert_string input assert_xpath '//ul', output, 1 @@ -1218,15 +1216,15 @@ Blah context "List continuations" do test "adjacent list continuation line attaches following paragraph" do - input = <<-EOS -Lists -===== + input = <<~'EOS' + Lists + ===== -* Item one, paragraph one -+ -Item one, paragraph two -+ -* Item two + * Item one, paragraph one + + + Item one, paragraph two + + + * Item two EOS output = convert_string input assert_xpath '//ul', output, 1 @@ -1238,17 +1236,17 @@ Item one, paragraph two end test "adjacent list continuation line attaches following block" do - input = <<-EOS -Lists -===== - -* Item one, paragraph one -+ -.... -Item one, literal block -.... -+ -* Item two + input = <<~'EOS' + Lists + ===== + + * Item one, paragraph one + + + .... + Item one, literal block + .... + + + * Item two EOS output = convert_string input assert_xpath '//ul', output, 1 @@ -1258,21 +1256,21 @@ Item one, literal block end test 'adjacent list continuation line attaches following block with block attributes' do - input = <<-EOS -Lists -===== - -* Item one, paragraph one -+ -:foo: bar -[[beck]] -.Read the following aloud to yourself -[source, ruby] ----- -5.times { print "Odelay!" } ----- - -* Item two + input = <<~'EOS' + Lists + ===== + + * Item one, paragraph one + + + :foo: bar + [[beck]] + .Read the following aloud to yourself + [source, ruby] + ---- + 5.times { print "Odelay!" } + ---- + + * Item two EOS output = convert_string input assert_xpath '//ul', output, 1 @@ -1284,15 +1282,15 @@ Lists end test 'trailing block attribute line attached by continuation should not create block' do - input = <<-EOS -Lists -===== + input = <<~'EOS' + Lists + ===== -* Item one, paragraph one -+ -[source] + * Item one, paragraph one + + + [source] -* Item two + * Item two EOS output = convert_string input assert_xpath '//ul', output, 1 @@ -1302,15 +1300,15 @@ Lists end test 'trailing block title line attached by continuation should not create block' do - input = <<-EOS -Lists -===== + input = <<~'EOS' + Lists + ===== -* Item one, paragraph one -+ -.Disappears into the ether + * Item one, paragraph one + + + .Disappears into the ether -* Item two + * Item two EOS output = convert_string input assert_xpath '//ul', output, 1 @@ -1319,21 +1317,21 @@ Lists end test 'consecutive blocks in list continuation attach to list item' do - input = <<-EOS -Lists -===== - -* Item one, paragraph one -+ -.... -Item one, literal block -.... -+ -____ -Item one, quote block -____ -+ -* Item two + input = <<~'EOS' + Lists + ===== + + * Item one, paragraph one + + + .... + Item one, literal block + .... + + + ____ + Item one, quote block + ____ + + + * Item two EOS output = convert_string_to_embedded input assert_xpath '//ul', output, 1 @@ -1344,17 +1342,17 @@ ____ end test 'list item with hanging indent followed by block attached by list continuation' do - input = <<-EOS -== Lists + input = <<~EOS + == Lists -. list item 1 - continued -+ --- -open block in list item 1 --- + . list item 1 + continued + + + -- + open block in list item 1 + -- -. list item 2 + . list item 2 EOS output = convert_string_to_embedded input assert_css 'ol', output, 1 @@ -1366,18 +1364,18 @@ open block in list item 1 end test 'list item paragraph in list item and nested list item' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -. list item 1 -+ -list item 1 paragraph + . list item 1 + + + list item 1 paragraph -* nested list item -+ -nested list item paragraph + * nested list item + + + nested list item paragraph -. list item 2 + . list item 2 EOS output = convert_string_to_embedded input assert_css '.olist ol', output, 1 @@ -1395,20 +1393,20 @@ nested list item paragraph end test 'trailing list continuations should attach to list items at respective levels' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -. list item 1 -+ -* nested list item 1 -* nested list item 2 -+ -paragraph for nested list item 2 + . list item 1 + + + * nested list item 1 + * nested list item 2 + + + paragraph for nested list item 2 -+ -paragraph for list item 1 + + + paragraph for list item 1 -. list item 2 + . list item 2 EOS output = convert_string_to_embedded input assert_css '.olist ol', output, 1 @@ -1428,20 +1426,20 @@ paragraph for list item 1 end test 'trailing list continuations should attach to list items of different types at respective levels' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -* bullet 1 -. numbered 1.1 -** bullet 1.1.1 + * bullet 1 + . numbered 1.1 + ** bullet 1.1.1 -+ -numbered 1.1 paragraph + + + numbered 1.1 paragraph -+ -bullet 1 paragraph + + + bullet 1 paragraph -* bullet 2 + * bullet 2 EOS output = convert_string_to_embedded input @@ -1464,25 +1462,25 @@ bullet 1 paragraph end test 'repeated list continuations should attach to list items at respective levels' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -. list item 1 + . list item 1 -* nested list item 1 -+ --- -open block for nested list item 1 --- -+ -* nested list item 2 -+ -paragraph for nested list item 2 + * nested list item 1 + + + -- + open block for nested list item 1 + -- + + + * nested list item 2 + + + paragraph for nested list item 2 -+ -paragraph for list item 1 + + + paragraph for list item 1 -. list item 2 + . list item 2 EOS output = convert_string_to_embedded input assert_css '.olist ol', output, 1 @@ -1505,25 +1503,25 @@ paragraph for list item 1 end test 'repeated list continuations attached directly to list item should attach to list items at respective levels' do - input = <<-EOS -== Lists - -. list item 1 -+ -* nested list item 1 -+ --- -open block for nested list item 1 --- -+ -* nested list item 2 -+ -paragraph for nested list item 2 - -+ -paragraph for list item 1 - -. list item 2 + input = <<~'EOS' + == Lists + + . list item 1 + + + * nested list item 1 + + + -- + open block for nested list item 1 + -- + + + * nested list item 2 + + + paragraph for nested list item 2 + + + + paragraph for list item 1 + + . list item 2 EOS output = convert_string_to_embedded input assert_css '.olist ol', output, 1 @@ -1546,26 +1544,26 @@ paragraph for list item 1 end test 'repeated list continuations should attach to list items at respective levels ignoring blank lines' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -. list item 1 -+ -* nested list item 1 -+ --- -open block for nested list item 1 --- -+ -* nested list item 2 -+ -paragraph for nested list item 2 + . list item 1 + + + * nested list item 1 + + + -- + open block for nested list item 1 + -- + + + * nested list item 2 + + + paragraph for nested list item 2 -+ -paragraph for list item 1 + + + paragraph for list item 1 -. list item 2 + . list item 2 EOS output = convert_string_to_embedded input assert_css '.olist ol', output, 1 @@ -1588,26 +1586,26 @@ paragraph for list item 1 end test 'trailing list continuations should ignore preceding blank lines' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -* bullet 1 -** bullet 1.1 -*** bullet 1.1.1 -+ --- -open block --- + * bullet 1 + ** bullet 1.1 + *** bullet 1.1.1 + + + -- + open block + -- -+ -bullet 1.1 paragraph + + + bullet 1.1 paragraph -+ -bullet 1 paragraph + + + bullet 1 paragraph -* bullet 2 + * bullet 2 EOS output = convert_string_to_embedded input @@ -1629,18 +1627,18 @@ bullet 1 paragraph end test 'indented outline list item with different marker offset by a blank line should be recognized as a nested list' do - input = <<-EOS -* item 1 + input = <<~EOS + * item 1 - . item 1.1 -+ -attached paragraph + . item 1.1 + + + attached paragraph - . item 1.2 -+ -attached paragraph + . item 1.2 + + + attached paragraph -* item 2 + * item 2 EOS output = convert_string_to_embedded input @@ -1661,18 +1659,18 @@ attached paragraph end test 'indented description list item inside outline list item offset by a blank line should be recognized as a nested list' do - input = <<-EOS -* item 1 + input = <<~EOS + * item 1 - term a:: description a -+ -attached paragraph + term a:: description a + + + attached paragraph - term b:: description b -+ -attached paragraph + term b:: description b + + + attached paragraph -* item 2 + * item 2 EOS output = convert_string_to_embedded input @@ -1696,19 +1694,19 @@ attached paragraph # NOTE this is not consistent w/ AsciiDoc output, but this is some screwy input anyway =begin test "consecutive list continuation lines are folded" do - input = <<-EOS -Lists -===== - -* Item one, paragraph one -+ -+ -Item one, paragraph two -+ -+ -* Item two -+ -+ + input = <<~'EOS' + Lists + ===== + + * Item one, paragraph one + + + + + Item one, paragraph two + + + + + * Item two + + + + EOS output = convert_string input assert_xpath '//ul', output, 1 @@ -1721,12 +1719,12 @@ Item one, paragraph two =end test 'should warn if unterminated block is detected in list item' do - input = <<-EOS -* item -+ -==== -example -* swallowed item + input = <<~'EOS' + * item + + + ==== + example + * swallowed item EOS using_memory_logger do |logger| @@ -1743,13 +1741,13 @@ end context "Ordered lists (:olist)" do context "Simple lists" do test "dot elements with no blank lines" do - input = <<-EOS -List -==== + input = <<~'EOS' + List + ==== -. Foo -. Boo -. Blech + . Foo + . Boo + . Blech EOS output = convert_string input assert_xpath '//ol', output, 1 @@ -1757,10 +1755,10 @@ List end test 'indented dot elements using spaces' do - input = <<-EOS - . Foo - . Boo - . Blech + input = <<~EOS + . Foo + . Boo + . Blech EOS output = convert_string input assert_xpath '//ol', output, 1 @@ -1768,10 +1766,10 @@ List end test 'indented dot elements using tabs' do - input = <<-EOS -\t.\tFoo -\t.\tBoo -\t.\tBlech + input = <<~EOS + \t.\tFoo + \t.\tBoo + \t.\tBlech EOS output = convert_string input assert_xpath '//ol', output, 1 @@ -1779,11 +1777,11 @@ List end test 'should represent explicit role attribute as style class' do - input = <<-EOS -[role="dry"] -. Once -. Again -. Refactor! + input = <<~'EOS' + [role="dry"] + . Once + . Again + . Refactor! EOS output = convert_string_to_embedded input @@ -1792,10 +1790,10 @@ List end test 'should base list style on marker length rather than list depth' do - input = <<-EOS -... parent -.. child -. grandchild + input = <<~'EOS' + ... parent + .. child + . grandchild EOS output = convert_string_to_embedded input @@ -1805,11 +1803,11 @@ List end test 'should allow list style to be specified explicitly when using markers with implicit style' do - input = <<-EOS -[loweralpha] -i) 1 -ii) 2 -iii) 3 + input = <<~'EOS' + [loweralpha] + i) 1 + ii) 2 + iii) 3 EOS output = convert_string_to_embedded input @@ -1818,11 +1816,11 @@ iii) 3 end test 'should represent custom numbering and explicit role attribute as style classes' do - input = <<-EOS -[loweralpha, role="dry"] -. Once -. Again -. Refactor! + input = <<~'EOS' + [loweralpha, role="dry"] + . Once + . Again + . Refactor! EOS output = convert_string_to_embedded input @@ -1831,12 +1829,12 @@ iii) 3 end test 'should set reversed attribute on list if reversed option is set' do - input = <<-EOS -[%reversed, start=3] -. three -. two -. one -. blast off! + input = <<~'EOS' + [%reversed, start=3] + . three + . two + . one + . blast off! EOS output = convert_string_to_embedded input @@ -1844,11 +1842,11 @@ iii) 3 end test 'should represent implicit role attribute as style class' do - input = <<-EOS -[.dry] -. Once -. Again -. Refactor! + input = <<~'EOS' + [.dry] + . Once + . Again + . Refactor! EOS output = convert_string_to_embedded input @@ -1857,11 +1855,11 @@ iii) 3 end test 'should represent custom numbering and implicit role attribute as style classes' do - input = <<-EOS -[loweralpha.dry] -. Once -. Again -. Refactor! + input = <<~'EOS' + [loweralpha.dry] + . Once + . Again + . Refactor! EOS output = convert_string_to_embedded input @@ -1870,16 +1868,16 @@ iii) 3 end test "dot elements separated by blank lines should merge lists" do - input = <<-EOS -List -==== + input = <<~'EOS' + List + ==== -. Foo + . Foo -. Boo + . Boo -. Blech + . Blech EOS output = convert_string input assert_xpath '//ol', output, 1 @@ -1887,17 +1885,17 @@ List end test 'dot elements with interspersed line comments should be skipped and not break list' do - input = <<-EOS -== List - -. Foo -// line comment -// another line comment -. Boo -// line comment -more text -// another line comment -. Blech + input = <<~'EOS' + == List + + . Foo + // line comment + // another line comment + . Boo + // line comment + more text + // another line comment + . Blech EOS output = convert_string_to_embedded input assert_xpath '//ol', output, 1 @@ -1906,16 +1904,16 @@ more text end test "dot elements separated by line comment offset by blank lines should not merge lists" do - input = <<-EOS -List -==== + input = <<~'EOS' + List + ==== -. Foo -. Boo + . Foo + . Boo -// + // -. Blech + . Blech EOS output = convert_string input assert_xpath '//ol', output, 2 @@ -1924,15 +1922,15 @@ List end test "dot elements separated by a block title offset by a blank line should not merge lists" do - input = <<-EOS -List -==== + input = <<~'EOS' + List + ==== -. Foo -. Boo + . Foo + . Boo -.Also -. Blech + .Also + . Blech EOS output = convert_string input assert_xpath '//ol', output, 2 @@ -1942,14 +1940,14 @@ List end test "dot elements separated by an attribute entry offset by a blank line should not merge lists" do - input = <<-EOS -== List + input = <<~'EOS' + == List -. Foo -. Boo + . Foo + . Boo -:foo: bar -. Blech + :foo: bar + . Blech EOS output = convert_string_to_embedded input assert_xpath '//ol', output, 2 @@ -1958,12 +1956,12 @@ List end test 'should use start number in docbook5 backend' do - input = <<-EOS -== List + input = <<~'EOS' + == List -[start=7] -. item 7 -. item 8 + [start=7] + . item 7 + . item 8 EOS output = convert_string_to_embedded input, backend: 'docbook5' @@ -1973,10 +1971,10 @@ List end test 'should match trailing line separator in text of list item' do - input = <<-EOS.chomp -. a -. b#{decode_char 8232} -. c + input = <<~EOS.chomp + . a + . b#{decode_char 8232} + . c EOS output = convert_string input @@ -1985,10 +1983,10 @@ List end test 'should match line separator in text of list item' do - input = <<-EOS.chomp -. a -. b#{decode_char 8232}b -. c + input = <<~EOS.chomp + . a + . b#{decode_char 8232}b + . c EOS output = convert_string input @@ -1998,9 +1996,9 @@ List end test 'should warn if explicit uppercase roman numerals in list are out of sequence' do - input = <<-EOS -I) one -III) three + input = <<~'EOS' + I) one + III) three EOS using_memory_logger do |logger| output = convert_string_to_embedded input @@ -2010,9 +2008,9 @@ III) three end test 'should warn if explicit lowercase roman numerals in list are out of sequence' do - input = <<-EOS -i) one -iii) three + input = <<~'EOS' + i) one + iii) three EOS using_memory_logger do |logger| output = convert_string_to_embedded input @@ -2025,9 +2023,9 @@ end context "Description lists (:dlist)" do context "Simple lists" do test "single-line adjacent elements" do - input = <<-EOS -term1:: def1 -term2:: def2 + input = <<~'EOS' + term1:: def1 + term2:: def2 EOS output = convert_string input assert_xpath '//dl', output, 1 @@ -2040,9 +2038,9 @@ term2:: def2 end test 'should parse sibling items using same rules' do - input = <<-EOS -term1;; ;; def1 -term2;; ;; def2 + input = <<~'EOS' + term1;; ;; def1 + term2;; ;; def2 EOS output = convert_string input assert_xpath '//dl', output, 1 @@ -2055,9 +2053,9 @@ term2;; ;; def2 end test "single-line indented adjacent elements" do - input = <<-EOS -term1:: def1 - term2:: def2 + input = <<~EOS + term1:: def1 + term2:: def2 EOS output = convert_string input assert_xpath '//dl', output, 1 @@ -2070,9 +2068,9 @@ term1:: def1 end test "single-line indented adjacent elements with tabs" do - input = <<-EOS -term1::\tdef1 -\tterm2::\tdef2 + input = <<~EOS + term1::\tdef1 + \tterm2::\tdef2 EOS output = convert_string input assert_xpath '//dl', output, 1 @@ -2085,10 +2083,10 @@ term1::\tdef1 end test "single-line elements separated by blank line should create a single list" do - input = <<-EOS -term1:: def1 + input = <<~'EOS' + term1:: def1 -term2:: def2 + term2:: def2 EOS output = convert_string input assert_xpath '//dl', output, 1 @@ -2097,12 +2095,12 @@ term2:: def2 end test "a line comment between elements should divide them into separate lists" do - input = <<-EOS -term1:: def1 + input = <<~'EOS' + term1:: def1 -// + // -term2:: def2 + term2:: def2 EOS output = convert_string input assert_xpath '//dl', output, 2 @@ -2112,12 +2110,12 @@ term2:: def2 end test "a ruler between elements should divide them into separate lists" do - input = <<-EOS -term1:: def1 + input = <<~'EOS' + term1:: def1 -''' + ''' -term2:: def2 + term2:: def2 EOS output = convert_string input assert_xpath '//dl', output, 2 @@ -2128,11 +2126,11 @@ term2:: def2 end test "a block title between elements should divide them into separate lists" do - input = <<-EOS -term1:: def1 + input = <<~'EOS' + term1:: def1 -.Some more -term2:: def2 + .Some more + term2:: def2 EOS output = convert_string input assert_xpath '//dl', output, 2 @@ -2143,11 +2141,11 @@ term2:: def2 end test "multi-line elements with paragraph content" do - input = <<-EOS -term1:: -def1 -term2:: -def2 + input = <<~'EOS' + term1:: + def1 + term2:: + def2 EOS output = convert_string input assert_xpath '//dl', output, 1 @@ -2160,11 +2158,11 @@ def2 end test "multi-line elements with indented paragraph content" do - input = <<-EOS -term1:: - def1 -term2:: - def2 + input = <<~EOS + term1:: + def1 + term2:: + def2 EOS output = convert_string input assert_xpath '//dl', output, 1 @@ -2177,14 +2175,14 @@ term2:: end test "multi-line elements with indented paragraph content that includes comment lines" do - input = <<-EOS -term1:: - def1 -// comment -term2:: - def2 -// comment - def2 continued + input = <<~EOS + term1:: + def1 + // comment + term2:: + def2 + // comment + def2 continued EOS output = convert_string_to_embedded input assert_xpath '//dl', output, 1 @@ -2197,12 +2195,12 @@ term2:: end test "should not strip comment line in literal paragraph block attached to list item" do - input = <<-EOS -term1:: -+ - line 1 -// not a comment - line 3 + input = <<~EOS + term1:: + + + line 1 + // not a comment + line 3 EOS output = convert_string_to_embedded input assert_xpath '//*[@class="literalblock"]', output, 1 @@ -2210,13 +2208,13 @@ term1:: end test 'multi-line element with paragraph starting with multiple dashes should not be seen as list' do - input = <<-EOS -term1:: - def1 - -- and a note + input = <<~EOS + term1:: + def1 + -- and a note -term2:: - def2 + term2:: + def2 EOS output = convert_string_to_embedded input assert_xpath '//dl', output, 1 @@ -2229,10 +2227,10 @@ term2:: end test "multi-line element with multiple terms" do - input = <<-EOS -term1:: -term2:: -def2 + input = <<~'EOS' + term1:: + term2:: + def2 EOS output = convert_string input assert_xpath '//dl', output, 1 @@ -2245,12 +2243,12 @@ def2 end test 'consecutive terms share same varlistentry in docbook' do - input = <<-EOS -term:: -alt term:: -description + input = <<~'EOS' + term:: + alt term:: + description -last:: + last:: EOS output = convert_string_to_embedded input, backend: 'docbook' assert_xpath '//varlistentry', output, 2 @@ -2261,13 +2259,13 @@ last:: end test "multi-line elements with blank line before paragraph content" do - input = <<-EOS -term1:: + input = <<~'EOS' + term1:: -def1 -term2:: + def1 + term2:: -def2 + def2 EOS output = convert_string input assert_xpath '//dl', output, 1 @@ -2281,14 +2279,14 @@ def2 test "multi-line elements with paragraph and literal content" do # blank line following literal paragraph is required or else it will gobble up the second term - input = <<-EOS -term1:: -def1 + input = <<~EOS + term1:: + def1 - literal + literal -term2:: - def2 + term2:: + def2 EOS output = convert_string input assert_xpath '//dl', output, 1 @@ -2302,10 +2300,10 @@ term2:: end test "mixed single and multi-line adjacent elements" do - input = <<-EOS -term1:: def1 -term2:: -def2 + input = <<~'EOS' + term1:: def1 + term2:: + def2 EOS output = convert_string input assert_xpath '//dl', output, 1 @@ -2318,11 +2316,11 @@ def2 end test 'should discover anchor at start of description term text and register it as a reference' do - input = <<-EOS -The highest peak in the Front Range is <<grays-peak>>, which tops <<mount-evans>> by just a few feet. + input = <<~'EOS' + The highest peak in the Front Range is <<grays-peak>>, which tops <<mount-evans>> by just a few feet. -[[mount-evans,Mount Evans]]Mount Evans:: 14,271 feet -[[grays-peak]]Grays Peak:: 14,278 feet + [[mount-evans,Mount Evans]]Mount Evans:: 14,271 feet + [[grays-peak]]Grays Peak:: 14,278 feet EOS doc = document_from_string input refs = doc.catalog[:refs] @@ -2338,24 +2336,24 @@ The highest peak in the Front Range is <<grays-peak>>, which tops <<mount-evans> end test "missing space before term does not produce description list" do - input = <<-EOS -term1::def1 -term2::def2 + input = <<~'EOS' + term1::def1 + term2::def2 EOS output = convert_string input assert_xpath '//dl', output, 0 end test "literal block inside description list" do - input = <<-EOS -term:: -+ -.... -literal, line 1 + input = <<~'EOS' + term:: + + + .... + literal, line 1 -literal, line 2 -.... -anotherterm:: def + literal, line 2 + .... + anotherterm:: def EOS output = convert_string input assert_xpath '//dl/dt', output, 2 @@ -2366,16 +2364,16 @@ anotherterm:: def end test "literal block inside description list with trailing line continuation" do - input = <<-EOS -term:: -+ -.... -literal, line 1 + input = <<~'EOS' + term:: + + + .... + literal, line 1 -literal, line 2 -.... -+ -anotherterm:: def + literal, line 2 + .... + + + anotherterm:: def EOS output = convert_string input assert_xpath '//dl/dt', output, 2 @@ -2386,21 +2384,21 @@ anotherterm:: def end test "multiple listing blocks inside description list" do - input = <<-EOS -term:: -+ ----- -listing, line 1 - -listing, line 2 ----- -+ ----- -listing, line 1 - -listing, line 2 ----- -anotherterm:: def + input = <<~'EOS' + term:: + + + ---- + listing, line 1 + + listing, line 2 + ---- + + + ---- + listing, line 1 + + listing, line 2 + ---- + anotherterm:: def EOS output = convert_string input assert_xpath '//dl/dt', output, 2 @@ -2411,15 +2409,15 @@ anotherterm:: def end test "open block inside description list" do - input = <<-EOS -term:: -+ --- -Open block as description of term. + input = <<~'EOS' + term:: + + + -- + Open block as description of term. -And some more detail... --- -anotherterm:: def + And some more detail... + -- + anotherterm:: def EOS output = convert_string input assert_xpath '//dl/dd//p', output, 3 @@ -2427,12 +2425,12 @@ anotherterm:: def end test "paragraph attached by a list continuation on either side in a description list" do - input = <<-EOS -term1:: def1 -+ -more detail -+ -term2:: def2 + input = <<~'EOS' + term1:: def1 + + + more detail + + + term2:: def2 EOS output = convert_string input assert_xpath '(//dl/dt)[1][normalize-space(text())="term1"]', output, 1 @@ -2443,13 +2441,13 @@ term2:: def2 end test "paragraph attached by a list continuation on either side to a multi-line element in a description list" do - input = <<-EOS -term1:: -def1 -+ -more detail -+ -term2:: def2 + input = <<~'EOS' + term1:: + def1 + + + more detail + + + term2:: def2 EOS output = convert_string input assert_xpath '(//dl/dt)[1][normalize-space(text())="term1"]', output, 1 @@ -2460,13 +2458,13 @@ term2:: def2 end test "verse paragraph inside a description list" do - input = <<-EOS -term1:: def -+ -[verse] -la la la + input = <<~'EOS' + term1:: def + + + [verse] + la la la -term2:: def + term2:: def EOS output = convert_string input assert_xpath '//dl/dd//p', output, 2 @@ -2474,12 +2472,12 @@ term2:: def end test "list inside a description list" do - input = <<-EOS -term1:: -* level 1 -** level 2 -* level 1 -term2:: def + input = <<~'EOS' + term1:: + * level 1 + ** level 2 + * level 1 + term2:: def EOS output = convert_string input assert_xpath '//dl/dd', output, 2 @@ -2489,14 +2487,14 @@ term2:: def end test "list inside a description list offset by blank lines" do - input = <<-EOS -term1:: + input = <<~'EOS' + term1:: -* level 1 -** level 2 -* level 1 + * level 1 + ** level 2 + * level 1 -term2:: def + term2:: def EOS output = convert_string input assert_xpath '//dl/dd', output, 2 @@ -2506,18 +2504,18 @@ term2:: def end test "should only grab one line following last item if item has no inline description" do - input = <<-EOS -term1:: + input = <<~'EOS' + term1:: -def1 + def1 -term2:: + term2:: -def2 + def2 -A new paragraph + A new paragraph -Another new paragraph + Another new paragraph EOS output = convert_string input assert_xpath '//dl', output, 1 @@ -2530,18 +2528,18 @@ Another new paragraph end test "should only grab one literal line following last item if item has no inline description" do - input = <<-EOS -term1:: + input = <<~EOS + term1:: -def1 + def1 -term2:: + term2:: - def2 + def2 -A new paragraph + A new paragraph -Another new paragraph + Another new paragraph EOS output = convert_string input assert_xpath '//dl', output, 1 @@ -2554,18 +2552,18 @@ Another new paragraph end test "should append subsequent paragraph literals to list item as block content" do - input = <<-EOS -term1:: + input = <<~EOS + term1:: -def1 + def1 -term2:: + term2:: - def2 + def2 - literal + literal -A new paragraph. + A new paragraph. EOS output = convert_string input assert_xpath '//dl', output, 1 @@ -2579,12 +2577,12 @@ A new paragraph. end test 'should not match comment line that looks like description list term' do - input = <<-EOS -before + input = <<~'EOS' + before -//key:: val + //key:: val -after + after EOS output = convert_string_to_embedded input @@ -2592,13 +2590,13 @@ after end test 'should not match comment line following list that looks like description list term' do - input = <<-EOS -* item + input = <<~'EOS' + * item -//:: -== Section + //:: + == Section -section text + section text EOS output = convert_string_to_embedded input @@ -2609,13 +2607,13 @@ section text end test 'should not match comment line that looks like sibling description list term' do - input = <<-EOS -before + input = <<~'EOS' + before -foo:: bar -//yin:: yang + foo:: bar + //yin:: yang -after + after EOS output = convert_string_to_embedded input @@ -2625,10 +2623,10 @@ after end test 'should not hang on description list item in list that begins with ///' do - input = <<-EOS -* x -///:: -y + input = <<~'EOS' + * x + ///:: + y EOS output = convert_string_to_embedded input @@ -2639,10 +2637,10 @@ y end test 'should not hang on sibling description list item that begins with ///' do - input = <<-EOS -:: -///:: -y + input = <<~'EOS' + :: + ///:: + y EOS output = convert_string_to_embedded input @@ -2653,12 +2651,12 @@ y end test 'should skip dlist term that begins with // unless it begins with ///' do - input = <<-EOS -category a:: -//ignored term:: def + input = <<~'EOS' + category a:: + //ignored term:: def -category b:: -///term:: def + category b:: + ///term:: def EOS output = convert_string_to_embedded input @@ -2667,10 +2665,7 @@ category b:: end test 'more than 4 consecutive colons should become part of description list term' do - input = <<-EOS -A term::::: a description - EOS - + input = 'A term::::: a description' output = convert_string_to_embedded input assert_xpath '//dl', output, 1 assert_xpath '//dt', output, 1 @@ -2679,10 +2674,10 @@ A term::::: a description end test 'text method of dd node should return nil if dd node only contains blocks' do - input = <<-EOS -term:: -+ -paragraph + input = <<~'EOS' + term:: + + + paragraph EOS doc = document_from_string input @@ -2691,10 +2686,10 @@ paragraph end test 'should match trailing line separator in text of list item' do - input = <<-EOS.chomp -A:: a -B:: b#{decode_char 8232} -C:: c + input = <<~EOS.chomp + A:: a + B:: b#{decode_char 8232} + C:: c EOS output = convert_string input @@ -2703,10 +2698,10 @@ C:: c end test 'should match line separator in text of list item' do - input = <<-EOS.chomp -A:: a -B:: b#{decode_char 8232}b -C:: c + input = <<~EOS.chomp + A:: a + B:: b#{decode_char 8232}b + C:: c EOS output = convert_string input @@ -2717,10 +2712,10 @@ C:: c context "Nested lists" do test "single-line adjacent nested elements" do - input = <<-EOS -term1:: def1 -label1::: detail1 -term2:: def2 + input = <<~'EOS' + term1:: def1 + label1::: detail1 + term2:: def2 EOS output = convert_string input assert_xpath '//dl', output, 2 @@ -2734,12 +2729,12 @@ term2:: def2 end test "single-line adjacent maximum nested elements" do - input = <<-EOS -term1:: def1 -label1::: detail1 -name1:::: value1 -item1;; price1 -term2:: def2 + input = <<~'EOS' + term1:: def1 + label1::: detail1 + name1:::: value1 + item1;; price1 + term2:: def2 EOS output = convert_string input assert_xpath '//dl', output, 4 @@ -2747,12 +2742,12 @@ term2:: def2 end test "single-line nested elements seperated by blank line at top level" do - input = <<-EOS -term1:: def1 + input = <<~'EOS' + term1:: def1 -label1::: detail1 + label1::: detail1 -term2:: def2 + term2:: def2 EOS output = convert_string input assert_xpath '//dl', output, 2 @@ -2766,12 +2761,12 @@ term2:: def2 end test "single-line nested elements seperated by blank line at nested level" do - input = <<-EOS -term1:: def1 -label1::: detail1 + input = <<~'EOS' + term1:: def1 + label1::: detail1 -label2::: detail2 -term2:: def2 + label2::: detail2 + term2:: def2 EOS output = convert_string input assert_xpath '//dl', output, 2 @@ -2785,10 +2780,10 @@ term2:: def2 end test "single-line adjacent nested elements with alternate delimiters" do - input = <<-EOS -term1:: def1 -label1;; detail1 -term2:: def2 + input = <<~'EOS' + term1:: def1 + label1;; detail1 + term2:: def2 EOS output = convert_string input assert_xpath '//dl', output, 2 @@ -2802,13 +2797,13 @@ term2:: def2 end test "multi-line adjacent nested elements" do - input = <<-EOS -term1:: -def1 -label1::: -detail1 -term2:: -def2 + input = <<~'EOS' + term1:: + def1 + label1::: + detail1 + term2:: + def2 EOS output = convert_string input assert_xpath '//dl', output, 2 @@ -2822,16 +2817,16 @@ def2 end test "multi-line nested elements seperated by blank line at nested level repeated" do - input = <<-EOS -term1:: -def1 -label1::: + input = <<~'EOS' + term1:: + def1 + label1::: -detail1 -label2::: -detail2 + detail1 + label2::: + detail2 -term2:: def2 + term2:: def2 EOS output = convert_string input assert_xpath '//dl', output, 2 @@ -2845,13 +2840,13 @@ term2:: def2 end test "multi-line element with indented nested element" do - input = <<-EOS -term1:: - def1 - label1;; - detail1 -term2:: - def2 + input = <<~EOS + term1:: + def1 + label1;; + detail1 + term2:: + def2 EOS output = convert_string input assert_xpath '//dl', output, 2 @@ -2868,11 +2863,11 @@ term2:: end test "mixed single and multi-line elements with indented nested elements" do - input = <<-EOS -term1:: def1 - label1::: - detail1 -term2:: def2 + input = <<~EOS + term1:: def1 + label1::: + detail1 + term2:: def2 EOS output = convert_string input assert_xpath '//dl', output, 2 @@ -2886,11 +2881,11 @@ term2:: def2 end test "multi-line elements with first paragraph folded to text with adjacent nested element" do - input = <<-EOS -term1:: def1 -continued -label1::: -detail1 + input = <<~'EOS' + term1:: def1 + continued + label1::: + detail1 EOS output = convert_string input assert_xpath '//dl', output, 2 @@ -2905,10 +2900,10 @@ detail1 context 'Special lists' do test 'should convert glossary list with proper semantics' do - input = <<-EOS -[glossary] -term 1:: def 1 -term 2:: def 2 + input = <<~'EOS' + [glossary] + term 1:: def 1 + term 2:: def 2 EOS output = convert_string_to_embedded input assert_css '.dlist.glossary', output, 1 @@ -2916,13 +2911,13 @@ term 2:: def 2 end test 'consecutive glossary terms should share same glossentry element in docbook' do - input = <<-EOS -[glossary] -term:: -alt term:: -description + input = <<~'EOS' + [glossary] + term:: + alt term:: + description -last:: + last:: EOS output = convert_string_to_embedded input, backend: 'docbook' assert_xpath '/glossentry', output, 2 @@ -2933,13 +2928,13 @@ last:: end test 'should convert horizontal list with proper markup' do - input = <<-EOS -[horizontal] -first term:: description -+ -more detail + input = <<~'EOS' + [horizontal] + first term:: description + + + more detail -second term:: description + second term:: description EOS output = convert_string_to_embedded input assert_css '.hdlist', output, 1 @@ -2962,10 +2957,10 @@ second term:: description end test 'should set col widths of item and label if specified' do - input = <<-EOS -[horizontal] -[labelwidth="25", itemwidth="75"] -term:: def + input = <<~'EOS' + [horizontal] + [labelwidth="25", itemwidth="75"] + term:: def EOS output = convert_string_to_embedded input @@ -2977,10 +2972,10 @@ term:: def end test 'should set col widths of item and label in docbook if specified' do - input = <<-EOS -[horizontal] -[labelwidth="25", itemwidth="75"] -term:: def + input = <<~'EOS' + [horizontal] + [labelwidth="25", itemwidth="75"] + term:: def EOS output = convert_string_to_embedded input, backend: 'docbook' @@ -2992,9 +2987,9 @@ term:: def end test 'should add strong class to label if strong option is set' do - input = <<-EOS -[horizontal, options="strong"] -term:: def + input = <<~'EOS' + [horizontal, options="strong"] + term:: def EOS output = convert_string_to_embedded input @@ -3003,13 +2998,13 @@ term:: def end test 'consecutive terms in horizontal list should share same cell' do - input = <<-EOS -[horizontal] -term:: -alt term:: -description + input = <<~'EOS' + [horizontal] + term:: + alt term:: + description -last:: + last:: EOS output = convert_string_to_embedded input assert_xpath '//tr', output, 2 @@ -3021,13 +3016,13 @@ last:: end test 'consecutive terms in horizontal list should share same entry in docbook' do - input = <<-EOS -[horizontal] -term:: -alt term:: -description + input = <<~'EOS' + [horizontal] + term:: + alt term:: + description -last:: + last:: EOS output = convert_string_to_embedded input, backend: 'docbook' assert_xpath '//row', output, 2 @@ -3038,14 +3033,14 @@ last:: end test 'should convert horizontal list in docbook with proper markup' do - input = <<-EOS -.Terms -[horizontal] -first term:: description -+ -more detail + input = <<~'EOS' + .Terms + [horizontal] + first term:: description + + + more detail -second term:: description + second term:: description EOS output = convert_string_to_embedded input, backend: 'docbook' assert_xpath '/table', output, 1 @@ -3058,14 +3053,14 @@ second term:: description end test 'should convert qanda list in HTML with proper semantics' do - input = <<-EOS -[qanda] -Question 1:: - Answer 1. -Question 2:: - Answer 2. -+ -NOTE: A note about Answer 2. + input = <<~EOS + [qanda] + Question 1:: + Answer 1. + Question 2:: + Answer 2. + + + NOTE: A note about Answer 2. EOS output = convert_string_to_embedded input assert_css '.qlist.qanda', output, 1 @@ -3082,14 +3077,14 @@ NOTE: A note about Answer 2. end test 'should convert qanda list in DocBook with proper semantics' do - input = <<-EOS -[qanda] -Question 1:: - Answer 1. -Question 2:: - Answer 2. -+ -NOTE: A note about Answer 2. + input = <<~EOS + [qanda] + Question 1:: + Answer 1. + Question 2:: + Answer 2. + + + NOTE: A note about Answer 2. EOS output = convert_string_to_embedded input, backend: 'docbook' assert_css 'qandaset', output, 1 @@ -3106,13 +3101,13 @@ NOTE: A note about Answer 2. end test 'consecutive questions should share same question element in docbook' do - input = <<-EOS -[qanda] -question:: -follow-up question:: -response + input = <<~'EOS' + [qanda] + question:: + follow-up question:: + response -last question:: + last question:: EOS output = convert_string_to_embedded input, backend: 'docbook' assert_xpath '//qandaentry', output, 2 @@ -3124,13 +3119,13 @@ last question:: end test 'should convert bibliography list with proper semantics' do - input = <<-EOS -[bibliography] -- [[[taoup]]] Eric Steven Raymond. 'The Art of Unix - Programming'. Addison-Wesley. ISBN 0-13-142901-9. -- [[[walsh-muellner]]] Norman Walsh & Leonard Muellner. - 'DocBook - The Definitive Guide'. O'Reilly & Associates. 1999. - ISBN 1-56592-580-7. + input = <<~EOS + [bibliography] + - [[[taoup]]] Eric Steven Raymond. 'The Art of Unix + Programming'. Addison-Wesley. ISBN 0-13-142901-9. + - [[[walsh-muellner]]] Norman Walsh & Leonard Muellner. + 'DocBook - The Definitive Guide'. O'Reilly & Associates. 1999. + ISBN 1-56592-580-7. EOS output = convert_string_to_embedded input assert_css '.ulist.bibliography', output, 1 @@ -3144,13 +3139,13 @@ last question:: end test 'should convert bibliography list with proper semantics to DocBook' do - input = <<-EOS -[bibliography] -- [[[taoup]]] Eric Steven Raymond. 'The Art of Unix - Programming'. Addison-Wesley. ISBN 0-13-142901-9. -- [[[walsh-muellner]]] Norman Walsh & Leonard Muellner. - 'DocBook - The Definitive Guide'. O'Reilly & Associates. 1999. - ISBN 1-56592-580-7. + input = <<~EOS + [bibliography] + - [[[taoup]]] Eric Steven Raymond. 'The Art of Unix + Programming'. Addison-Wesley. ISBN 0-13-142901-9. + - [[[walsh-muellner]]] Norman Walsh & Leonard Muellner. + 'DocBook - The Definitive Guide'. O'Reilly & Associates. 1999. + ISBN 1-56592-580-7. EOS output = convert_string_to_embedded input, backend: 'docbook' assert_css 'bibliodiv', output, 1 @@ -3163,12 +3158,12 @@ last question:: end test 'should warn if a bibliography ID is already in use' do - input = <<-EOS -[bibliography] -* [[[Fowler]]] Fowler M. _Analysis Patterns: Reusable Object Models_. -Addison-Wesley. 1997. -* [[[Fowler]]] Fowler M. _Analysis Patterns: Reusable Object Models_. -Addison-Wesley. 1997. + input = <<~'EOS' + [bibliography] + * [[[Fowler]]] Fowler M. _Analysis Patterns: Reusable Object Models_. + Addison-Wesley. 1997. + * [[[Fowler]]] Fowler M. _Analysis Patterns: Reusable Object Models_. + Addison-Wesley. 1997. EOS using_memory_logger do |logger| output = convert_string_to_embedded input @@ -3180,19 +3175,19 @@ Addison-Wesley. 1997. end test 'should automatically add bibliography style to top-level lists in bibliography section' do - input = <<-EOS -[bibliography] -== Bibliography + input = <<~EOS + [bibliography] + == Bibliography -.Books -* [[[taoup]]] Eric Steven Raymond. _The Art of Unix - Programming_. Addison-Wesley. ISBN 0-13-142901-9. -* [[[walsh-muellner]]] Norman Walsh & Leonard Muellner. - _DocBook - The Definitive Guide_. O'Reilly & Associates. 1999. - ISBN 1-56592-580-7. + .Books + * [[[taoup]]] Eric Steven Raymond. _The Art of Unix + Programming_. Addison-Wesley. ISBN 0-13-142901-9. + * [[[walsh-muellner]]] Norman Walsh & Leonard Muellner. + _DocBook - The Definitive Guide_. O'Reilly & Associates. 1999. + ISBN 1-56592-580-7. -.Periodicals -* [[[doc-writer]]] Doc Writer. _Documentation As Code_. Static Times, 54. August 2016. + .Periodicals + * [[[doc-writer]]] Doc Writer. _Documentation As Code_. Static Times, 54. August 2016. EOS doc = document_from_string input ulists = doc.find_by context: :ulist @@ -3202,9 +3197,9 @@ Addison-Wesley. 1997. end test 'should not recognize bibliography anchor that begins with a digit' do - input = <<-EOS -[bibliography] -- [[[1984]]] George Orwell. '1984'. New American Library. 1950. + input = <<~'EOS' + [bibliography] + - [[[1984]]] George Orwell. '1984'. New American Library. 1950. EOS output = convert_string_to_embedded input @@ -3213,9 +3208,9 @@ Addison-Wesley. 1997. end test 'should recognize bibliography anchor that contains a digit but does not start with one' do - input = <<-EOS -[bibliography] -- [[[_1984]]] George Orwell. '1984'. New American Library. 1950. + input = <<~'EOS' + [bibliography] + - [[[_1984]]] George Orwell. '1984'. New American Library. 1950. EOS output = convert_string_to_embedded input @@ -3225,15 +3220,15 @@ Addison-Wesley. 1997. end test 'should catalog bibliography anchors in bibliography list' do - input = <<-EOS -= Article Title + input = <<~'EOS' + = Article Title -Please read #{'<<'}Fowler_1997>>. + Please read <<Fowler_1997>>. -[bibliography] -== References + [bibliography] + == References -* [[[Fowler_1997]]] Fowler M. _Analysis Patterns: Reusable Object Models_. Addison-Wesley. 1997. + * [[[Fowler_1997]]] Fowler M. _Analysis Patterns: Reusable Object Models_. Addison-Wesley. 1997. EOS doc = document_from_string input @@ -3243,15 +3238,15 @@ Please read #{'<<'}Fowler_1997>>. end test 'should use reftext from bibliography anchor at xref and entry' do - input = <<-EOS -= Article Title + input = <<~'EOS' + = Article Title -Please read #{'<<'}Fowler_1997>>. + Please read <<Fowler_1997>>. -[bibliography] -== References + [bibliography] + == References -* [[[Fowler_1997,1]]] Fowler M. _Analysis Patterns: Reusable Object Models_. Addison-Wesley. 1997. + * [[[Fowler_1997,1]]] Fowler M. _Analysis Patterns: Reusable Object Models_. Addison-Wesley. 1997. EOS doc = document_from_string input, header_footer: false @@ -3267,9 +3262,9 @@ Please read #{'<<'}Fowler_1997>>. end test 'should assign reftext of bibliography anchor to xreflabel in DocBook backend' do - input = <<-EOS -[bibliography] -* [[[Fowler_1997,1]]] Fowler M. _Analysis Patterns: Reusable Object Models_. Addison-Wesley. 1997. + input = <<~'EOS' + [bibliography] + * [[[Fowler_1997,1]]] Fowler M. _Analysis Patterns: Reusable Object Models_. Addison-Wesley. 1997. EOS result = convert_string_to_embedded input, backend: :docbook @@ -3283,11 +3278,11 @@ context 'Description lists redux' do context 'Label without text on same line' do test 'folds text from subsequent line' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: -def1 + term1:: + def1 EOS output = convert_string_to_embedded input @@ -3297,13 +3292,13 @@ def1 end test 'folds text from first line after blank lines' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: + term1:: -def1 + def1 EOS output = convert_string_to_embedded input @@ -3313,13 +3308,13 @@ def1 end test 'folds text from first line after blank line and immediately preceding next item' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: + term1:: -def1 -term2:: def2 + def1 + term2:: def2 EOS output = convert_string_to_embedded input @@ -3329,14 +3324,14 @@ term2:: def2 end test 'paragraph offset by blank lines does not break list if label does not have inline text' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: + term1:: -def1 + def1 -term2:: def2 + term2:: def2 EOS output = convert_string_to_embedded input @@ -3347,12 +3342,12 @@ term2:: def2 end test 'folds text from first line after comment line' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: -// comment -def1 + term1:: + // comment + def1 EOS output = convert_string_to_embedded input @@ -3362,13 +3357,13 @@ def1 end test 'folds text from line following comment line offset by blank line' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: + term1:: -// comment -def1 + // comment + def1 EOS output = convert_string_to_embedded input @@ -3378,11 +3373,11 @@ def1 end test 'folds text from subsequent indented line' do - input = <<-EOS -== Lists + input = <<~EOS + == Lists -term1:: - def1 + term1:: + def1 EOS output = convert_string_to_embedded input @@ -3392,12 +3387,12 @@ term1:: end test 'folds text from indented line after blank line' do - input = <<-EOS -== Lists + input = <<~EOS + == Lists -term1:: + term1:: - def1 + def1 EOS output = convert_string_to_embedded input @@ -3407,12 +3402,12 @@ term1:: end test 'folds text that looks like ruler offset by blank line' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: + term1:: -''' + ''' EOS output = convert_string_to_embedded input @@ -3422,13 +3417,13 @@ term1:: end test 'folds text that looks like ruler offset by blank line and line comment' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: + term1:: -// comment -''' + // comment + ''' EOS output = convert_string_to_embedded input @@ -3438,13 +3433,13 @@ term1:: end test 'folds text that looks like ruler and the line following it offset by blank line' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: + term1:: -''' -continued + ''' + continued EOS output = convert_string_to_embedded input @@ -3454,12 +3449,12 @@ continued end test 'folds text that looks like title offset by blank line' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: + term1:: -.def1 + .def1 EOS output = convert_string_to_embedded input @@ -3469,13 +3464,13 @@ term1:: end test 'folds text that looks like title offset by blank line and line comment' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: + term1:: -// comment -.def1 + // comment + .def1 EOS output = convert_string_to_embedded input @@ -3485,12 +3480,12 @@ term1:: end test 'folds text that looks like admonition offset by blank line' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: + term1:: -NOTE: def1 + NOTE: def1 EOS output = convert_string_to_embedded input @@ -3500,12 +3495,12 @@ NOTE: def1 end test 'folds text that looks like section title offset by blank line' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: + term1:: -== Another Section + == Another Section EOS output = convert_string_to_embedded input @@ -3516,17 +3511,17 @@ term1:: end test 'folds text of first literal line offset by blank line appends subsequent literals offset by blank line as blocks' do - input = <<-EOS -== Lists + input = <<~EOS + == Lists -term1:: + term1:: - def1 + def1 - literal + literal - literal + literal EOS output = convert_string_to_embedded input @@ -3538,15 +3533,15 @@ term1:: end test 'folds text of subsequent line and appends following literal line offset by blank line as block if term has no inline description' do - input = <<-EOS -== Lists + input = <<~EOS + == Lists -term1:: -def1 + term1:: + def1 - literal + literal -term2:: def2 + term2:: def2 EOS output = convert_string_to_embedded input @@ -3558,12 +3553,12 @@ term2:: def2 end test 'appends literal line attached by continuation as block if item has no inline description' do - input = <<-EOS -== Lists + input = <<~EOS + == Lists -term1:: -+ - literal + term1:: + + + literal EOS output = convert_string_to_embedded input @@ -3575,14 +3570,14 @@ term1:: end test 'appends literal line attached by continuation as block if item has no inline description followed by ruler' do - input = <<-EOS -== Lists + input = <<~EOS + == Lists -term1:: -+ - literal + term1:: + + + literal -''' + ''' EOS output = convert_string_to_embedded input @@ -3595,14 +3590,14 @@ term1:: end test 'appends line attached by continuation as block if item has no inline description followed by ruler' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: -+ -para + term1:: + + + para -''' + ''' EOS output = convert_string_to_embedded input @@ -3615,16 +3610,16 @@ para end test 'appends line attached by continuation as block if item has no inline description followed by block' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: -+ -para + term1:: + + + para -.... -literal -.... + .... + literal + .... EOS output = convert_string_to_embedded input @@ -3638,17 +3633,17 @@ literal end test 'appends block attached by continuation but not subsequent block not attached by continuation' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: -+ -.... -literal -.... -.... -detached -.... + term1:: + + + .... + literal + .... + .... + detached + .... EOS output = convert_string_to_embedded input @@ -3662,14 +3657,14 @@ detached end test 'appends list if item has no inline description' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: + term1:: -* one -* two -* three + * one + * two + * three EOS output = convert_string_to_embedded input @@ -3680,15 +3675,15 @@ term1:: end test 'appends list to first term when followed immediately by second term' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: + term1:: -* one -* two -* three -term2:: def2 + * one + * two + * three + term2:: def2 EOS output = convert_string_to_embedded input @@ -3700,19 +3695,19 @@ term2:: def2 end test 'appends indented list to first term that is adjacent to second term' do - input = <<-EOS -== Lists + input = <<~EOS + == Lists -label 1:: - description 1 + label 1:: + description 1 - * one - * two - * three -label 2:: - description 2 + * one + * two + * three + label 2:: + description 2 -paragraph + paragraph EOS output = convert_string_to_embedded input assert_css '.dlist > dl', output, 1 @@ -3728,19 +3723,19 @@ paragraph end test 'appends indented list to first term that is attached by a continuation and adjacent to second term' do - input = <<-EOS -== Lists + input = <<~EOS + == Lists -label 1:: - description 1 -+ - * one - * two - * three -label 2:: - description 2 + label 1:: + description 1 + + + * one + * two + * three + label 2:: + description 2 -paragraph + paragraph EOS output = convert_string_to_embedded input assert_css '.dlist > dl', output, 1 @@ -3756,17 +3751,17 @@ paragraph end test 'appends list and paragraph block when line following list attached by continuation' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: + term1:: -* one -* two -* three + * one + * two + * three -+ -para + + + para EOS output = convert_string_to_embedded input @@ -3780,16 +3775,16 @@ para end test 'first continued line associated with nested list item and second continued line associated with term' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: -* one -+ -nested list para + term1:: + * one + + + nested list para -+ -term1 para + + + term1 para EOS output = convert_string_to_embedded input @@ -3804,16 +3799,16 @@ term1 para end test 'literal line attached by continuation swallows adjacent line that looks like term' do - input = <<-EOS -== Lists + input = <<~EOS + == Lists -term1:: -+ - literal -notnestedterm::: -+ - literal -notnestedterm::: + term1:: + + + literal + notnestedterm::: + + + literal + notnestedterm::: EOS output = convert_string_to_embedded input @@ -3825,12 +3820,12 @@ notnestedterm::: end test 'line attached by continuation is appended as paragraph if term has no inline description' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: -+ -para + term1:: + + + para EOS output = convert_string_to_embedded input @@ -3842,11 +3837,11 @@ para end test 'attached paragraph does not break on adjacent nested description list term' do - input = <<-EOS -term1:: def -+ -more description -not a term::: def + input = <<~'EOS' + term1:: def + + + more description + not a term::: def EOS output = convert_string_to_embedded input @@ -3859,11 +3854,11 @@ not a term::: def # FIXME pending =begin test 'attached paragraph does not break on adjacent sibling description list term' do - input = <<-EOS -term1:: def -+ -more description -not a term:: def + input = <<~'EOS' + term1:: def + + + more description + not a term:: def EOS output = convert_string_to_embedded input @@ -3875,12 +3870,12 @@ not a term:: def =end test 'attached styled paragraph does not break on adjacent nested description list term' do - input = <<-EOS -term1:: def -+ -[quote] -more description -not a term::: def + input = <<~'EOS' + term1:: def + + + [quote] + more description + not a term::: def EOS output = convert_string_to_embedded input @@ -3891,14 +3886,14 @@ not a term::: def end test 'appends line as paragraph if attached by continuation following blank line and line comment when term has no inline description' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: + term1:: -// comment -+ -para + // comment + + + para EOS output = convert_string_to_embedded input @@ -3910,13 +3905,13 @@ para end test 'line attached by continuation offset by blank line is appended as paragraph if term has no inline description' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: + term1:: -+ -para + + + para EOS output = convert_string_to_embedded input @@ -3928,13 +3923,13 @@ para end test 'delimited block breaks list even when term has no inline description' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: -==== -detached -==== + term1:: + ==== + detached + ==== EOS output = convert_string_to_embedded input @@ -3945,12 +3940,12 @@ detached end test 'attribute line breaks list even when term has no inline description' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: -[verse] -detached + term1:: + [verse] + detached EOS output = convert_string_to_embedded input @@ -3961,12 +3956,12 @@ detached end test 'id line breaks list even when term has no inline description' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: -[[id]] -detached + term1:: + [[id]] + detached EOS output = convert_string_to_embedded input @@ -3980,11 +3975,11 @@ detached context 'Item with text inline' do test 'folds text from inline description and subsequent line' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: def1 -continued + term1:: def1 + continued EOS output = convert_string_to_embedded input @@ -3994,12 +3989,12 @@ continued end test 'folds text from inline description and subsequent lines' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: def1 -continued -continued + term1:: def1 + continued + continued EOS output = convert_string_to_embedded input @@ -4009,12 +4004,12 @@ continued end test 'folds text from inline description and line following comment line' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: def1 -// comment -continued + term1:: def1 + // comment + continued EOS output = convert_string_to_embedded input @@ -4024,11 +4019,11 @@ continued end test 'folds text from inline description and subsequent indented line' do - input = <<-EOS -== Lists + input = <<~EOS + == List -term1:: def1 - continued + term1:: def1 + continued EOS output = convert_string_to_embedded input @@ -4038,12 +4033,12 @@ term1:: def1 end test 'appends literal line offset by blank line as block if item has inline description' do - input = <<-EOS -== Lists + input = <<~EOS + == Lists -term1:: def1 + term1:: def1 - literal + literal EOS output = convert_string_to_embedded input @@ -4055,14 +4050,14 @@ term1:: def1 end test 'appends literal line offset by blank line as block and appends line after continuation as block if item has inline description' do - input = <<-EOS -== Lists + input = <<~EOS + == Lists -term1:: def1 + term1:: def1 - literal -+ -para + literal + + + para EOS output = convert_string_to_embedded input @@ -4076,14 +4071,14 @@ para end test 'appends line after continuation as block and literal line offset by blank line as block if item has inline description' do - input = <<-EOS -== Lists + input = <<~EOS + == Lists -term1:: def1 -+ -para + term1:: def1 + + + para - literal + literal EOS output = convert_string_to_embedded input @@ -4097,14 +4092,14 @@ para end test 'appends list if item has inline description' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: def1 + term1:: def1 -* one -* two -* three + * one + * two + * three EOS output = convert_string_to_embedded input @@ -4115,14 +4110,14 @@ term1:: def1 end test 'appends literal line attached by continuation as block if item has inline description followed by ruler' do - input = <<-EOS -== Lists + input = <<~EOS + == Lists -term1:: def1 -+ - literal + term1:: def1 + + + literal -''' + ''' EOS output = convert_string_to_embedded input @@ -4135,12 +4130,12 @@ term1:: def1 end test 'line offset by blank line breaks list if term has inline description' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: def1 + term1:: def1 -detached + detached EOS output = convert_string_to_embedded input @@ -4152,16 +4147,16 @@ detached end test 'nested term with description does not consume following heading' do - input = <<-EOS -== Lists + input = <<~EOS + == Lists -term:: - def - nestedterm;; - nesteddef + term:: + def + nestedterm;; + nesteddef -Detached -~~~~~~~~ + Detached + ~~~~~~~~ EOS output = convert_string_to_embedded input @@ -4177,14 +4172,14 @@ Detached end test 'line attached by continuation is appended as paragraph if term has inline description followed by detached paragraph' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: def1 -+ -para + term1:: def1 + + + para -detached + detached EOS output = convert_string_to_embedded input @@ -4198,16 +4193,16 @@ detached end test 'line attached by continuation is appended as paragraph if term has inline description followed by detached block' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: def1 -+ -para + term1:: def1 + + + para -**** -detached -**** + **** + detached + **** EOS output = convert_string_to_embedded input @@ -4221,13 +4216,13 @@ detached end test 'line attached by continuation offset by line comment is appended as paragraph if term has inline description' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: def1 -// comment -+ -para + term1:: def1 + // comment + + + para EOS output = convert_string_to_embedded input @@ -4239,13 +4234,13 @@ para end test 'line attached by continuation offset by blank line is appended as paragraph if term has inline description' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: def1 + term1:: def1 -+ -para + + + para EOS output = convert_string_to_embedded input @@ -4257,14 +4252,14 @@ para end test 'line comment offset by blank line divides lists because item has text' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: def1 + term1:: def1 -// + // -term2:: def2 + term2:: def2 EOS output = convert_string_to_embedded input @@ -4272,14 +4267,14 @@ term2:: def2 end test 'ruler offset by blank line divides lists because item has text' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: def1 + term1:: def1 -''' + ''' -term2:: def2 + term2:: def2 EOS output = convert_string_to_embedded input @@ -4287,14 +4282,14 @@ term2:: def2 end test 'block title offset by blank line divides lists and becomes title of second list because item has text' do - input = <<-EOS -== Lists + input = <<~'EOS' + == Lists -term1:: def1 + term1:: def1 -.title + .title -term2:: def2 + term2:: def2 EOS output = convert_string_to_embedded input @@ -4306,11 +4301,11 @@ end context 'Callout lists' do test 'does not recognize callout list denoted by markers that only have a trailing bracket' do - input = <<-EOS ----- -require 'asciidoctor' # <1> ----- -1> Not a callout list item + input = <<~'EOS' + ---- + require 'asciidoctor' # <1> + ---- + 1> Not a callout list item EOS output = convert_string_to_embedded input @@ -4318,16 +4313,16 @@ require 'asciidoctor' # <1> end test 'listing block with sequential callouts followed by adjacent callout list' do - input = <<-EOS -[source, ruby] ----- -require 'asciidoctor' # <1> -doc = Asciidoctor::Document.new('Hello, World!') # <2> -puts doc.convert # <3> ----- -<1> Describe the first line -<2> Describe the second line -<3> Describe the third line + input = <<~'EOS' + [source, ruby] + ---- + require 'asciidoctor' # <1> + doc = Asciidoctor::Document.new('Hello, World!') # <2> + puts doc.convert # <3> + ---- + <1> Describe the first line + <2> Describe the second line + <3> Describe the third line EOS output = convert_string input, attributes: { 'backend' => 'docbook' } assert_xpath '//programlisting', output, 1 @@ -4342,19 +4337,19 @@ puts doc.convert # <3> end test 'listing block with sequential callouts followed by non-adjacent callout list' do - input = <<-EOS -[source, ruby] ----- -require 'asciidoctor' # <1> -doc = Asciidoctor::Document.new('Hello, World!') # <2> -puts doc.convert # <3> ----- - -Paragraph. - -<1> Describe the first line -<2> Describe the second line -<3> Describe the third line + input = <<~'EOS' + [source, ruby] + ---- + require 'asciidoctor' # <1> + doc = Asciidoctor::Document.new('Hello, World!') # <2> + puts doc.convert # <3> + ---- + + Paragraph. + + <1> Describe the first line + <2> Describe the second line + <3> Describe the third line EOS output = convert_string input, attributes: { 'backend' => 'docbook' } assert_xpath '//programlisting', output, 1 @@ -4370,15 +4365,15 @@ Paragraph. end test 'listing block with a callout that refers to two different lines' do - input = <<-EOS -[source, ruby] ----- -require 'asciidoctor' # <1> -doc = Asciidoctor::Document.new('Hello, World!') # <2> -puts doc.convert # <2> ----- -<1> Import the library -<2> Where the magic happens + input = <<~'EOS' + [source, ruby] + ---- + require 'asciidoctor' # <1> + doc = Asciidoctor::Document.new('Hello, World!') # <2> + puts doc.convert # <2> + ---- + <1> Import the library + <2> Where the magic happens EOS output = convert_string input, attributes: { 'backend' => 'docbook' } assert_xpath '//programlisting', output, 1 @@ -4392,16 +4387,16 @@ puts doc.convert # <2> end test 'source block with non-sequential callouts followed by adjacent callout list' do - input = <<-EOS -[source,ruby] ----- -require 'asciidoctor' # <2> -doc = Asciidoctor::Document.new('Hello, World!') # <3> -puts doc.convert # <1> ----- -<1> Describe the first line -<2> Describe the second line -<3> Describe the third line + input = <<~'EOS' + [source,ruby] + ---- + require 'asciidoctor' # <2> + doc = Asciidoctor::Document.new('Hello, World!') # <3> + puts doc.convert # <1> + ---- + <1> Describe the first line + <2> Describe the second line + <3> Describe the third line EOS output = convert_string input, attributes: { 'backend' => 'docbook' } assert_xpath '//programlisting', output, 1 @@ -4416,23 +4411,23 @@ puts doc.convert # <1> end test 'two listing blocks can share the same callout list' do - input = <<-EOS -.Import library -[source, ruby] ----- -require 'asciidoctor' # <1> ----- - -.Use library -[source, ruby] ----- -doc = Asciidoctor::Document.new('Hello, World!') # <2> -puts doc.convert # <3> ----- - -<1> Describe the first line -<2> Describe the second line -<3> Describe the third line + input = <<~'EOS' + .Import library + [source, ruby] + ---- + require 'asciidoctor' # <1> + ---- + + .Use library + [source, ruby] + ---- + doc = Asciidoctor::Document.new('Hello, World!') # <2> + puts doc.convert # <3> + ---- + + <1> Describe the first line + <2> Describe the second line + <3> Describe the third line EOS output = convert_string input, attributes: { 'backend' => 'docbook' } assert_xpath '//programlisting', output, 2 @@ -4447,22 +4442,22 @@ puts doc.convert # <3> end test 'two listing blocks each followed by an adjacent callout list' do - input = <<-EOS -.Import library -[source, ruby] ----- -require 'asciidoctor' # <1> ----- -<1> Describe the first line - -.Use library -[source, ruby] ----- -doc = Asciidoctor::Document.new('Hello, World!') # <1> -puts doc.convert # <2> ----- -<1> Describe the second line -<2> Describe the third line + input = <<~'EOS' + .Import library + [source, ruby] + ---- + require 'asciidoctor' # <1> + ---- + <1> Describe the first line + + .Use library + [source, ruby] + ---- + doc = Asciidoctor::Document.new('Hello, World!') # <1> + puts doc.convert # <2> + ---- + <1> Describe the second line + <2> Describe the third line EOS output = convert_string input, attributes: { 'backend' => 'docbook' } assert_xpath '//programlisting', output, 2 @@ -4480,21 +4475,21 @@ puts doc.convert # <2> end test 'callout list retains block content' do - input = <<-EOS -[source, ruby] ----- -require 'asciidoctor' # <1> -doc = Asciidoctor::Document.new('Hello, World!') # <2> -puts doc.convert # <3> ----- -<1> Imports the library -as a RubyGem -<2> Creates a new document -* Scans the lines for known blocks -* Converts the lines into blocks -<3> Renders the document -+ -You can write this to file rather than printing to stdout. + input = <<~'EOS' + [source, ruby] + ---- + require 'asciidoctor' # <1> + doc = Asciidoctor::Document.new('Hello, World!') # <2> + puts doc.convert # <3> + ---- + <1> Imports the library + as a RubyGem + <2> Creates a new document + * Scans the lines for known blocks + * Converts the lines into blocks + <3> Renders the document + + + You can write this to file rather than printing to stdout. EOS output = convert_string_to_embedded input assert_xpath '//ol/li', output, 3 @@ -4505,21 +4500,21 @@ You can write this to file rather than printing to stdout. end test 'callout list retains block content when converted to DocBook' do - input = <<-EOS -[source, ruby] ----- -require 'asciidoctor' # <1> -doc = Asciidoctor::Document.new('Hello, World!') # <2> -puts doc.convert # <3> ----- -<1> Imports the library -as a RubyGem -<2> Creates a new document -* Scans the lines for known blocks -* Converts the lines into blocks -<3> Renders the document -+ -You can write this to file rather than printing to stdout. + input = <<~'EOS' + [source, ruby] + ---- + require 'asciidoctor' # <1> + doc = Asciidoctor::Document.new('Hello, World!') # <2> + puts doc.convert # <3> + ---- + <1> Imports the library + as a RubyGem + <2> Creates a new document + * Scans the lines for known blocks + * Converts the lines into blocks + <3> Renders the document + + + You can write this to file rather than printing to stdout. EOS output = convert_string input, attributes: { 'backend' => 'docbook' } assert_xpath '//calloutlist', output, 1 @@ -4532,12 +4527,12 @@ You can write this to file rather than printing to stdout. end test 'escaped callout should not be interpreted as a callout' do - input = <<-EOS -[source,text] ----- -require 'asciidoctor' # \\<1> -Asciidoctor.convert 'convert me!' \\<2> ----- + input = <<~'EOS' + [source,text] + ---- + require 'asciidoctor' # \<1> + Asciidoctor.convert 'convert me!' \<2> + ---- EOS [{}, { 'source-highlighter' => 'coderay' }].each do |attributes| output = convert_string_to_embedded input, attributes: attributes @@ -4548,16 +4543,16 @@ Asciidoctor.convert 'convert me!' \\<2> end test 'should autonumber <.> callouts' do - input = <<-EOS -[source, ruby] ----- -require 'asciidoctor' # <.> -doc = Asciidoctor::Document.new('Hello, World!') # <.> -puts doc.convert # <.> ----- -<.> Describe the first line -<.> Describe the second line -<.> Describe the third line + input = <<~'EOS' + [source, ruby] + ---- + require 'asciidoctor' # <.> + doc = Asciidoctor::Document.new('Hello, World!') # <.> + puts doc.convert # <.> + ---- + <.> Describe the first line + <.> Describe the second line + <.> Describe the third line EOS output = convert_string_to_embedded input pre_html = (xmlnodes_at_css 'pre', output)[0].inner_html @@ -4569,31 +4564,31 @@ puts doc.convert # <.> end test 'should not recognize callouts in middle of line' do - input = <<-EOS -[source, ruby] ----- -puts "The syntax <1> at the end of the line makes a code callout" ----- + input = <<~'EOS' + [source, ruby] + ---- + puts "The syntax <1> at the end of the line makes a code callout" + ---- EOS output = convert_string_to_embedded input assert_xpath '//b', output, 0 end test 'should allow multiple callouts on the same line' do - input = <<-EOS -[source, ruby] ----- -require 'asciidoctor' <1> -doc = Asciidoctor.load('Hello, World!') # <2> <3> <4> -puts doc.convert <5><6> -exit 0 ----- -<1> Require library -<2> Load document from String -<3> Uses default backend and doctype -<4> One more for good luck -<5> Renders document to String -<6> Prints output to stdout + input = <<~'EOS' + [source, ruby] + ---- + require 'asciidoctor' <1> + doc = Asciidoctor.load('Hello, World!') # <2> <3> <4> + puts doc.convert <5><6> + exit 0 + ---- + <1> Require library + <2> Load document from String + <3> Uses default backend and doctype + <4> One more for good luck + <5> Renders document to String + <6> Prints output to stdout EOS output = convert_string_to_embedded input assert_xpath '//code/b', output, 6 @@ -4603,16 +4598,16 @@ exit 0 end test 'should allow XML comment-style callouts' do - input = <<-EOS -[source, xml] ----- -<section> - <title>Section Title</title> <!--1--> - <simpara>Just a paragraph</simpara> <!--2--> -</section> ----- -<1> The title is required -<2> The content isn't + input = <<~'EOS' + [source, xml] + ---- + <section> + <title>Section Title</title> <!--1--> + <simpara>Just a paragraph</simpara> <!--2--> + </section> + ---- + <1> The title is required + <2> The content isn't EOS output = convert_string_to_embedded input assert_xpath '//b', output, 2 @@ -4621,22 +4616,22 @@ exit 0 end test 'should not allow callouts with half an XML comment' do - input = <<-EOS ----- -First line <1--> -Second line <2--> ----- + input = <<~'EOS' + ---- + First line <1--> + Second line <2--> + ---- EOS output = convert_string_to_embedded input assert_xpath '//b', output, 0 end test 'should not recognize callouts in an indented description list paragraph' do - input = <<-EOS -foo:: - bar <1> + input = <<~EOS + foo:: + bar <1> -<1> Not pointing to a callout + <1> Not pointing to a callout EOS using_memory_logger do |logger| output = convert_string_to_embedded input @@ -4648,11 +4643,11 @@ foo:: end test 'should not recognize callouts in an indented outline list paragraph' do - input = <<-EOS -* foo - bar <1> + input = <<~EOS + * foo + bar <1> -<1> Not pointing to a callout + <1> Not pointing to a callout EOS using_memory_logger do |logger| output = convert_string_to_embedded input @@ -4664,15 +4659,15 @@ foo:: end test 'should warn if numbers in callout list are out of sequence' do - input = <<-EOS ----- -<beans> <1> - <bean class="com.example.HelloWorld"/> -</beans> ----- -<1> Container of beans. -Beans are fun. -<3> An actual bean. + input = <<~'EOS' + ---- + <beans> <1> + <bean class="com.example.HelloWorld"/> + </beans> + ---- + <1> Container of beans. + Beans are fun. + <3> An actual bean. EOS using_memory_logger do |logger| output = convert_string_to_embedded input @@ -4685,31 +4680,31 @@ Beans are fun. end test 'should preserve line comment chars that precede callout number if icons is not set' do - input = <<-EOS -[source,ruby] ----- -puts 'Hello, world!' # <1> ----- -<1> Ruby - -[source,groovy] ----- -println 'Hello, world!' // <1> ----- -<1> Groovy - -[source,clojure] ----- -(def hello (fn [] "Hello, world!")) ;; <1> -(hello) ----- -<1> Clojure - -[source,haskell] ----- -main = putStrLn "Hello, World!" -- <1> ----- -<1> Haskell + input = <<~'EOS' + [source,ruby] + ---- + puts 'Hello, world!' # <1> + ---- + <1> Ruby + + [source,groovy] + ---- + println 'Hello, world!' // <1> + ---- + <1> Groovy + + [source,clojure] + ---- + (def hello (fn [] "Hello, world!")) ;; <1> + (hello) + ---- + <1> Clojure + + [source,haskell] + ---- + main = putStrLn "Hello, World!" -- <1> + ---- + <1> Haskell EOS [{}, { 'source-highlighter' => 'coderay' }].each do |attributes| output = convert_string_to_embedded input, attributes: attributes @@ -4723,31 +4718,31 @@ main = putStrLn "Hello, World!" -- <1> end test 'should remove line comment chars that precede callout number if icons is font' do - input = <<-EOS -[source,ruby] ----- -puts 'Hello, world!' # <1> ----- -<1> Ruby - -[source,groovy] ----- -println 'Hello, world!' // <1> ----- -<1> Groovy - -[source,clojure] ----- -(def hello (fn [] "Hello, world!")) ;; <1> -(hello) ----- -<1> Clojure - -[source,haskell] ----- -main = putStrLn "Hello, World!" -- <1> ----- -<1> Haskell + input = <<~'EOS' + [source,ruby] + ---- + puts 'Hello, world!' # <1> + ---- + <1> Ruby + + [source,groovy] + ---- + println 'Hello, world!' // <1> + ---- + <1> Groovy + + [source,clojure] + ---- + (def hello (fn [] "Hello, world!")) ;; <1> + (hello) + ---- + <1> Clojure + + [source,haskell] + ---- + main = putStrLn "Hello, World!" -- <1> + ---- + <1> Haskell EOS [{}, { 'source-highlighter' => 'coderay' }].each do |attributes| output = convert_string_to_embedded input, attributes: attributes.merge({ 'icons' => 'font' }) @@ -4762,14 +4757,14 @@ main = putStrLn "Hello, World!" -- <1> end test 'should allow line comment chars that precede callout number to be specified' do - input = <<-EOS -[source,erlang,line-comment=%] ----- -hello_world() -> % <1> - io:fwrite("hello, world~n"). %<2> ----- -<1> Erlang function clause head. -<2> ~n adds a new line to the output. + input = <<~'EOS' + [source,erlang,line-comment=%] + ---- + hello_world() -> % <1> + io:fwrite("hello, world~n"). %<2> + ---- + <1> Erlang function clause head. + <2> ~n adds a new line to the output. EOS output = convert_string_to_embedded input assert_xpath '//b', output, 2 @@ -4778,13 +4773,13 @@ hello_world() -> % <1> end test 'should allow line comment chars preceding callout number to be configurable when source-highlighter is coderay' do - input = <<-EOS -[source,html,line-comment=-#] ----- --# <1> -%p Hello ----- -<1> Prints a paragraph with the text "Hello" + input = <<~'EOS' + [source,html,line-comment=-#] + ---- + -# <1> + %p Hello + ---- + <1> Prints a paragraph with the text "Hello" EOS output = convert_string_to_embedded input, attributes: { 'source-highlighter' => 'coderay' } assert_xpath '//b', output, 1 @@ -4793,15 +4788,15 @@ hello_world() -> % <1> end test 'literal block with callouts' do - input = <<-EOS -.... -Roses are red <1> -Violets are blue <2> -.... + input = <<~'EOS' + .... + Roses are red <1> + Violets are blue <2> + .... -<1> And so is Ruby -<2> But violet is more like purple + <1> And so is Ruby + <2> But violet is more like purple EOS output = convert_string input, attributes: { 'backend' => 'docbook' } assert_xpath '//literallayout', output, 1 @@ -4814,16 +4809,16 @@ Violets are blue <2> end test 'callout list with icons enabled' do - input = <<-EOS -[source, ruby] ----- -require 'asciidoctor' # <1> -doc = Asciidoctor::Document.new('Hello, World!') # <2> -puts doc.convert # <3> ----- -<1> Describe the first line -<2> Describe the second line -<3> Describe the third line + input = <<~'EOS' + [source, ruby] + ---- + require 'asciidoctor' # <1> + doc = Asciidoctor::Document.new('Hello, World!') # <2> + puts doc.convert # <3> + ---- + <1> Describe the first line + <2> Describe the second line + <3> Describe the third line EOS output = convert_string_to_embedded input, attributes: { 'icons' => '' } assert_css '.listingblock code > img', output, 3 @@ -4837,16 +4832,16 @@ puts doc.convert # <3> end test 'callout list with font-based icons enabled' do - input = <<-EOS -[source] ----- -require 'asciidoctor' # <1> -doc = Asciidoctor::Document.new('Hello, World!') #<2> -puts doc.convert #<3> ----- -<1> Describe the first line -<2> Describe the second line -<3> Describe the third line + input = <<~'EOS' + [source] + ---- + require 'asciidoctor' # <1> + doc = Asciidoctor::Document.new('Hello, World!') #<2> + puts doc.convert #<3> + ---- + <1> Describe the first line + <2> Describe the second line + <3> Describe the third line EOS output = convert_string_to_embedded input, attributes: { 'icons' => 'font' } assert_css '.listingblock code > i', output, 3 @@ -4864,15 +4859,15 @@ puts doc.convert #<3> end test 'should match trailing line separator in text of list item' do - input = <<-EOS.chomp ----- -A <1> -B <2> -C <3> ----- -<1> a -<2> b#{decode_char 8232} -<3> c + input = <<~EOS.chomp + ---- + A <1> + B <2> + C <3> + ---- + <1> a + <2> b#{decode_char 8232} + <3> c EOS output = convert_string input @@ -4881,15 +4876,15 @@ C <3> end test 'should match line separator in text of list item' do - input = <<-EOS.chomp ----- -A <1> -B <2> -C <3> ----- -<1> a -<2> b#{decode_char 8232}b -<3> c + input = <<~EOS.chomp + ---- + A <1> + B <2> + C <3> + ---- + <1> a + <2> b#{decode_char 8232}b + <3> c EOS output = convert_string input @@ -4900,12 +4895,12 @@ end context 'Checklists' do test 'should create checklist if at least one item has checkbox syntax' do - input = <<-EOS -- [ ] todo -- [x] done -- [ ] another todo -- [*] another done -- plain + input = <<~'EOS' + - [ ] todo + - [x] done + - [ ] another todo + - [*] another done + - plain EOS doc = document_from_string input @@ -4927,10 +4922,10 @@ context 'Checklists' do end test 'should create checklist with font icons if at least one item has checkbox syntax and icons attribute is font' do - input = <<-EOS -- [ ] todo -- [x] done -- plain + input = <<~'EOS' + - [ ] todo + - [x] done + - plain EOS output = convert_string_to_embedded input, attributes: { 'icons' => 'font' } @@ -4941,12 +4936,12 @@ context 'Checklists' do end test 'should create interactive checklist if interactive option is set even with icons attribute is font' do - input = <<-EOS -:icons: font + input = <<~'EOS' + :icons: font -[%interactive] -- [ ] todo -- [x] done + [%interactive] + - [ ] todo + - [x] done EOS doc = document_from_string input @@ -4964,10 +4959,10 @@ end context 'Lists model' do test 'content should return items in list' do - input = <<-EOS -* one -* two -* three + input = <<~'EOS' + * one + * two + * three EOS doc = document_from_string input @@ -4979,12 +4974,12 @@ context 'Lists model' do end test 'list item should be the parent of block attached to a list item' do - input = <<-EOS -* list item 1 -+ ----- -listing block in list item 1 ----- + input = <<~'EOS' + * list item 1 + + + ---- + listing block in list item 1 + ---- EOS doc = document_from_string input @@ -4996,10 +4991,10 @@ listing block in list item 1 end test 'outline? should return true for unordered list' do - input = <<-EOS -* one -* two -* three + input = <<~'EOS' + * one + * two + * three EOS doc = document_from_string input @@ -5008,10 +5003,10 @@ listing block in list item 1 end test 'outline? should return true for ordered list' do - input = <<-EOS -. one -. two -. three + input = <<~'EOS' + . one + . two + . three EOS doc = document_from_string input @@ -5020,20 +5015,17 @@ listing block in list item 1 end test 'outline? should return false for description list' do - input = <<-EOS -label:: desc - EOS - + input = 'label:: desc' doc = document_from_string input list = doc.blocks.first refute list.outline? end test 'simple? should return true for list item with no nested blocks' do - input = <<-EOS -* one -* two -* three + input = <<~'EOS' + * one + * two + * three EOS doc = document_from_string input @@ -5043,12 +5035,12 @@ label:: desc end test 'simple? should return true for list item with nested outline list' do - input = <<-EOS -* one - ** more about one - ** and more -* two -* three + input = <<~EOS + * one + ** more about one + ** and more + * two + * three EOS doc = document_from_string input @@ -5058,14 +5050,14 @@ label:: desc end test 'simple? should return false for list item with block content' do - input = <<-EOS -* one -+ ----- -listing block in list item 1 ----- -* two -* three + input = <<~'EOS' + * one + + + ---- + listing block in list item 1 + ---- + * two + * three EOS doc = document_from_string input @@ -5075,10 +5067,10 @@ listing block in list item 1 end test 'should allow text of ListItem to be assigned' do - input = <<-EOS -* one -* two -* three + input = <<~'EOS' + * one + * two + * three EOS doc = document_from_string input @@ -5090,11 +5082,11 @@ listing block in list item 1 end test 'should allow API control over substitutions applied to ListItem text' do - input = <<-EOS -* *one* -* _two_ -* `three` -* #four# + input = <<~'EOS' + * *one* + * _two_ + * `three` + * #four# EOS doc = document_from_string input @@ -5113,11 +5105,11 @@ listing block in list item 1 end test 'should set lineno to line number in source where list starts' do - input = <<-EOS -* bullet 1 -** bullet 1.1 -*** bullet 1.1.1 -* bullet 2 + input = <<~'EOS' + * bullet 1 + ** bullet 1.1 + *** bullet 1.1.1 + * bullet 2 EOS doc = document_from_string input, sourcemap: true lists = doc.find_by context: :ulist |
