Skip to content

Commit

Permalink
backport fix for #3535 nested dlist attached using list continuation …
Browse files Browse the repository at this point in the history
…should not consume detached paragraph
  • Loading branch information
mojavelinux committed Nov 6, 2023
1 parent def8a66 commit 5fdc165
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Expand Up @@ -20,6 +20,7 @@ This project utilizes semantic versioning.

Bug Fixes::

* Nested dlist attached using list continuation should not consume detached paragraph (#3535)
* Preserve paragraph breaks in normal table cell in manpage output (#4481)
* Escape spaces in include target (using inline passthrough) when generating link from include directive (#4461)

Expand Down
2 changes: 1 addition & 1 deletion lib/asciidoctor/parser.rb
Expand Up @@ -1489,7 +1489,7 @@ def self.read_lines_for_list_item(reader, list_type, sibling_trait = nil, has_te
(ch0 == '[' && (BlockAttributeLineRx.match? this_line)) || (ch0 == ':' && (AttributeEntryRx.match? this_line))
buffer << this_line
else
if (nested_list_type = (within_nested_list ? [:dlist] : NESTABLE_LIST_CONTEXTS).find {|ctx| ListRxMap[ctx].match? this_line })
if (nested_list_type = (within_nested_list ? [:dlist] : NESTABLE_LIST_CONTEXTS).find {|ctx| ListRxMap[ctx] =~ this_line })
within_nested_list = true
if nested_list_type == :dlist && $3.nil_or_empty?
# get greedy again
Expand Down
15 changes: 15 additions & 0 deletions test/lists_test.rb
Expand Up @@ -3108,6 +3108,21 @@
assert_xpath '//dl//dl/dt[normalize-space(text()) = "label1"]', output, 1
assert_xpath '//dl//dl/dt/following-sibling::dd/p[text() = "detail1"]', output, 1
end

test 'nested dlist attached by list continuation should not consume detached paragraph' do
input = <<~'EOS'
term:: text
+
nested term::: text
paragraph
EOS
output = convert_string_to_embedded input
assert_xpath '//dl', output, 2
assert_xpath '//dl//dl', output, 1
assert_css '.dlist .paragraph', output, 0
assert_css '.dlist + .paragraph', output, 1
end
end

context 'Special lists' do
Expand Down

0 comments on commit 5fdc165

Please sign in to comment.