all repos — grayfriday @ bd774a209a10d88da06adb3fa0fe87dc19902705

blackfriday fork with a few changes

More lint: smartypants.go
Vytautas Ĺ altenis vytas@rtfb.lt
Wed, 27 Jul 2016 21:45:25 +0300
commit

bd774a209a10d88da06adb3fa0fe87dc19902705

parent

6d7f5e1bcab8da61c61f85ae261fca17d3bdc5ed

1 files changed, 5 insertions(+), 2 deletions(-)

jump to
M smartypants.gosmartypants.go

@@ -19,6 +19,7 @@ import (

"bytes" ) +// SPRenderer is a struct containing state of a Smartypants renderer. type SPRenderer struct { inSingleQuote bool inDoubleQuote bool

@@ -366,6 +367,7 @@ }

type smartCallback func(out *bytes.Buffer, previousChar byte, text []byte) int +// NewSmartypantsRenderer constructs a Smartypants renderer object. func NewSmartypantsRenderer(flags Extensions) *SPRenderer { var r SPRenderer if flags&SmartypantsAngledQuotes == 0 {

@@ -398,13 +400,14 @@ r.callbacks['`'] = r.smartBacktick

return &r } -func (sr *SPRenderer) Process(text []byte) []byte { +// Process is the entry point of the Smartypants renderer. +func (smrt *SPRenderer) Process(text []byte) []byte { var buff bytes.Buffer // first do normal entity escaping text = esc(text) mark := 0 for i := 0; i < len(text); i++ { - if action := sr.callbacks[text[i]]; action != nil { + if action := smrt.callbacks[text[i]]; action != nil { if i > mark { buff.Write(text[mark:i]) }