Skip to content

fix(odt): report an unmatched row or list-item marker once in ValidateTemplate - #228

Merged
vaceslav merged 1 commit into
mainfrom
fix/odt-validation-duplicate-marker-errors
Sep 26, 2026
Merged

vaceslav merged 1 commit into
mainfrom
fix/odt-validation-duplicate-marker-errors

Conversation

@vaceslav

Copy link
Copy Markdown
Contributor

Found by the stricter OpenDocument validation tests (#138). An unmatched marker in a marker row or marker list item was reported twice by OdtTemplateProcessor.ValidateTemplate. The first report had the row or item wording, for example "Table row conditional start marker '{{#if A}}' has no matching '{{/if}}'.". The second came from inside the cell or item, for example "Conditional start marker '{{#if A}}' has no matching '{{/if}}'.". Processing fails with the first message only. The Word validator (with #227) also reports it once.

Changes

  • OdtTemplateValidator.SyntaxWalker reports each unmatched start marker once per error type. Outer levels are walked first, so the kept message is the row or list-item one, which is the one processing fails with. Errors without a quoted marker (for example {{#elseif}} after {{#else}}) are still deduplicated by message, as before.

Tests

  • OdtValidationTests.TableRowLoop_UnmatchedInsideCell_IsStillReported: exactly one UnmatchedConditionalStart error, with the table-row message.
  • OdtValidationTests.UnmatchedListItemMarkers_AreReportedOnce_WithTheMessageProcessingFailsWith: {{#if}} and {{#foreach}} list items, each reported once. The failure message of ProcessTemplate is one of them.
  • OdtValidationTests.SameUnmatchedMarker_InTwoParagraphs_IsReportedOnce.
  • Local runs: Release CI build (0 warnings); TriasDev.Templify.Tests net10/9/8 (2,139 each, LibreOffice round trips included); Tools.Tests 63; Converter.Tests 95; dotnet format --verify-no-changes.

Public API impact

None. Unreleased code (OpenDocument support, 1.9.0): ValidateTemplate no longer returns a duplicate error for the same unmatched marker.

…eTemplate

A marker that fails at row or list-item level was reported again from inside its cell or item with the cell-level wording (#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

❌ Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...sDev.Templify/OpenDocument/OdtTemplateValidator.cs 75.00% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@vaceslav
vaceslav merged commit 8932a55 into main Sep 26, 2026
12 checks passed
@vaceslav
vaceslav deleted the fix/odt-validation-duplicate-marker-errors branch September 26, 2026 16:47
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