fix(odt): report an unmatched row or list-item marker once in ValidateTemplate - #228
Merged
Merged
Conversation
…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 Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
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.SyntaxWalkerreports 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 oneUnmatchedConditionalStarterror, with the table-row message.OdtValidationTests.UnmatchedListItemMarkers_AreReportedOnce_WithTheMessageProcessingFailsWith:{{#if}}and{{#foreach}}list items, each reported once. The failure message ofProcessTemplateis one of them.OdtValidationTests.SameUnmatchedMarker_InTwoParagraphs_IsReportedOnce.TriasDev.Templify.Testsnet10/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):
ValidateTemplateno longer returns a duplicate error for the same unmatched marker.