Compare commits
2 Commits
d9ec4d11dc
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5cdf386f52 | ||
|
|
0fbdcd276a |
@@ -4,7 +4,7 @@ P.3.4 reference test-module — validates `lib-management.launcher` FSM contract
|
|||||||
and engine-surface existence via the `engine.test.*` assertion surface.
|
and engine-surface existence via the `engine.test.*` assertion surface.
|
||||||
|
|
||||||
- Module-ID: `lib-management.launcher-test`
|
- Module-ID: `lib-management.launcher-test`
|
||||||
- Version: `0.1.0`
|
- Version: `0.3.0`
|
||||||
- Kind: `test-module` (headless; runs init() once + exits)
|
- Kind: `test-module` (headless; runs init() once + exits)
|
||||||
- Note: Embeds its own byte-identical copy of `fsm.lua` (Sporel-resolver does
|
- Note: Embeds its own byte-identical copy of `fsm.lua` (Sporel-resolver does
|
||||||
not resolve module-as-dep; drift guarded by smoke.sh P0-S15-pre hash check).
|
not resolve module-as-dep; drift guarded by smoke.sh P0-S15-pre hash check).
|
||||||
@@ -46,4 +46,4 @@ copy; mutations reverted after observation.
|
|||||||
|
|
||||||
### Tested Production-Lib Surface
|
### Tested Production-Lib Surface
|
||||||
|
|
||||||
`lib-management.launcher` v0.1.0 (FSM component) — Tests cover: all 5 explicit FSM transitions (`list+esc`, `quit_confirm+esc`, `quit_confirm+enter`, `quit_confirm+click_yes`, `quit_confirm+click_no`), stability for unhandled events (`list+click_module`), unknown-state passthrough, and engine-surface existence for `engine.module.list`, `engine.module.dir_of`, `engine.render.draw_text`, `engine.render.measure_text`.
|
`lib-management.launcher` v0.3.3 (FSM component, unchanged since v0.1.0 — 3-way hash check guards drift) — Tests cover: all 5 explicit FSM transitions (`list+esc`, `quit_confirm+esc`, `quit_confirm+enter`, `quit_confirm+click_yes`, `quit_confirm+click_no`), stability for unhandled events (`list+click_module`), unknown-state passthrough, and engine-surface existence for `engine.module.list`, `engine.module.dir_of`, `engine.render.draw_text`, `engine.render.measure_text`.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "lib-management.launcher-test",
|
"id": "lib-management.launcher-test",
|
||||||
"role": "test",
|
"role": "test",
|
||||||
"version": "0.2.0",
|
"version": "0.3.0",
|
||||||
"api_min": "0.1",
|
"api_min": "0.1",
|
||||||
"deps": []
|
"deps": []
|
||||||
}
|
}
|
||||||
|
|||||||
10
markdown.lua
10
markdown.lua
@@ -176,7 +176,11 @@ local function render_spans(spans, x, y, max_w, size)
|
|||||||
return cur_y + line_h
|
return cur_y + line_h
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.render(blocks, x, y, max_w, module_id_for_imgs)
|
-- `t` (optional, 6th arg) is the launcher's ctx.t string-lookup function.
|
||||||
|
-- When present, M.render uses it to localize the image-missing placeholder
|
||||||
|
-- via the `image_missing_fmt` key. Callers that don't have a t (e.g. tests)
|
||||||
|
-- may pass nil; the hardcoded English fallback then renders verbatim.
|
||||||
|
function M.render(blocks, x, y, max_w, module_id_for_imgs, t)
|
||||||
local cur_y = y
|
local cur_y = y
|
||||||
for _, b in ipairs(blocks) do
|
for _, b in ipairs(blocks) do
|
||||||
if b.type == "h1" then
|
if b.type == "h1" then
|
||||||
@@ -216,7 +220,9 @@ function M.render(blocks, x, y, max_w, module_id_for_imgs)
|
|||||||
-- assume a 16:9 max_w-wide image for layout.
|
-- assume a 16:9 max_w-wide image for layout.
|
||||||
cur_y = cur_y + math.floor(max_w * 9 / 16) + PARA_GAP
|
cur_y = cur_y + math.floor(max_w * 9 / 16) + PARA_GAP
|
||||||
else
|
else
|
||||||
engine.render.draw_text("[image missing: " .. b.src .. "]",
|
local missing_text = t and t("image_missing_fmt", b.src)
|
||||||
|
or ("[image missing: " .. b.src .. "]")
|
||||||
|
engine.render.draw_text(missing_text,
|
||||||
x, cur_y, BODY_SIZE, COLOR_DIM)
|
x, cur_y, BODY_SIZE, COLOR_DIM)
|
||||||
local _, h = engine.render.measure_text("[image]", BODY_SIZE)
|
local _, h = engine.render.measure_text("[image]", BODY_SIZE)
|
||||||
cur_y = cur_y + h + PARA_GAP
|
cur_y = cur_y + h + PARA_GAP
|
||||||
|
|||||||
Reference in New Issue
Block a user