1
0
mirror of https://github.com/danog/gojekyll.git synced 2025-01-22 20:51:24 +01:00

Liquid tag and filter fns can be private

This commit is contained in:
Oliver Steele 2017-06-17 12:30:37 -04:00
parent 44036937b5
commit 0ec73bad81
2 changed files with 13 additions and 13 deletions

View File

@ -5,9 +5,14 @@ import (
"io" "io"
"strings" "strings"
"github.com/acstech/liquid"
"github.com/acstech/liquid/core" "github.com/acstech/liquid/core"
) )
func init() {
liquid.Tags["link"] = LinkFactory
}
// A FilePathURLGetter given an include tag file name returns a URL. // A FilePathURLGetter given an include tag file name returns a URL.
type FilePathURLGetter func(string) (string, bool) type FilePathURLGetter func(string) (string, bool)

View File

@ -6,20 +6,17 @@ import (
"reflect" "reflect"
"time" "time"
"github.com/acstech/liquid"
"github.com/acstech/liquid/core" "github.com/acstech/liquid/core"
) )
func init() { func init() {
liquid.Tags["link"] = LinkFactory core.RegisterFilter("date_to_rfc822", dateToRFC822Factory)
core.RegisterFilter("date_to_rfc822", DateToRFC822Factory) core.RegisterFilter("jsonify", jsonifyFactory)
core.RegisterFilter("jsonify", JsonifyFactory) core.RegisterFilter("xml_escape", xmlEscapeFactory)
core.RegisterFilter("xml_escape", XMLEscapeFactory) core.RegisterFilter("where_exp", whereExpFactory)
core.RegisterFilter("where_exp", WhereExpFactory)
} }
// DateToRFC822Factory implements the Jekyll `json` filter func dateToRFC822Factory(parameters []core.Value) core.Filter {
func DateToRFC822Factory(parameters []core.Value) core.Filter {
if len(parameters) != 0 { if len(parameters) != 0 {
panic("The date_to_rfc822 filter doesn't accept parameters") panic("The date_to_rfc822 filter doesn't accept parameters")
} }
@ -29,8 +26,7 @@ func DateToRFC822Factory(parameters []core.Value) core.Filter {
} }
} }
// JsonifyFactory implements the Jekyll `json` filter func jsonifyFactory(parameters []core.Value) core.Filter {
func JsonifyFactory(parameters []core.Value) core.Filter {
if len(parameters) != 0 { if len(parameters) != 0 {
panic("The jsonify filter doesn't accept parameters") panic("The jsonify filter doesn't accept parameters")
} }
@ -43,8 +39,7 @@ func JsonifyFactory(parameters []core.Value) core.Filter {
} }
} }
// XMLEscapeFactory implements the Jekyll `xml_escape` filter func xmlEscapeFactory(parameters []core.Value) core.Filter {
func XMLEscapeFactory(parameters []core.Value) core.Filter {
if len(parameters) != 0 { if len(parameters) != 0 {
panic("The xml_escape filter doesn't accept parameters") panic("The xml_escape filter doesn't accept parameters")
} }
@ -61,7 +56,7 @@ func XMLEscapeFactory(parameters []core.Value) core.Filter {
} }
// WhereExpFactory implements the Jekyll `where_exp` filter // WhereExpFactory implements the Jekyll `where_exp` filter
func WhereExpFactory(parameters []core.Value) core.Filter { func whereExpFactory(parameters []core.Value) core.Filter {
if len(parameters) != 2 { if len(parameters) != 2 {
panic("The were_exp filter requires two parameters") panic("The were_exp filter requires two parameters")
} }