fix(asciidoc): preserve ordered lists and literal blocks - #4118
Conversation
Recognize AsciiDoc auto-number markers and literal block delimiters so list items, code, and following text stay in source order. Preserve list continuation blocks and add focused regression coverage. Signed-off-by: YushuoSun <yushuo.sun@student.unimelb.edu.au>
|
✅ DCO Check Passed Thanks @yushuosun, all your commits are properly signed off. 🎉 |
There was a problem hiding this comment.
Pull request overview
Fixes Docling’s AsciiDoc backend parsing so ordered lists using auto-numbered dot markers (., .., etc.) and literal blocks (....) are preserved in the resulting DoclingDocument/Markdown output, addressing silent content loss and reordering reported in #4117.
Changes:
- Recognize auto-numbered ordered list markers (including nested dot markers) and keep ordered-list semantics intact.
- Add literal-block (
....) delimiter handling so literal blocks becomeCodeItems instead of being absorbed into paragraph buffering. - Regenerate affected AsciiDoc regression groundtruth outputs and add targeted backend tests for ordered lists and literal blocks.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
docling/backend/asciidoc_backend.py |
Updates list-item detection, list/literal-block parsing flow, and caption recognition to preserve ordered lists and literal blocks. |
tests/test_backend_asciidoc.py |
Adds regression tests covering auto-numbered ordered lists and literal blocks plus following text retention. |
tests/data/asciidoc/groundtruth/asciidoc_03.asciidoc.md |
Updates golden output to reflect correct ordered-list and section ordering for the procedure fixture. |
tests/data/asciidoc/groundtruth/asciidoc_02.asciidoc.md |
Updates golden output for nested ordered lists to render as ordered items. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Signed-off-by: YushuoSun <yushuo.sun@student.unimelb.edu.au>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Merge Protections🟢 All 2 merge protections satisfied — ready to merge. Show 2 satisfied protections🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
🟢 Require two reviewer for test updatesWhen test data is updated, we require two reviewers
|
AsciiDocBackend treated a bare-dot ordered item such as ". Download" as a caption because the list matcher only accepted explicit markers such as "1.". That caption buffer was then reused by later blocks or left unflushed, which is why list items and following paragraphs disappeared or moved. The backend also had no delimiter state for four-dot literal blocks, so their contents fell into ordinary text buffering.
This change recognizes AsciiDoc auto-numbered markers (including nested dot markers), preserves ordered-list semantics, and keeps blank lines plus picture/literal
+continuation blocks with the current list item. Literal blocks now become code items, pending block captions are emitted before them, and caption detection no longer accepts a dot followed by whitespace.I regenerated the two affected AsciiDoc references. The existing procedure fixture now keeps all four numbered steps, their images, and the Procedure/Verification labels in source order.
Issue resolved by this Pull Request:
Resolves #4117
Validation:
uv run --no-sync pytest -q tests/test_backend_asciidoc.py— 10 passedChecklist: