From c06b338683a7a14ed2e9db22c5b5dae9c5fa5db6 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sat, 21 May 2022 14:01:15 +0200 Subject: pkg/html: move some functions to sub-package Move functions that need embed assets to a separate package. In preparation for the next change. --- pkg/html/html.go | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'pkg/html/html.go') 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 = `` - return fmt.Sprintf(headTempl, style, js) -} - var Funcs = template.FuncMap{ "link": link, "optlink": optlink, -- cgit mrf-deployment