You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(html): turn the dialect's silent losses into named errors
The HTML dialect degraded four classes of input without a word, and
`rustmotion validate` answered "Valid scenario" for all of them. An author
who writes a construct the transpiler cannot honour has to be told.
`<style>` content was transpiled into a `text` component and painted into
the video. It is now refused: `<style>` has a real, expected visual effect
that the dialect cannot deliver (there is no cascade engine), so dropping
it silently defeats a genuine intent. `<script>`, `<title>`, `<noscript>`,
`<template>` and `<head>` are skipped instead — no browser paints them, so
ignoring them defeats nothing and merely stops their text leaking onto the
canvas.
A `<scene>` nested inside any container disappeared from the scenario. It
is now refused, naming the offending parent, and the search is recursive:
that also catches the case an unclosed `<p>` creates, where HTML5 error
recovery hoists the `<h1>` out of the scene and leaves an empty one behind.
Recursing silently would have hidden exactly that corruption.
`<img>`, `<video>` and `<svg>` became empty `div`s. They are now refused
with the equivalent `rm-*` element named in the message.
No `bool` schema field was reachable: `coerce_value` left `"false"` a
string, so `auto_scroll`, `diff`, `loop`, `show_grid` and friends could not
be expressed at all. It now matches `coerce_dsl_value`, and a bare HTML
boolean attribute resolves to `true`.
Copy file name to clipboardExpand all lines: crates/rustmotion-html/src/lib.rs
+43Lines changed: 43 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -69,6 +69,34 @@ pub enum HtmlError {
69
69
/// Emitted when `<font>` sets both `path`/`src` and `source` — they are mutually exclusive.
70
70
#[error("<font family=\"{family}\">: 'path'/'src' and 'source' are mutually exclusive")]
71
71
FontPathAndSourceConflict{family:String},
72
+
/// Emitted for `<style>`. Unlike `<script>`/`<title>`/`<noscript>`/`<template>`
73
+
/// (silently skipped — they never visually render in real HTML either, so
74
+
/// skipping them matches an author's own expectation), `<style>` DOES have
75
+
/// real, expected visual effect in HTML. The dialect has no CSS
76
+
/// selector/cascade engine (only inline `style="..."` attributes), so a
77
+
/// `<style>` block's rules would never take effect — refused instead of
78
+
/// silently discarded, so the author's intent isn't dropped without a trace.
79
+
#[error(
80
+
"<style> blocks are not supported by the HTML dialect (no CSS selector/cascade engine) — move these declarations onto the target elements' style=\"...\" attribute"
81
+
)]
82
+
StyleElementUnsupported,
83
+
/// Emitted for a native HTML tag whose real payload (`src`, nested shape
84
+
/// markup, …) has no representation via the generic `Container`/`div`
85
+
/// fallback — that fallback would silently render an empty box. The
86
+
/// dialect's `rm-*` custom-element mechanism is the way to express these.
87
+
#[error(
88
+
"<{tag}> is not supported by the HTML dialect and would render as an empty container — use <{suggestion} ...> instead"
0 commit comments