Repository navigation
fix: add JATS and AsciiDoc captions under the parent of their item #5039
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ska2704
wants to merge
1
commit into
docling-project:main
Choose a base branch
from
ska2704:fix/jats-asciidoc-caption-parent
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,150
−1,082
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small edge case in
_add_table: the caption is created before thedata is not Nonecheck.parse_table_datareturns None when the table contains a nested table, so in that case the caption gets added without its table. Before this change that lone caption ended up at the end ofbody, but now it sits inside the section with nothing next to it. Maybe move thedoc.add_textcall inside theif data is not None:block so the caption is only added together with the table? A JATStable-wrapwhosetablecontains anothertablewould make a quick test for it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right that the caption is created before the
data is not Nonecheck. That order is the same as onmain, and I think it's the better one to keep. Whenparse_table_datareturns None the table is skipped, and the caption is the only text left from thattable-wrap. Movingadd_textinto theifwould drop it from the output entirely, Markdown included, wheremainstill prints it (as the last line of the document).For a
table-wrapwhosetablecontains anothertable, the tree on this branch is:On
mainthe same caption is the last child ofbody, after section "Two". So the lone caption now sits where the table was instead of at the end. Real support for nested tables is the TODO inparse_table_data, and I'd rather keep that out of this PR. If the maintainers prefer to drop the caption when the table is skipped, that's a small change and I can add a test for it.