HACK: render TOC the old way, backup and truncate output
Vytautas Ĺ altenis vytas@rtfb.lt
Mon, 09 Nov 2015 21:28:23 +0200
1 files changed,
3 insertions(+),
3 deletions(-)
jump to
M
html.go
→
html.go
@@ -794,7 +794,7 @@ }
r.w.WriteString("</head>\n") r.w.WriteString("<body>\n") - r.tocMarker = out.Len() + r.tocMarker = r.w.output.Len() // XXX } func (r *Html) DocumentFooter() {@@ -806,10 +806,10 @@ // now we have to insert the table of contents into the document
var temp bytes.Buffer // start by making a copy of everything after the document header - temp.Write(out.Bytes()[r.tocMarker:]) + temp.Write(r.w.output.Bytes()[r.tocMarker:]) // now clear the copied material from the main output buffer - out.Truncate(r.tocMarker) + r.w.output.Truncate(r.tocMarker) // corner case spacing issue if r.flags&CompletePage != 0 {