gopp/mod/pre.tengo

35 lines
493 B
Text

fmt := import("fmt")
paths := import("paths")
htmExt := func(c){
if c.is_compo {
return
}
fmt.println("shit")
c.pp.print(`
<!doctype html>
<html><head>
<script src="https://unpkg.com/htmx.org@1.9.2"></script>
`)
if c.title {
c.pp.printf(`<title>%s</title>`, c.title)
}
c.pp.print(`
</head><body>
`)
}
exts := {
".htm": htmExt,
".html": htmExt
}
export func(c){
url_path := c.http.request.url.path
ext := paths.ext(url_path)
cl := exts[ext]
if cl {
cl(c)
}
}