more consistent error messages
parent
6e5ef58613
commit
3de81ba65c
|
@ -69,13 +69,13 @@ func Merge(base, doc io.Reader) (merged string, assets *Assets, _ error) {
|
|||
func merge(base, doc *html.Node) (out *html.Node) {
|
||||
out, err := html.Parse(strings.NewReader("<!doctype html><html><head></head><body></body></html>"))
|
||||
if err != nil {
|
||||
panic("mergehtml: internal error: " + err.Error())
|
||||
panic("merge: internal error: " + err.Error())
|
||||
}
|
||||
|
||||
// TODO: title
|
||||
html := find(out, atom.Html)
|
||||
if html == nil {
|
||||
log.Panicf("no <html> in %v", out)
|
||||
log.Panicf("merge: no <html> in %v", out)
|
||||
}
|
||||
head := find(html, atom.Head)
|
||||
reparentChildren(head, find(find(base, atom.Html), atom.Head))
|
||||
|
@ -83,12 +83,12 @@ func merge(base, doc *html.Node) (out *html.Node) {
|
|||
|
||||
body := find(html, atom.Body)
|
||||
if body == nil {
|
||||
log.Panicf("no <body> in %v", html)
|
||||
log.Panicf("merge: no <body> in %v", html)
|
||||
}
|
||||
baseBody := find(find(base, atom.Html), atom.Body)
|
||||
newBody := find(find(doc, atom.Html), atom.Body)
|
||||
|
||||
reparentChildren(body, baseBody)
|
||||
|
||||
header := findRec(body, atom.Header)
|
||||
footer := findRec(body, atom.Footer)
|
||||
main := findRec(body, atom.Main)
|
||||
|
|
Loading…
Reference in New Issue