Skip to content

Commit

Permalink
resolves #4565 don't duplicate block attribute line above detached bl…
Browse files Browse the repository at this point in the history
…ock that breaks a dlist (PR #4566)
  • Loading branch information
mojavelinux committed May 6, 2024
1 parent ffab036 commit d9e6cad
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions lib/asciidoctor/parser.rb
Expand Up @@ -1473,6 +1473,7 @@ def self.read_lines_for_list_item reader, list_type, sibling_trait = nil, has_te
break
end
if interrupt
this_line = nil
reader.unshift_lines block_attribute_lines
break
end
Expand Down
34 changes: 32 additions & 2 deletions test/lists_test.rb
Expand Up @@ -4157,7 +4157,23 @@ def 1
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
Expand All @@ -4173,7 +4189,21 @@ def 1
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
Expand Down

0 comments on commit d9e6cad

Please sign in to comment.