aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorr <r@freesoftwareextremist.com>2022-05-10 17:25:58 +0000
committerr <r@freesoftwareextremist.com>2022-05-10 17:25:58 +0000
commit4ad71587d821d8586d1fe648ad15f601a318662f (patch)
treeca60578c6711008f77d83d6f6e61c7c36b6497bf
parent471701f0294a4327dacc8d99bc1d8ec04ffc1392 (diff)
downloadbloat-4ad71587d821d8586d1fe648ad15f601a318662f.tar.gz
bloat-4ad71587d821d8586d1fe648ad15f601a318662f.zip
Fix custom CSS
-rw-r--r--renderer/renderer.go5
-rw-r--r--templates/header.tmpl2
2 files changed, 6 insertions, 1 deletions
diff --git a/renderer/renderer.go b/renderer/renderer.go
index f1595a5..c6b3189 100644
--- a/renderer/renderer.go
+++ b/renderer/renderer.go
@@ -129,6 +129,10 @@ func raw(s string) template.HTML {
return template.HTML(s)
}
+func rawCSS(s string) template.CSS {
+ return template.CSS(s)
+}
+
type Renderer interface {
Render(ctx *Context, writer io.Writer, page string, data interface{}) (err error)
}
@@ -150,6 +154,7 @@ func NewRenderer(templateGlobPattern string) (r *renderer, err error) {
"WithContext": withContext,
"HTML": template.HTMLEscapeString,
"Raw": raw,
+ "RawCSS": rawCSS,
}).ParseGlob(templateGlobPattern)
if err != nil {
return
diff --git a/templates/header.tmpl b/templates/header.tmpl
index 1abb6dd..8a1b0ca 100644
--- a/templates/header.tmpl
+++ b/templates/header.tmpl
@@ -26,7 +26,7 @@
<script src="/static/fluoride.js"></script>
{{end}}
{{if $.Ctx.UserCSS}}
- <style>{{$.Ctx.UserCSS}}</style>
+ <style>{{RawCSS $.Ctx.UserCSS}}</style>
{{end}}
</head>
<body {{if $.Ctx.DarkMode}}class="dark"{{end}}>