mirror of
https://github.com/danog/gojekyll.git
synced 2025-01-23 06:12:24 +01:00
Lint
This commit is contained in:
parent
ccca2497e4
commit
ec8854e1b2
@ -91,6 +91,9 @@ func (e *Wrapper) addJekyllFilters() {
|
||||
// return strings.Join(parts, "?")
|
||||
// })
|
||||
e.engine.DefineFilter("xml_escape", func(s string) string {
|
||||
// TODO can't handle maps
|
||||
// eval https://github.com/clbanning/mxj
|
||||
// adapt https://stackoverflow.com/questions/30928770/marshall-map-to-xml-in-go
|
||||
buf := new(bytes.Buffer)
|
||||
if err := xml.EscapeText(buf, []byte(s)); err != nil {
|
||||
panic(err)
|
||||
@ -121,9 +124,7 @@ func sortFilter(in []interface{}, key interface{}, nilFirst interface{}) []inter
|
||||
nf = true
|
||||
}
|
||||
out := make([]interface{}, len(in))
|
||||
for i, v := range in {
|
||||
out[i] = v
|
||||
}
|
||||
copy(out, in)
|
||||
if key == nil {
|
||||
generics.Sort(out)
|
||||
} else {
|
||||
@ -132,17 +133,6 @@ func sortFilter(in []interface{}, key interface{}, nilFirst interface{}) []inter
|
||||
return out
|
||||
}
|
||||
|
||||
// func xmlEscapeFilter(value interface{}) interface{} {
|
||||
// data, err := xml.Marshal(value)
|
||||
// // TODO can't handle maps
|
||||
// // eval https://github.com/clbanning/mxj
|
||||
// // adapt https://stackoverflow.com/questions/30928770/marshall-map-to-xml-in-go
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
// return data
|
||||
// }
|
||||
|
||||
func whereExpFilter(in []interface{}, name string, expr expressions.Closure) ([]interface{}, error) {
|
||||
rt := reflect.ValueOf(in)
|
||||
switch rt.Kind() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user