diff options
| -rw-r--r-- | CHANGELOG.adoc | 1 | ||||
| -rw-r--r-- | lib/asciidoctor/parser.rb | 1 | ||||
| -rw-r--r-- | test/lists_test.rb | 34 |
3 files changed, 34 insertions, 2 deletions
diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index e66d22b2..4ef2a054 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -69,6 +69,7 @@ Improvements:: Bug Fixes:: * Don't leave behind empty line inside skipped preprocessor conditional (#4580) + * Don't duplicate block attribute line above detached block that breaks a dlist; fixes duplicate role on detached block (#4565) == 2.0.22 (2024-03-08) - @mojavelinux diff --git a/lib/asciidoctor/parser.rb b/lib/asciidoctor/parser.rb index 0daba0d7..39439bee 100644 --- a/lib/asciidoctor/parser.rb +++ b/lib/asciidoctor/parser.rb @@ -1473,6 +1473,7 @@ class Parser break end if interrupt + this_line = nil reader.unshift_lines block_attribute_lines break end diff --git a/test/lists_test.rb b/test/lists_test.rb index a8d3dcb4..929b1dd8 100644 --- a/test/lists_test.rb +++ b/test/lists_test.rb @@ -4157,7 +4157,23 @@ context 'Description lists redux' do assert_xpath '//*[@class="dlist"]/following-sibling::*[@class="exampleblock"]//p[text()="detached"]', output, 1 end - test 'attribute line breaks list even when term has no inline description' do + test 'block attribute line above delimited block that breaks a dlist is not duplicated' do + input = <<~'EOS' + == Lists + + term:: desc + [.rolename] + ---- + detached + ---- + EOS + + output = convert_string_to_embedded input + assert_xpath '//*[@class="dlist"]/dl', output, 1 + assert_xpath '//*[@class="dlist"]/following-sibling::*[@class="listingblock rolename"]', output, 1 + end + + test 'block attribute line above paragraph breaks list even when term has no inline description' do input = <<~'EOS' == Lists @@ -4173,7 +4189,21 @@ context 'Description lists redux' do assert_xpath '//*[@class="dlist"]/following-sibling::*[@class="verseblock"]/pre[text()="detached"]', output, 1 end - test 'id line breaks list even when term has no inline description' do + test 'block attribute line above paragraph that breaks a dlist is not duplicated' do + input = <<~'EOS' + == Lists + + term:: desc + [.rolename] + detached + EOS + + output = convert_string_to_embedded input + assert_xpath '//*[@class="dlist"]/dl', output, 1 + assert_xpath '//*[@class="dlist"]/following-sibling::*[@class="paragraph rolename"]', output, 1 + end + + test 'block anchor line breaks list even when term has no inline description' do input = <<~'EOS' == Lists |
