kyra/mod/pre.xgo
2024-08-02 20:30:32 +05:00

36 lines
506 B
Text

paths := import("paths")
html := import("html").Renderer()
htmExt := func(c){
if c.is_compo {
return
}
c.pp.print(`<!doctype html><html>`)
c.pp.print(html.head().body(
func(){
if c.title {
return html.title().body(c.title)
}
}(),
html.script({
src: `https://unpkg.com/htmx.org@1.9.2`
})
))
c.pp.print(`<body>`)
c.pp.print(html.div().body(c.global.val))
}
exts := {
".htm": htmExt,
".html": htmExt
}
export func(c){
ext := c.fext
cl := exts[ext]
if cl {
cl(c)
}
}