mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Un-export ContentReWriter
This commit is contained in:
parent
98ee69bce2
commit
e7099cfa26
5 changed files with 14 additions and 14 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
|
||||
|
|
|
@ -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://'
|
||||
|
|
Loading…
Reference in a new issue