mirror of
https://github.com/danog/gojekyll.git
synced 2024-11-27 01:44:41 +01:00
Move liquid.generics -> evaluator
This commit is contained in:
parent
3681f11598
commit
55ac57dcbe
@ -13,8 +13,8 @@ import (
|
||||
|
||||
"github.com/osteele/gojekyll/config"
|
||||
"github.com/osteele/liquid"
|
||||
"github.com/osteele/liquid/evaluator"
|
||||
"github.com/osteele/liquid/expression"
|
||||
"github.com/osteele/liquid/generics"
|
||||
"github.com/russross/blackfriday"
|
||||
)
|
||||
|
||||
@ -47,12 +47,12 @@ func AddJekyllFilters(e liquid.Engine, c config.Config) {
|
||||
e.RegisterFilter("xml_escape", xml.Marshal)
|
||||
|
||||
e.RegisterFilter("push", func(array []interface{}, item interface{}) interface{} {
|
||||
return append(array, generics.MustConvertItem(item, array))
|
||||
return append(array, evaluator.MustConvertItem(item, array))
|
||||
})
|
||||
e.RegisterFilter("pop", unimplementedFilter("pop"))
|
||||
e.RegisterFilter("shift", unimplementedFilter("shift"))
|
||||
e.RegisterFilter("unshift", func(array []interface{}, item interface{}) interface{} {
|
||||
return append([]interface{}{generics.MustConvertItem(item, array)}, array...)
|
||||
return append([]interface{}{evaluator.MustConvertItem(item, array)}, array...)
|
||||
})
|
||||
|
||||
// dates
|
||||
@ -207,9 +207,9 @@ func sortFilter(array []interface{}, key interface{}, nilFirst interface{}) []in
|
||||
out := make([]interface{}, len(array))
|
||||
copy(out, array)
|
||||
if key == nil {
|
||||
generics.Sort(out)
|
||||
evaluator.Sort(out)
|
||||
} else {
|
||||
generics.SortByProperty(out, key.(string), nf)
|
||||
evaluator.SortByProperty(out, key.(string), nf)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
|
||||
"github.com/osteele/gojekyll/helpers"
|
||||
"github.com/osteele/gojekyll/templates"
|
||||
"github.com/osteele/liquid/generics"
|
||||
"github.com/osteele/liquid/evaluator"
|
||||
)
|
||||
|
||||
// file is embedded in StaticFile and page
|
||||
@ -85,7 +85,7 @@ func sortedStringValue(field interface{}) []string {
|
||||
case string:
|
||||
out = strings.Fields(value)
|
||||
case []interface{}:
|
||||
if c, e := generics.Convert(value, reflect.TypeOf(out)); e == nil {
|
||||
if c, e := evaluator.Convert(value, reflect.TypeOf(out)); e == nil {
|
||||
out = c.([]string)
|
||||
}
|
||||
case []string:
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/osteele/gojekyll/templates"
|
||||
"github.com/osteele/liquid/generics"
|
||||
"github.com/osteele/liquid/evaluator"
|
||||
)
|
||||
|
||||
type page struct {
|
||||
@ -61,7 +61,7 @@ func (p *page) PostDate() time.Time {
|
||||
case time.Time:
|
||||
return value
|
||||
case string:
|
||||
t, err := generics.ParseTime(value)
|
||||
t, err := evaluator.ParseTime(value)
|
||||
if err == nil {
|
||||
return t
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/osteele/gojekyll/templates"
|
||||
"github.com/osteele/liquid/generics"
|
||||
"github.com/osteele/liquid/evaluator"
|
||||
)
|
||||
|
||||
// ToLiquid returns the site variable for template evaluation.
|
||||
@ -40,7 +40,7 @@ func (s *Site) initializeDrop() {
|
||||
vars[c.Name] = c.Pages()
|
||||
collections = append(collections, c.ToLiquid())
|
||||
}
|
||||
generics.SortByProperty(collections, "label", true)
|
||||
evaluator.SortByProperty(collections, "label", true)
|
||||
vars["collections"] = collections
|
||||
s.drop = vars
|
||||
s.setPostVariables()
|
||||
|
Loading…
Reference in New Issue
Block a user