Skip to content

fix(odt): ValidateTemplate no longer reports the markers of table-row and list-item blocks as unmatched (#138) - #216

Merged
vaceslav merged 1 commit into
mainfrom
fix/138-odt-validate-row-markers
Sep 26, 2026
Merged

vaceslav merged 1 commit into
mainfrom
fix/138-odt-validate-row-markers

Conversation

@vaceslav

Copy link
Copy Markdown
Contributor

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.SyntaxWalker collects 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.
  • Full core suite: 2078 tests on net10/net9/net8. The Release CI build and dotnet format pass.

Public API impact

None (bug fix in internal code; ValidateTemplate stops reporting false errors).

Refs #138

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@vaceslav
vaceslav merged commit 53c13dc into main Sep 26, 2026
12 checks passed
@vaceslav
vaceslav deleted the fix/138-odt-validate-row-markers branch September 26, 2026 13:46
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.

2 participants