Fixes data-latex content for Table Rows - #1528
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1528 +/- ##
===========================================
+ Coverage 86.93% 86.98% +0.05%
===========================================
Files 388 388
Lines 87571 87923 +352
Branches 3290 5028 +1738
===========================================
+ Hits 76129 76481 +352
+ Misses 11442 11421 -21
- Partials 0 21 +21 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
dpvc
left a comment
There was a problem hiding this comment.
This is a big improvement, but there still seem to be some issues. Those are probably actually problems with the attributes of the child nodes in many cases. Perhaps they can be improved? (I haven't looked into the problem, but it may be due to modifying the parser.string value for substitutions.)
|
Thanks for looking at these tests in more detail. I have to admit I mainly focussed on the expressions in |
ensure labels will get the right latex attribute
Summary (cleaned up and greatly enhanced by co-pilot)Fixes several cases where the Problems
Fixes
New
|
| Property | Set where | Purpose |
|---|---|---|
rawLatex |
ArrayItem.captureLatex(), and copied onto the mtable/wrapping mstyle node in setTableLatex() / EndTable() |
Caches the raw, unmodified LaTeX source of the array/table environment (\begin{name}...\end{name}), captured before column-template substitutions or nested-environment parsing can corrupt the parser's string. |
rawLatexName |
Alongside rawLatex everywhere it's set |
The environment name (array, matrix, etc.), needed to detect "broken" data-latex values and to rebuild \begin{name}...\end{name} wrappers. |
rawLatexStart |
captureLatex(), only when the matching \end{name} can't be found up front (e.g. \newenvironment-defined environments) |
Parser position right after \begin{name}, so the source can be sliced out later once the environment has actually finished parsing. |
rawLatexGen |
captureLatex(), alongside rawLatexStart |
Snapshot of the envSplice generation counter, used to detect whether the stashed rawLatexStart position has been invalidated before trusting it. |
How they fit together
- On
\begin{name},captureLatex()grabs the raw source immediately, or stashes a
start position + generation if the end isn't available yet. - On table close,
setTableLatex()usesrawLatexif captured, else recovers it
fromrawLatexStart/rawLatexGen(if the generation still matches), else
reconstructs it from the rows' owndata-latex. FilterUtil.fixArrayLatex(a new postprocessing filter in theTeX.tspipeline)
walks allmtablenodes and replacesdata-latexwith the cachedrawLatexonly
when the existing value looks broken/missing (FilterUtil.isBrokenArrayLatex).
|
PS: As discussed earlier, what is still missing:
The |
Rows in Tables did not get a meaningful
data-latexattribute. E.g., for\begin{array}{c}a\end{array}we gotdata-latex="{c}".This PR fixes this by explicitly collecting the LaTeX elements and then adding them to the final node, combined with
&.