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)
|
||||
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 wn, hn = engine.render.measure_text(NO_LABEL, FONT_BUTTON)
|
||||
local qbtn_w = math.max(wy, wn) + 2 * PAD_X
|
||||
|
||||
Reference in New Issue
Block a user