diff options
author | Alan Pearce | 2024-06-25 09:14:56 +0200 |
---|---|---|
committer | Alan Pearce | 2024-06-25 09:14:56 +0200 |
commit | becede4bfead952239b9cf7c8eb9fb96d01534ec (patch) | |
tree | 20cf7d880487d89bc7d1d2e09912409e1a8f4489 /internal/builder/template.go | |
parent | 4f5ca39f582d83ded08a6e1cbf1a195141623b1c (diff) | |
download | website-becede4bfead952239b9cf7c8eb9fb96d01534ec.tar.lz website-becede4bfead952239b9cf7c8eb9fb96d01534ec.tar.zst website-becede4bfead952239b9cf7c8eb9fb96d01534ec.zip |
refactor/format
Diffstat (limited to 'internal/builder/template.go')
-rw-r--r-- | internal/builder/template.go | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/internal/builder/template.go b/internal/builder/template.go index 5ec963a..9d81582 100644 --- a/internal/builder/template.go +++ b/internal/builder/template.go @@ -10,14 +10,11 @@ import ( "website/internal/atom" "website/internal/config" "website/internal/content" - "website/internal/log" "github.com/PuerkitoBio/goquery" - "github.com/a-h/htmlformat" "github.com/antchfx/xmlquery" "github.com/antchfx/xpath" "github.com/pkg/errors" - "golang.org/x/net/html" ) var ( @@ -84,6 +81,7 @@ func renderRobotsTXT(config config.Config) (io.Reader, error) { } w.Close() }() + return r, nil } @@ -209,27 +207,6 @@ func getHTMLStyleHash(filenames ...string) (string, error) { return "", err } html := doc.Find("head > style").Text() - return hash(html), nil -} - -func renderHTML(doc *goquery.Document) io.Reader { - r, w := io.Pipe() - - go func() { - _, err := w.Write([]byte("<!doctype html>\n")) - if err != nil { - log.Error("error writing doctype", "error", err) - w.CloseWithError(err) - } - err = htmlformat.Nodes(w, []*html.Node{doc.Children().Get(0)}) - if err != nil { - log.Error("error rendering html", "error", err) - w.CloseWithError(err) - return - } - defer w.Close() - }() - - return r + return hash(html), nil } |