2017-06-30 17:20:32 +02:00
|
|
|
/*
|
2017-07-10 05:15:05 +02:00
|
|
|
Package liquid is a pure Go implementation of Shopify Liquid templates, developed for use in https://github.com/osteele/gojekyll.
|
2017-06-30 17:20:32 +02:00
|
|
|
|
|
|
|
See the project README https://github.com/osteele/liquid for additional information and implementation status.
|
2017-07-05 20:24:15 +02:00
|
|
|
|
2017-07-10 13:51:51 +02:00
|
|
|
|
|
|
|
The liquid package itself is versioned in gopkg.in. Subpackages have no compatibility guarantees. Except where specifically documented, the “public” entities of subpackages are intended only for use by the liquid package and its subpackages.
|
2017-06-30 17:20:32 +02:00
|
|
|
*/
|
|
|
|
package liquid
|
|
|
|
|
|
|
|
import (
|
2017-07-04 17:03:18 +02:00
|
|
|
"github.com/osteele/liquid/render"
|
2017-08-16 00:49:29 +02:00
|
|
|
"github.com/osteele/liquid/tags"
|
2017-06-30 17:20:32 +02:00
|
|
|
)
|
|
|
|
|
2017-07-03 18:00:43 +02:00
|
|
|
// Bindings is a map of variable names to values.
|
2017-07-10 13:51:51 +02:00
|
|
|
//
|
2017-07-14 02:25:12 +02:00
|
|
|
// Clients need not use this type. It is used solely for documentation. Callers can use instances
|
|
|
|
// of map[string]interface{} itself as argument values to functions declared with this parameter type.
|
2017-07-03 03:17:04 +02:00
|
|
|
type Bindings map[string]interface{}
|
2017-06-30 17:20:32 +02:00
|
|
|
|
2017-07-14 02:25:12 +02:00
|
|
|
// A Renderer returns the rendered string for a block. This is the type of a tag definition.
|
|
|
|
//
|
|
|
|
// See the examples at Engine.RegisterTag and Engine.RegisterBlock.
|
2017-07-04 17:41:45 +02:00
|
|
|
type Renderer func(render.Context) (string, error)
|
2017-07-05 20:24:15 +02:00
|
|
|
|
2017-07-10 17:49:14 +02:00
|
|
|
// SourceError records an error with a source location and optional cause.
|
2017-07-25 14:16:30 +02:00
|
|
|
//
|
|
|
|
// SourceError does not depend on, but is compatible with, the causer interface of https://github.com/pkg/errors.
|
2017-07-10 17:49:14 +02:00
|
|
|
type SourceError interface {
|
|
|
|
error
|
|
|
|
Cause() error
|
2017-07-12 13:12:14 +02:00
|
|
|
Path() string
|
2017-07-10 17:49:14 +02:00
|
|
|
LineNumber() int
|
|
|
|
}
|
2017-08-16 00:49:29 +02:00
|
|
|
|
|
|
|
// IterationKeyedMap returns a map whose {% for %} tag iteration values are its keys, instead of [key, value] pairs.
|
|
|
|
// Use this to create a Go map with the semantics of a Ruby struct drop.
|
|
|
|
func IterationKeyedMap(m map[string]interface{}) tags.IterationKeyedMap {
|
|
|
|
return m
|
|
|
|
}
|