1
0
mirror of https://github.com/danog/blackfriday.git synced 2024-11-26 20:14:43 +01:00

Enable writing plain text straight to output

It's only used in a single place and should probably be refactored away,
but this workaround is OK for now.
This commit is contained in:
Vytautas Šaltenis 2015-11-09 21:14:32 +02:00
parent 114d6b0d68
commit 97235182ac
4 changed files with 10 additions and 1 deletions

View File

@ -187,6 +187,10 @@ func (r *Html) CopyWrites(processor func()) []byte {
return output.Bytes()
}
func (r *Html) Write(b []byte) (int, error) {
return r.w.Write(b)
}
func (r *Html) GetResult() []byte {
return r.w.output.Bytes()
}

View File

@ -748,7 +748,7 @@ func autoLink(p *parser, data []byte, offset int) int {
anchorStr := anchorRe.Find(data[anchorStart:])
if anchorStr != nil {
out.Write(anchorStr[offsetFromAnchor:]) // XXX: write in parser?
p.r.Write(anchorStr[offsetFromAnchor:]) // XXX: write in parser?
return len(anchorStr) - offsetFromAnchor
}

View File

@ -60,6 +60,10 @@ func (r *Latex) CopyWrites(processor func()) []byte {
return output.Bytes()
}
func (r *Latex) Write(b []byte) (int, error) {
return r.w.Write(b)
}
func (r *Latex) GetResult() []byte {
return r.w.output.Bytes()
}

View File

@ -204,6 +204,7 @@ type Renderer interface {
GetFlags() HtmlFlags
CaptureWrites(processor func()) []byte
CopyWrites(processor func()) []byte
Write(b []byte) (int, error)
GetResult() []byte
}