diff options
Diffstat (limited to 'transform')
-rw-r--r-- | transform/absurl.go | 4 | ||||
-rw-r--r-- | transform/absurlreplacer.go | 6 | ||||
-rw-r--r-- | transform/chain.go | 8 | ||||
-rw-r--r-- | transform/chain_test.go | 8 | ||||
-rw-r--r-- | transform/livereloadinject.go | 2 |
5 files changed, 14 insertions, 14 deletions
diff --git a/transform/absurl.go b/transform/absurl.go index fa1d99306..b4bd1dff4 100644 --- a/transform/absurl.go +++ b/transform/absurl.go @@ -17,7 +17,7 @@ func initAbsURLReplacer(baseURL string) { func AbsURL(absURL string) (trs []link, err error) { initAbsURLReplacer(absURL) - trs = append(trs, func(rw ContentReWriter) { + trs = append(trs, func(rw contentRewriter) { ar.replaceInHTML(rw) }) return @@ -26,7 +26,7 @@ func AbsURL(absURL string) (trs []link, err error) { func AbsURLInXML(absURL string) (trs []link, err error) { initAbsURLReplacer(absURL) - trs = append(trs, func(rw ContentReWriter) { + trs = append(trs, func(rw contentRewriter) { ar.replaceInXML(rw) }) return diff --git a/transform/absurlreplacer.go b/transform/absurlreplacer.go index 66fdaf689..1f3f77d9a 100644 --- a/transform/absurlreplacer.go +++ b/transform/absurlreplacer.go @@ -176,7 +176,7 @@ func (l *contentlexer) replace() { } } -func doReplace(rw ContentReWriter, matchers []absURLMatcher) { +func doReplace(rw contentRewriter, matchers []absURLMatcher) { lexer := &contentlexer{ content: rw.Content(), @@ -226,10 +226,10 @@ func newAbsURLReplacer(baseURL string) *absURLReplacer { } -func (au *absURLReplacer) replaceInHTML(rw ContentReWriter) { +func (au *absURLReplacer) replaceInHTML(rw contentRewriter) { doReplace(rw, au.htmlMatchers) } -func (au *absURLReplacer) replaceInXML(rw ContentReWriter) { +func (au *absURLReplacer) replaceInXML(rw contentRewriter) { doReplace(rw, au.xmlMatchers) } diff --git a/transform/chain.go b/transform/chain.go index 0edcb6971..a42660245 100644 --- a/transform/chain.go +++ b/transform/chain.go @@ -6,7 +6,7 @@ import ( "io" ) -type trans func(rw ContentReWriter) +type trans func(rw contentRewriter) type link trans @@ -20,14 +20,14 @@ func NewEmptyTransforms() []link { return make([]link, 0, 20) } -// ContentReWriter is an interface that enables rotation +// contentRewriter is an interface that enables rotation // of pooled buffers in the transformer chain. -type ContentReWriter interface { +type contentRewriter interface { Content() []byte io.Writer } -// Implements ContentReWriter +// Implements contentRewriter // Content is read from the from-buffer, // and rewritten to to the to-buffer. type fromToBuffer struct { diff --git a/transform/chain_test.go b/transform/chain_test.go index 2477c3abf..d8ceb8bca 100644 --- a/transform/chain_test.go +++ b/transform/chain_test.go @@ -56,17 +56,17 @@ func TestChainZeroTransformers(t *testing.T) { } func TestChaingMultipleTransformers(t *testing.T) { - f1 := func(rw ContentReWriter) { + f1 := func(rw contentRewriter) { rw.Write(bytes.Replace(rw.Content(), []byte("f1"), []byte("f1r"), -1)) } - f2 := func(rw ContentReWriter) { + f2 := func(rw contentRewriter) { rw.Write(bytes.Replace(rw.Content(), []byte("f2"), []byte("f2r"), -1)) } - f3 := func(rw ContentReWriter) { + f3 := func(rw contentRewriter) { rw.Write(bytes.Replace(rw.Content(), []byte("f3"), []byte("f3r"), -1)) } - f4 := func(rw ContentReWriter) { + f4 := func(rw contentRewriter) { rw.Write(bytes.Replace(rw.Content(), []byte("f4"), []byte("f4r"), -1)) } diff --git a/transform/livereloadinject.go b/transform/livereloadinject.go index bffedf040..1399533fc 100644 --- a/transform/livereloadinject.go +++ b/transform/livereloadinject.go @@ -5,7 +5,7 @@ import ( "github.com/spf13/viper" ) -func LiveReloadInject(rw ContentReWriter) { +func LiveReloadInject(rw contentRewriter) { match := []byte("</body>") port := viper.GetString("port") replace := []byte(`<script>document.write('<script src="http://' |