feat(launcher): render news.md in detail panel for news entry
Static 'coming soon' stub authored as Markdown with JSON-frontmatter title. Loaded once on init, parsed via the same fm + md helpers as modules. Live news (Gitea-API or RSS) deferred — single-source-of- truth in the launcher repo keeps update-pace under our control.
This commit is contained in:
19
init.lua
19
init.lua
@@ -268,6 +268,25 @@ function init(ctx)
|
|||||||
ctx_panels.carousel_state[entry.id] = carousel.new_state(entry.id, paths, interval)
|
ctx_panels.carousel_state[entry.id] = carousel.new_state(entry.id, paths, interval)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- L.6: load + parse news.md once. The detail-panel's news branch
|
||||||
|
-- reads ctx.news_body_blocks; nil-safe so a missing file still
|
||||||
|
-- shows the "News" entry with an empty body.
|
||||||
|
do
|
||||||
|
local news_path = MODULE_DIR .. "/news.md"
|
||||||
|
local f = io.open(news_path, "rb")
|
||||||
|
if f then
|
||||||
|
local content = f:read("*a")
|
||||||
|
f:close()
|
||||||
|
local fm = dofile(MODULE_DIR .. "/frontmatter.lua")
|
||||||
|
local md = dofile(MODULE_DIR .. "/markdown.lua")
|
||||||
|
local meta, body = fm.parse(content)
|
||||||
|
if meta then
|
||||||
|
ctx_panels.news_entry.title = meta.title or "News"
|
||||||
|
ctx_panels.news_body_blocks = md.parse(body)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local wy, hy = engine.render.measure_text(YES_LABEL, FONT_BUTTON)
|
local wy, hy = engine.render.measure_text(YES_LABEL, FONT_BUTTON)
|
||||||
local wn, hn = engine.render.measure_text(NO_LABEL, FONT_BUTTON)
|
local wn, hn = engine.render.measure_text(NO_LABEL, FONT_BUTTON)
|
||||||
local qbtn_w = math.max(wy, wn) + 2 * PAD_X
|
local qbtn_w = math.max(wy, wn) + 2 * PAD_X
|
||||||
|
|||||||
22
news.md
Normal file
22
news.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
---
|
||||||
|
{"title":"News","published":"2026-06-11"}
|
||||||
|
---
|
||||||
|
|
||||||
|
# Sporel News
|
||||||
|
|
||||||
|
## Coming soon
|
||||||
|
|
||||||
|
Live news will eventually appear here — release notes, mod-of-the-week,
|
||||||
|
known-issue advisories. For now this is a static stub.
|
||||||
|
|
||||||
|
## What works today
|
||||||
|
|
||||||
|
- Master-detail launcher with per-module description + dep-status
|
||||||
|
- Hero carousel with auto-rotate
|
||||||
|
- Dep-conflict ambient-tint + launch-modal
|
||||||
|
|
||||||
|
## What we are working on next
|
||||||
|
|
||||||
|
- Live news source (Gitea-API or RSS-feed)
|
||||||
|
- Module-categories filter (Game / Tool / Test)
|
||||||
|
- Last-played persistence
|
||||||
Reference in New Issue
Block a user