Skip to content

fix(asciidoc): add the paragraph before a list or table first - #4878

Open
wfatih wants to merge 1 commit into
docling-project:mainfrom
wfatih:fix/asciidoc-flush-before-block
Open

wfatih wants to merge 1 commit into
docling-project:mainfrom
wfatih:fix/asciidoc-flush-before-block

Conversation

@wfatih

@wfatih wfatih commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

AsciiDocBackend collects paragraph lines in text_data and only adds them to the document at a blank line, a section header (#4428) or a literal block. When a list or a delimited table follows the text directly, the text stays pending and is added later, under whatever parent is current then:

Intro:          Before
* a             |===
* b             |a|b
                |===

On main the first input gives list[a, b, paragraph "Intro:"] and the Markdown - a\n- b\nIntro:, so the paragraph sits inside the list after its items. The second gives the table first and Before after it.

This flushes the pending text when a list starts (before the bold block title paragraph, which keeps the source order) and when a |=== table opens, in the same way the section header branch already does. Nothing changes when a blank line separates the text from the list or table, because the text is already flushed there.

Two new tests cover the list and the table case. Both fail on main and pass with this change. tests/test_backend_asciidoc.py passes (44 passed) and no groundtruth changes.

Checklist:

  • Documentation has been updated, if necessary.
  • Examples have been added, if necessary.
  • Tests have been added, if necessary.

Review evidence:

  • Before: Intro:\n* a\n* b exports as - a\n- b\nIntro: (the paragraph is a child of the list group). Before\n|===\n|a|b\n|=== exports the table before Before.
  • After: Intro:\n\n- a\n- b, with the paragraph in the body before the list; Before comes before the table.
  • pytest tests/test_backend_asciidoc.py: 44 passed. The new tests fail on main (2 failed, 42 passed).
  • Groundtruth (tests/data/asciidoc/groundtruth/*) is unchanged.
  • ruff check and ruff format --check pass on the changed files.

@github-actions

Copy link
Copy Markdown
Contributor

✅ DCO Check Passed

Thanks @wfatih, all your commits are properly signed off. 🎉

@mergify

mergify Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 Merge protection satisfied — ready to merge.

Show 1 satisfied protection

🟢 Enforce conventional commit

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?(!)?:

@github-actions github-actions Bot added ai:ci-safe AI triage found no CI-safety concern (advisory) asciidoc issue related to asciidoc backend bug Something isn't working labels Oct 17, 2026
@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

AI triage (advisory)

Checked commit ec62044264. The analysis read the diff only. It did not run code from this pull request.

This PR fixes AsciiDocBackend so that a pending paragraph is flushed before a list or a delimited table starts, preventing the paragraph from appearing inside the list or after the table. Two new focused tests cover both cases.

CI safety: no concern found. A maintainer must still approve CI.

3 related pull request(s) in the same code
PR State Signal Assessment
#5045 open changes the same code related: PR #5045 fixes literal/listing block delimiters in the same backend file but does not address paragraph flushing before lists or tables.
#5010 open changes the same code related: PR #5010 fixes multi-line table row grouping in the same backend file but does not address paragraph flushing before a table opens.
#4428 merged referenced as #4428 related: PR #4428 introduced the same _flush_text_data pattern at section headers (already merged); this PR extends it to list and table entry points.

The ai:* labels are advisory. They do not approve CI and they do not add tests:full. A new push runs this check again.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI first review (advisory): no blocker found

This review covers the full diff at 0663f6edc9. It read the code and did not run it.

I found no defect. Both new flushes call _flush_text_data with the same parent that the neighbouring code uses for the next item. The two new tests assert the parent, the item order and the Markdown output, so they detect the original bug.

A maintainer makes the merge decision. This review never approves the pull request.

@github-actions github-actions Bot added the ai:review-lgtm AI first review found no blocker or major issue (advisory) label Oct 17, 2026
@codecov

codecov Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
docling/backend/asciidoc_backend.py 0.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

Paragraph text is only added at a blank line, a section header or a
literal block. A list or a delimited table that follows the text
directly left it pending, so it was added after the table, or inside
the list group after the list items. Flush the pending text when a list
or a delimited table starts.

Signed-off-by: wfatih <ckrfth.s@gmail.com>
@wfatih
wfatih force-pushed the fix/asciidoc-flush-before-block branch from 0663f6e to ec62044 Compare October 27, 2026 10:16
@github-actions github-actions Bot added ai:ci-safe AI triage found no CI-safety concern (advisory) and removed ai:ci-safe AI triage found no CI-safety concern (advisory) ai:review-lgtm AI first review found no blocker or major issue (advisory) labels Oct 27, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI first review (advisory): no blocker found

This review covers the full diff at ec62044264. It read the code and did not run it.

I found no defect. Both new _flush_text_data calls use the same parent that the next item uses, so the pending paragraph is no longer added after the list or table. The text is flushed before the block-title paragraph, so source order stays correct.

A maintainer makes the merge decision. This review never approves the pull request.

@github-actions github-actions Bot added the ai:review-lgtm AI first review found no blocker or major issue (advisory) label Oct 27, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai:ci-safe AI triage found no CI-safety concern (advisory) ai:review-lgtm AI first review found no blocker or major issue (advisory) asciidoc issue related to asciidoc backend bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant