aboutsummaryrefslogtreecommitdiffhomepage
path: root/transform
diff options
context:
space:
mode:
Diffstat (limited to 'transform')
-rw-r--r--transform/chain.go5
-rw-r--r--transform/hugogeneratorinject.go1
2 files changed, 5 insertions, 1 deletions
diff --git a/transform/chain.go b/transform/chain.go
index b566f54fa..7be38ccaa 100644
--- a/transform/chain.go
+++ b/transform/chain.go
@@ -15,8 +15,9 @@ package transform
import (
"bytes"
- bp "github.com/spf13/hugo/bufferpool"
"io"
+
+ bp "github.com/spf13/hugo/bufferpool"
)
type trans func(rw contentTransformer)
@@ -25,10 +26,12 @@ type link trans
type chain []link
+// NewChain creates a chained content transformer given the provided transforms.
func NewChain(trs ...link) chain {
return trs
}
+// NewEmptyTransforms creates a new slice of transforms with a capacity of 20.
func NewEmptyTransforms() []link {
return make([]link, 0, 20)
}
diff --git a/transform/hugogeneratorinject.go b/transform/hugogeneratorinject.go
index fe82a2eaf..a73227de7 100644
--- a/transform/hugogeneratorinject.go
+++ b/transform/hugogeneratorinject.go
@@ -24,6 +24,7 @@ import (
var metaTagsCheck = regexp.MustCompile(`(?i)<meta\s+name=['|"]?generator['|"]?`)
var hugoGeneratorTag = fmt.Sprintf(`<meta name="generator" content="Hugo %s" />`, helpers.HugoVersion())
+// HugoGeneratorInject injects a meta generator tag for Hugo if none present.
func HugoGeneratorInject(ct contentTransformer) {
if metaTagsCheck.Match(ct.Content()) {
ct.Write(ct.Content())