blob: f4bfc5b8a27d1e8bd7ee5624a21bd346c21db9d6 [file] [log] [blame]
// Copyright 2024 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"embed"
_ "embed"
"path"
"github.com/google/safehtml/template"
)
// Embed the templates and static files into the binary.
// We must use the FS form in order to make them trusted with the
// github.com/google/safehtml/template API.
//go:embed tmpl/*.tmpl
var tmplFS embed.FS
//go:embed static/*
var staticFS embed.FS
const (
actionLogTmplFile = "actionlog.tmpl"
searchPageTmplFile = "searchpage.tmpl"
)
func newTemplate(filename string, funcs template.FuncMap) *template.Template {
return template.Must(template.New(filename).Funcs(funcs).
ParseFS(template.TrustedFSFromEmbed(tmplFS), path.Join("tmpl", filename)))
}