2024-05-17 20:46:34 +03:00
|
|
|
fmt := import("fmt")
|
|
|
|
paths := import("paths")
|
|
|
|
|
|
|
|
htmExt := func(c){
|
2024-05-22 13:16:07 +03:00
|
|
|
if c.is_compo {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
fmt.println("shit")
|
2024-05-17 20:46:34 +03:00
|
|
|
c.pp.print(`
|
|
|
|
<!doctype html>
|
|
|
|
<html><head>
|
2024-05-22 13:16:07 +03:00
|
|
|
<script src="https://unpkg.com/htmx.org@1.9.2"></script>
|
2024-05-17 23:55:02 +03:00
|
|
|
`)
|
2024-05-20 20:34:11 +03:00
|
|
|
if c.title {
|
2024-05-17 23:55:02 +03:00
|
|
|
c.pp.printf(`<title>%s</title>`, c.title)
|
|
|
|
}
|
|
|
|
c.pp.print(`
|
2024-05-17 20:46:34 +03:00
|
|
|
</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]
|
2024-05-22 13:16:07 +03:00
|
|
|
if cl {
|
2024-05-17 20:46:34 +03:00
|
|
|
cl(c)
|
|
|
|
}
|
|
|
|
}
|