Skip to content

fix(asciidoc): drop the closing marks of symmetric section titles - #4938

Merged
dolfim-ibm merged 1 commit into
docling-project:mainfrom
kevin9327:fix/asciidoc-symmetric-titles
Oct 25, 2026
Merged

dolfim-ibm merged 1 commit into
docling-project:mainfrom
kevin9327:fix/asciidoc-symmetric-titles

Conversation

@kevin9327

Copy link
Copy Markdown
Contributor

AsciiDoc lets a document or section title be closed by the same marks that open it, and Asciidoctor leaves those marks out of the title (its AtxSectionTitleRx is ^(=={0,5}|#\#{0,5})[ \t]+(.+?)(?:[ \t]+\1)?$). The AsciiDoc backend kept them in the heading text:

= Doc =
== Intro ==
before: title "Doc =", section_header "Intro =="
after:  title "Doc",   section_header "Intro"

The fix strips a trailing run of = only when it has exactly the length of the opening marker and is preceded by whitespace, as in Asciidoctor. So === Details == keeps its text Details ==. Titles without closing marks parse the same as before.

Checklist:

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

Review evidence:

  • tests/test_backend_asciidoc.py::test_symmetric_titles_drop_their_closing_marks fails on main and passes with the fix. It also checks that marks of a different length stay in the title.
  • All 54 tests in tests/test_backend_asciidoc.py pass, including test_asciidocs_examples, so the reference outputs are unchanged. I did not run the full suite.
  • ruff format --check and ruff check pass on the changed files.

AI assistance: I used an AI coding assistant (Grok Bot) to help find and write this fix. I reviewed the change and ran the tests above myself.

Signed-off-by: kevin9327 <5299031+kevin9327@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

✅ DCO Check Passed

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

@mergify

mergify Bot commented Oct 21, 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 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

AI triage (advisory)

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

The PR changes the AsciiDoc backend. It removes the closing = marks from symmetric titles such as == Intro ==. It adds a test for this.

Topic labels added: bug, asciidoc.

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

1 related pull request(s) in the same code
PR State Signal Assessment
#4878 open changes the same code related: Both PRs edit docling/backend/asciidoc_backend.py, but 4878 flushes pending paragraphs before lists and tables. This PR changes title text parsing.

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 de02936d89. It read the code and did not run it.

I found no defect. _strip_closing_marker in docling/backend/asciidoc_backend.py:891 removes a trailing run of = only when whitespace precedes it and its length equals the opening marker. === Details == and == Intro === keep their text, as the PR says. The new test covers a matched title, a matched section header, and a mismatched closing run.

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 21, 2026
@codecov

codecov Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@geoHeil geoHeil 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.

Reviewed de02936d89b2ee9a8b9ee41c4984fd512bb5f6c6. No code blocker found. The base/head case confirms that symmetric closing marks are removed and different-length marks stay in the title. Document ownership and heading order stay correct. All 54 AsciiDoc tests pass locally. Hosted CI, docs, and patch coverage are green.

Local make check stops on file-length violations that already exist on base. The other read-only checks pass. I made no source or reference-data changes.

@dolfim-ibm dolfim-ibm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@dolfim-ibm
dolfim-ibm merged commit 7b729c6 into docling-project:main Oct 25, 2026
33 checks passed
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.

3 participants