fix(html): emit lengths the core parser can read - #253
Closed
LeadcodeDev wants to merge 1 commit into
Closed
LeadcodeDev wants to merge 1 commit into
LeadcodeDev wants to merge 1 commit into
Conversation
53 tasks
LeadcodeDev
force-pushed
the
fix/html-unknown-attributes
branch
from
September 22, 2026 06:11
cf25e25 to
122c9ec
Compare
LeadcodeDev
force-pushed
the
fix/html-shorthand-lengths
branch
from
September 22, 2026 06:11
342377a to
c0d2efd
Compare
LeadcodeDev
force-pushed
the
fix/html-unknown-attributes
branch
from
September 22, 2026 08:35
122c9ec to
838dc53
Compare
LeadcodeDev
force-pushed
the
fix/html-shorthand-lengths
branch
from
September 22, 2026 08:35
c0d2efd to
f36abbf
Compare
LeadcodeDev
force-pushed
the
fix/html-unknown-attributes
branch
from
September 22, 2026 08:45
838dc53 to
6b6c8d9
Compare
Two parsers for the same syntax have drifted. Executed: style="padding: 24px 48px; margin: 0 auto; grid-template-columns: repeat(3, 1fr)" transpiles to "padding":"24px 48px", "margin":"0 auto", "grid-template- columns":["repeat(3,","1fr)"]. All three deserialize successfully — Edges::Uniform(LengthPercentage::String) and GridTrack::Length(LengthPercentage::String) are untagged string variants — and then core's parse_length (rustmotion-core/src/css/units.rs:125) only understands a single number+unit token, so parse_length_or_warn (units.rs:262) falls back to Px(0.0): zero padding, zero margin, two zero- width grid tracks. The only signal is an eprintln! warning; validate exits 0 and the render is wrong. Per-side padding is entirely unexpressible from HTML (padding-top:32 is rejected by CssStyle's deny_unknown_fields, padding:32px 48px silently becomes 0), and the skill rule html-css-mental- model.md:97 only documents the JSON object form, which inline style="" cannot produce. Fix: Teach parse_inline_style the standard 1/2/3/4-value box shorthands for padding/margin/border-radius, emitting the Edges/BorderRadius object the core expects, and teach the grid branch repeat()/minmax(); for anything still multi-token, return a named HtmlError rather than an opaque string. Long term, expose the core's parse_length from rustmotion-core and call it here so one grammar governs both front-ends. Refs #220
LeadcodeDev
force-pushed
the
fix/html-shorthand-lengths
branch
from
September 22, 2026 08:45
f36abbf to
895d8e3
Compare
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.
Severity Medium, category coherence. Location:
crates/rustmotion-html/src/style.rs:46Impact
Two parsers for the same syntax have drifted. Executed:
style="padding: 24px 48px; margin: 0 auto; grid-template-columns: repeat(3, 1fr)"transpiles to"padding":"24px 48px","margin":"0 auto","grid-template-columns":["repeat(3,","1fr)"]. All three deserialize successfully —Edges::Uniform(LengthPercentage::String)andGridTrack::Length(LengthPercentage::String)are untagged string variants — and then core'sparse_length(rustmotion-core/src/css/units.rs:125) only understands a single number+unit token, soparse_length_or_warn(units.rs:262) falls back toPx(0.0): zero padding, zero margin, two zero-width grid tracks. The only signal is aneprintln!warning;validateexits 0 and the render is wrong. Per-side padding is entirely unexpressible from HTML (padding-top:32is rejected byCssStyle'sdeny_unknown_fields,padding:32px 48pxsilently becomes 0), and the skill rule html-css-mental-model.md:97 only documents the JSON object form, which inlinestyle=""cannot produce.Fix
Teach
parse_inline_stylethe standard 1/2/3/4-value box shorthands forpadding/margin/border-radius, emitting theEdges/BorderRadiusobject the core expects, and teach the grid branchrepeat()/minmax(); for anything still multi-token, return a namedHtmlErrorrather than an opaque string. Long term, expose the core'sparse_lengthfrom rustmotion-core and call it here so one grammar governs both front-ends.Evidence the audit read
Part of the September 2026 audit remediation chantier. Refs #220 (RM-04).