Skip to content

fix(odf): extract generated table of contents and index containers - #4882

Closed
taran-dev4u wants to merge 1 commit into
docling-project:mainfrom
taran-dev4u:fix/odt-table-of-contents
Closed

taran-dev4u wants to merge 1 commit into
docling-project:mainfrom
taran-dev4u:fix/odt-table-of-contents

Conversation

@taran-dev4u

Copy link
Copy Markdown
Contributor

ODT table-of-content containers (text:table-of-content and related index elements) were matching the unhandled element branch in _add_odf_child(), dropping the index title and entry paragraphs from the converted document.

This change visits text:index-body children for table-of-content and other index containers, routing entries to ContentLayer.BODY in source order (or ContentLayer.INVISIBLE when text:display="none" is set).

Issue resolved by this Pull Request:
Resolves #4749

Checklist:

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

Review evidence:

  • Before: with an ODT containing a generated table of contents, the index title and all entry paragraphs were dropped, exporting only surrounding body paragraphs.
  • After: index title and entries are extracted in reading order as text items in ContentLayer.BODY.
  • Tests: added unit tests in tests/test_backend_opendocument.py covering table-of-contents extraction, hidden TOCs, and illustration/table index containers. All 64 tests in test_backend_opendocument.py pass.
  • Checks: ruff check and ruff format --check pass on changed files.

Signed-off-by: Taran Mamidala <mamidalataran6333@gmail.com>
@github-actions

Copy link
Copy Markdown
Contributor

✅ DCO Check Passed

Thanks @taran-dev4u, all your commits are properly signed off. 🎉

@mergify

mergify Bot commented Oct 18, 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)(?:\(.+\))?(!)?:

@taran-dev4u

Copy link
Copy Markdown
Contributor Author

Closing in favor of #4750 by @ryanmeowy.

@taran-dev4u
taran-dev4u deleted the fix/odt-table-of-contents branch October 18, 2026 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ODT: a generated table of contents is dropped

1 participant