Repository navigation
fix(latex): preserve description list item terms - #4579
Merged
PeterStaar-IBM merged 1 commit intoOct 6, 2026
Merged
PeterStaar-IBM merged 1 commit into
PeterStaar-IBM merged 1 commit into
Conversation
Contributor
|
✅ DCO Check Passed Thanks @taran-dev4u, all your commits are properly signed off. 🎉 |
Contributor
Merge Protections🟢 Merge protection satisfied — ready to merge. Show 1 satisfied protection🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
taran-dev4u
marked this pull request as ready for review
October 5, 2026 12:06
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
_process_list retains item nodes with optional arguments, but _process_macro_node_inline routed them through MACROS_STRUCTURAL to _process_macro where item was ignored, dropping terms like \item[Latency].
Extract the optional term in _process_item_macro_inline, prepend it to the item text buffer as '{term}: ', and preserve structural macro flushing on items without optional arguments. Add tests covering plain, formatted, and special symbol description terms.
Fixes docling-project#4516
Signed-off-by: Taran Mamidala <[email protected]>
taran-dev4u
force-pushed
the
fix/latex-description-list-terms
branch
from
October 5, 2026 14:28
df3f22f to
d247a12
Compare
Contributor
Author
|
Thanks for the review, @PeterStaar-IBM! |
geoHeil
approved these changes
Oct 6, 2026
3 tasks done
1 of 3 tasks
DanielNg0729
added a commit
that referenced
this pull request
Oct 8, 2026
* fix(latex): start a new text item at every \item pylatexenc gives a plain \item an argument list of [None]. The list is truthy, so since #4579 every \item takes the term branch, and the text buffer is no longer flushed at an item. A list environment that is not itemize, enumerate or description reaches this path as one node list. Its items then merge into one text item: compactitem with "Alpha" and "Beta" gives "Alpha\nBeta". Flush the text buffer at every \item, before the term is added. Signed-off-by: Daniel Nguyen <[email protected]> * fix(latex): drop an \item term that converts to empty text When the optional \item argument converts to empty text, the term fallback used the raw LaTeX source. Macros that give no text then leak into the export: \item[\textbullet] bullet macro gives "\textbullet: bullet macro", and \quad and \hspace{1em} behave the same way. Before #4579 these items gave "bullet macro". Read the term in one helper for the inline path and for _nodes_to_text, and drop a term that converts to empty text. The helper checks the pylatexenc LatexGroupNode type instead of probing with hasattr. Table cells use _nodes_to_text, so a list in a cell no longer gets the raw macro either. \item[--] now gives "Dash bullet" again, as before #4579. The backend drops the -- ligature from all text today; #4416 works on dashes. Signed-off-by: Daniel Nguyen <[email protected]> * refactor(latex): replace attribute probing with type checks AGENTS.md asks us to avoid hasattr(...) and getattr(...) probing. The LaTeX backend probed nodes and cells in 36 places. - An argument in argnlist has a node list only when it is a LatexGroupNode, so check that type. - Four tree walkers repeated the same probes for the node list and the group arguments of a node. iter_child_nodelists() now yields these lists, with isinstance checks against the pylatexenc classes that have them. - Every LatexNode has pos, and every LatexMathNode has displaytype, so read them directly. Check LatexSpecialsNode for the & cell separator. - _parse_table set private attributes on TableCell for the spans and the multicolumn placeholders, and read them back with getattr. Keep (cell, col_span, row_span) in the row instead, and None for a covered column. This also removes three type: ignore comments. The conversion output does not change. Signed-off-by: Daniel Nguyen <[email protected]> --------- Signed-off-by: Daniel Nguyen <[email protected]>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Issue resolved by this Pull Request:
Resolves #4516
Description list item terms (\item[Term]) were dropped during conversion because _process_macro_node_inline\ routed them through \MACROS_STRUCTURAL\ to _process_macro\ where \item\ was a no-op.
This extracts the optional term in _process_item_macro_inline, prepends it to the item text buffer as {term}: , and supports \LatexSpecialsNode\ in _nodes_to_text. Added unit tests in \ ests/test_latex/test_lists.py\ covering plain, formatted, and special symbol description terms.
Checklist: