refactor/format
1 file changed, 2 insertions(+), 25 deletions(-)
changed files
M internal/builder/template.go → internal/builder/template.go
@@ -10,14 +10,11 @@ "text/template" "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 @@ w.CloseWithError(err) } w.Close() }() + return r, nil }@@ -209,27 +207,6 @@ if err != nil { 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 }