diff options
Diffstat (limited to 'cnhttp.go')
-rw-r--r-- | cnhttp.go | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -318,7 +318,7 @@ func genToc(b cnm.Block) []tocSection { res = append(res, genToc(bl)...) } } - } else if v, ok := b.(cnm.ContainerBlock); ok && v != nil { + } else if v, ok := b.(cnm.ContainerBlock); ok { for _, bl := range v.Children() { res = append(res, genToc(bl)...) } @@ -418,6 +418,10 @@ func (srv *server) cnpCNMToHTML(w http.ResponseWriter, r *http.Request, req *cnp return } + var toc []tocSection + if doc.Content != nil { + toc = genToc(doc.Content) + } err = srv.addTemplateFuncs(tmpl, req, resp).ExecuteTemplate(&buf, "page.html", cnmPage{ URL: u.String(), Req: breq.String(), @@ -425,7 +429,7 @@ func (srv *server) cnpCNMToHTML(w http.ResponseWriter, r *http.Request, req *cnp Doc: doc, Netcat: shellquote.Join("echo", hdrs) + " | " + shellquote.Join("nc", host, port), Site: st, - Toc: tocSection{Children: genToc(doc.Content)}, + Toc: tocSection{Children: toc}, Highlight: srv.highlighting, Browser: srv.host == "", }) |