diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2022-05-21 14:01:15 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2022-05-23 11:53:38 +0200 |
| commit | c06b338683a7a14ed2e9db22c5b5dae9c5fa5db6 (patch) | |
| tree | 07cbbc6514c415bde43917ef6f46c9d78f501efd /pkg/html/html.go | |
| parent | 4c7657cb23023fd64d0585c979e6fec4ef441f04 (diff) | |
pkg/html: move some functions to sub-package
Move functions that need embed assets to a separate package.
In preparation for the next change.
Diffstat (limited to 'pkg/html/html.go')
| -rw-r--r-- | pkg/html/html.go | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/pkg/html/html.go b/pkg/html/html.go index 991f7b37a..d9e4e5881 100644 --- a/pkg/html/html.go +++ b/pkg/html/html.go @@ -1,14 +1,11 @@ // Copyright 2018 syzkaller project authors. All rights reserved. // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. -//go:generate ./gen.sh - package html import ( "fmt" "html/template" - "io/fs" "reflect" "strings" texttemplate "text/template" @@ -17,29 +14,14 @@ import ( "github.com/google/syzkaller/dashboard/dashapi" ) -func CreatePage(page string) *template.Template { - page = strings.Replace(page, "{{HEAD}}", getHeadTemplate(), 1) - return template.Must(template.New("").Funcs(Funcs).Parse(page)) -} - func CreateGlob(glob string) *template.Template { return template.Must(template.New("").Funcs(Funcs).ParseGlob(glob)) } -func CreateFromFS(fs fs.FS, patterns ...string) *template.Template { - t := template.Must(template.New("syz-head").Funcs(Funcs).Parse(getHeadTemplate())) - return template.Must(t.New("").Funcs(Funcs).ParseFS(fs, patterns...)) -} - func CreateTextGlob(glob string) *texttemplate.Template { return texttemplate.Must(texttemplate.New("").Funcs(texttemplate.FuncMap(Funcs)).ParseGlob(glob)) } -func getHeadTemplate() string { - const headTempl = `<style type="text/css" media="screen">%v</style><script>%v</script>` - return fmt.Sprintf(headTempl, style, js) -} - var Funcs = template.FuncMap{ "link": link, "optlink": optlink, |
