1
0
mirror of https://github.com/danog/blackfriday.git synced 2025-01-23 05:41:27 +01:00

HACK: render TOC the old way, backup and truncate output

This commit is contained in:
Vytautas Šaltenis 2015-11-09 21:28:23 +02:00
parent 97235182ac
commit d1b544e278

View File

@ -794,7 +794,7 @@ func (r *Html) DocumentHeader() {
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 @@ func (r *Html) DocumentFooter() {
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 {