mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
transform: Add missing GoDoc
This commit is contained in:
parent
39fe42cf6b
commit
223073c6fd
2 changed files with 5 additions and 1 deletions
|
@ -15,8 +15,9 @@ package transform
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
bp "github.com/spf13/hugo/bufferpool"
|
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
|
bp "github.com/spf13/hugo/bufferpool"
|
||||||
)
|
)
|
||||||
|
|
||||||
type trans func(rw contentTransformer)
|
type trans func(rw contentTransformer)
|
||||||
|
@ -25,10 +26,12 @@ type link trans
|
||||||
|
|
||||||
type chain []link
|
type chain []link
|
||||||
|
|
||||||
|
// NewChain creates a chained content transformer given the provided transforms.
|
||||||
func NewChain(trs ...link) chain {
|
func NewChain(trs ...link) chain {
|
||||||
return trs
|
return trs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewEmptyTransforms creates a new slice of transforms with a capacity of 20.
|
||||||
func NewEmptyTransforms() []link {
|
func NewEmptyTransforms() []link {
|
||||||
return make([]link, 0, 20)
|
return make([]link, 0, 20)
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ import (
|
||||||
var metaTagsCheck = regexp.MustCompile(`(?i)<meta\s+name=['|"]?generator['|"]?`)
|
var metaTagsCheck = regexp.MustCompile(`(?i)<meta\s+name=['|"]?generator['|"]?`)
|
||||||
var hugoGeneratorTag = fmt.Sprintf(`<meta name="generator" content="Hugo %s" />`, helpers.HugoVersion())
|
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) {
|
func HugoGeneratorInject(ct contentTransformer) {
|
||||||
if metaTagsCheck.Match(ct.Content()) {
|
if metaTagsCheck.Match(ct.Content()) {
|
||||||
ct.Write(ct.Content())
|
ct.Write(ct.Content())
|
||||||
|
|
Loading…
Reference in a new issue