- 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>
54 lines
1.2 KiB
Text
54 lines
1.2 KiB
Text
-- orders/view.wo — the confirmation page and the orders table.
|
||
-- Raw text literals for the bodies; see product_list/view.wo for the
|
||
-- convention.
|
||
use html
|
||
|
||
pub class OrderOk {
|
||
name: Text
|
||
qty: Int
|
||
total: Float
|
||
|
||
fn render() -> Text {
|
||
return `
|
||
<div class="card">
|
||
<h1>Order placed</h1>
|
||
<p>${self.qty} × {{ self.name }} — total € ${self.total}</p>
|
||
<p><a href="/orders">See all orders</a> · <a href="/">Keep shopping</a></p>
|
||
</div>`;
|
||
}
|
||
}
|
||
|
||
pub class OrderRow {
|
||
name: Text
|
||
qty: Int
|
||
total: Float
|
||
status: Text
|
||
|
||
fn render() -> Text {
|
||
return `
|
||
<tr>
|
||
<td>{{ self.name }}</td>
|
||
<td>${self.qty}</td>
|
||
<td>€ ${self.total}</td>
|
||
<td>{{ self.status }}</td>
|
||
</tr>`;
|
||
}
|
||
}
|
||
|
||
pub class OrdersPage {
|
||
rows: multi Component
|
||
|
||
fn render() -> Text {
|
||
if len(self.rows) == 0 {
|
||
return `
|
||
<h1>Orders</h1>
|
||
<p>No orders yet — <a href="/">go buy something</a>.</p>`;
|
||
}
|
||
return `
|
||
<h1>Orders</h1>
|
||
<table class="orders">
|
||
<tr><th>Product</th><th>Qty</th><th>Total</th><th>Status</th></tr>
|
||
${render_all(self.rows)}
|
||
</table>`;
|
||
}
|
||
}
|