Repository navigation
fix(odt): ValidateTemplate no longer reports the markers of table-row and list-item blocks as unmatched (#138) - #216
Merged
Conversation
… and list-item blocks as unmatched (#138)
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This was referenced Sep 26, 2026
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.
Summary
OdtTemplateProcessor.ValidateTemplate(added in #214) reported false errors for valid templates with table-row or list-item loops and conditionals. Example:Loop start marker '{{#foreach Items}}' has no matching '{{/foreach}}'. Processing was not affected. I found this while writing the OpenDocument example for the docs.Cause: the validator found the row-level blocks correctly. It then walked into the cells of the marker rows (and into the marker list items). There, the paragraph holding the marker was detected again, as a lone paragraph-level marker. Processing removes the marker rows and items, so it never looks inside them.
Changes
OdtTemplateValidator.SyntaxWalkercollects the marker elements of the loops and conditionals it detected, including every branch marker, and does not descend into them. Unmatched markers inside regular cells and items are still reported.Tests
OdtValidationTests.TableRowAndListItemBlocks_AreValid: table-row loop and if/else, list-item loop with a named variable, and list-item conditional. They are valid with and without data, and no variables are missing. This test failed before the fix.OdtValidationTests.TableRowLoop_UnmatchedInsideCell_IsStillReported.dotnet formatpass.Public API impact
None (bug fix in internal code;
ValidateTemplatestops reporting false errors).Refs #138