Skip to content

Commit

Permalink
resolves asciidoctor#3535 nested dlist attached using list continuati…
Browse files Browse the repository at this point in the history
…on should not consume detached paragraph
  • Loading branch information
mojavelinux committed Nov 6, 2023
1 parent 87e75f3 commit 2dac04f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Improvements::

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
Original file line number Diff line number Diff line change
Expand Up @@ -1486,7 +1486,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
Original file line number Diff line number Diff line change
Expand Up @@ -3077,6 +3077,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 2dac04f

Please sign in to comment.