fix(parsers): reject unknown directive attributes and unparsed remainder (THQ-357) - #535
Merged
Merged
Conversation
…t views - Normalize line endings in --check comparison so CRLF checkouts report clean - Plugin description now mentions the three document views (MRD, SRS, SDD) that onboard offers alongside diagram and report views - Fix overbroad README claim: "this package" has zero dependencies, not "every package in this repository" (document-view-engine and plugin-examples have dependencies) - Regenerate portable transitrix/plugin.json to match updated source Closes transitrix-hq#358 Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> Signed-off-by: transitrix <automation@transitrix.com>
Both document-renderer and document-view-engine now reject unknown \`view\` and \`figure\` directive attributes, matching DIRECTIVE_LANGUAGE §7 which specifies unknown syntax is an error (TTRS-002 / error message). Changes: - parseAttrs() returns both parsed attributes and unparsed remainder - parseView/parseFigure allowlist known attributes (fit, as, caption) - Unknown attributes or leftover text after valid pairs are errors - Tests cover: unknown attributes, unparsed remainder, existing attributes Matches spec: unparsed remainder and unknown keys are failures, distinct from recognised-but-unimplemented constructs (TTRS-004). Closes transitrix-hq#357 Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> Signed-off-by: transitrix <automation@transitrix.com>
2 tasks
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
Fixes task THQ-357 — both document parsers now reject unknown directive attributes and unparsed text.
Matches DIRECTIVE_LANGUAGE §7: unknown or malformed syntax is TTRS-002 (or message in view-engine), distinct from recognised-but-unimplemented (TTRS-004).
Changes to both packages (
document-rendereranddocument-view-engine):viewandfiguredirectives allowlist their known attributesbogus = x) are errorsleftover text) are errorsfit,asfor view;caption,asfor figureTest plan
viewwith unknown attribute fails parserfigurewith unknown attribute fails parser