- lexer: backtick raw text literal — content verbatim, no escape
processing, common source margin removed at lex time; `${ }` raw and
`{{ }}` auto-escaping holes
- `{{ e }}` desugars to `esc(${e})` in parser.ml — a Call on the `esc`
in scope, so types/owner/emit/.wob/VM are untouched
- WO-E004 unterminated raw literal; WO-E005 newline inside "..." —
closes a hole where a missing quote silently ate the rest of the file
- wo-html: `Component` interface, `render_all`, `Layout`, README
- framework: `ok_html` joins ok_text/ok_json in http/types.wo
- site + shop restructured to one-feature-one-module MVC (view +
controller per directory, model at the root, bootstrap-only main)
- removed the filler `pad: Int` convention — verified unnecessary for
plain classes, interface dispatch, containers and actors
- corrected recorded claims: gap #1 blocks neither the build nor the
layout; a class crosses module lines, only a free fn is scoped
- docs/guides/language-surface.md — the full grammar inventory
- story 37 landed and moved to done/
Gates: oop-accept MET, oop-e2e 116/0, woc-test 556/0, site 11/0,
web-app 46/0, fibers 10/0, db-actor 8/0
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
35 lines
950 B
Text
35 lines
950 B
Text
-- iteration 37: the backtick raw text literal. Markup is written as
|
|
-- markup -- one literal, real newlines, quotes verbatim -- and the
|
|
-- source indentation is removed at compile time, so the served bytes
|
|
-- carry the markup's own nesting and not the method's.
|
|
-- `${...}` interpolates raw; `{{ ... }}` HTML-escapes through the `esc`
|
|
-- in scope (here a local one, which is exactly how a program overrides
|
|
-- wo-html's).
|
|
fn esc(t: Text) -> Text {
|
|
let out = "";
|
|
let i = 0;
|
|
let n = len(t);
|
|
while i < n {
|
|
let b = byte_at(t, i);
|
|
if b == 60 { out = out .. "<"; }
|
|
else {
|
|
if b == 62 { out = out .. ">"; }
|
|
else { out = out .. substr(t, i, 1); }
|
|
}
|
|
i = i + 1;
|
|
}
|
|
return out;
|
|
}
|
|
|
|
fn main() -> Int {
|
|
let name = "<script>";
|
|
let card = `
|
|
<div class="card">
|
|
<h3>{{ name }}</h3>
|
|
<p>${name}</p>
|
|
</div>`;
|
|
print(card);
|
|
let plain = `no newline, no margin rule`;
|
|
print(plain);
|
|
return 0;
|
|
}
|