Documentation ¶
Index ¶
- Variables
- func AsOutValue(ctx context.Context, v interface{}) *interfaceValue
- func CallFunction(ctx context.Context, funcName string, params Values, target WritableValue) error
- func CompareValues(ctx context.Context, o1, o2 interface{}) (bool, error)
- func FormatSize(v uint64) string
- func LogWarn(ctx context.Context, msg string, arg ...interface{})
- func QueryEscapeAny(ctx context.Context, val interface{}) string
- func RegisterFilter(name string, f TplFiltCallback)
- func RegisterFunction(name string, f *TplFunction)
- func ResetServerCtx(ctx context.Context)
- func ResolveValueIndex(ctx context.Context, v any, s string) (any, error)
- func ServerCtx(request *http.Request) context.Context
- func ValuesCtx(parent context.Context, values map[string]interface{}) context.Context
- func ValuesCtxAlways(parent context.Context, values map[string]interface{}) context.Context
- type ArrayAccessGet
- type ArrayAccessGetAny
- type CtxLog
- type Error
- type Page
- func (e *Page) Compile(ctx context.Context) error
- func (e *Page) Dump(o io.Writer, lvl int)
- func (e *Page) GetMime() string
- func (e *Page) GetProperty(p string) string
- func (e *Page) HasTpl(tpl string) bool
- func (e *Page) Parse(ctx context.Context, tpl string, out *interfaceValue) error
- func (e *Page) ParseAndReturn(ctx context.Context, tpl string) (string, error)
- func (e *Page) ParseAndWrite(ctx context.Context, tpl string, out io.Writer) error
- type RawData
- type TplCtxValue
- type TplFiltCallback
- type TplFuncCallback
- type TplFunction
- type Value
- type ValueCtx
- func (v *ValueCtx) Bytes() []byte
- func (v *ValueCtx) BytesErr() ([]byte, error)
- func (v *ValueCtx) IsString() bool
- func (v *ValueCtx) MarshalJSON() ([]byte, error)
- func (v *ValueCtx) MatchValueType(t interface{}) (interface{}, error)
- func (v *ValueCtx) Raw() (interface{}, error)
- func (v *ValueCtx) String() string
- func (v *ValueCtx) StringErr() (string, error)
- func (v *ValueCtx) ToBool() bool
- func (v *ValueCtx) ToFloat() (float64, bool)
- func (v *ValueCtx) ToInt() (int64, bool)
- type ValueReader
- type Values
- type WritableValue
Constants ¶
This section is empty.
Variables ¶
View Source
var BBCodeCompiler = bbcode.NewCompiler(true, true)
View Source
var (
ErrTplNotFound = errors.New("tpl: Template not found")
)
Functions ¶
func AsOutValue ¶
func CallFunction ¶
func FormatSize ¶
func QueryEscapeAny ¶
func RegisterFilter ¶
func RegisterFilter(name string, f TplFiltCallback)
func RegisterFunction ¶
func RegisterFunction(name string, f *TplFunction)
func ResetServerCtx ¶
Types ¶
type ArrayAccessGet ¶
type ArrayAccessGetAny ¶ added in v1.0.5
type Error ¶
Error is a template error, containing details such as where an error occured in the template source and details on the actual error.
type Page ¶
type Page struct { Version int // will be populated on compile Raw RawData MaxProcess int // when running parallel compile (0=unlimited) // contains filtered or unexported fields }
func (*Page) GetProperty ¶
func (*Page) ParseAndReturn ¶
type RawData ¶
type RawData struct { PageProperties map[string]string // typically Charset=UTF-8 Content_Type=text/html TemplateData map[string]string // actual contents for templates, at least "main" should be there }
RawData contains the raw (uncompiled) data for current template
type TplFiltCallback ¶
type TplFuncCallback ¶
type TplFuncCallback func(ctx context.Context, params Values, out WritableValue) error
type TplFunction ¶
type TplFunction struct { Method TplFuncCallback CanCompile bool }
type Value ¶
type ValueCtx ¶
type ValueCtx struct { Value // contains filtered or unexported fields }
func (*ValueCtx) IsString ¶
IsString checks if the raw value is either a string, or an interface made to return a string
func (*ValueCtx) MarshalJSON ¶
func (*ValueCtx) MatchValueType ¶
type ValueReader ¶ added in v1.0.2
type WritableValue ¶
type WritableValue interface { Value Printf(fmt string, arg ...interface{}) (int, error) Write([]byte) (int, error) WriteValue(context.Context, interface{}) error }
func NewEmptyValue ¶
func NewEmptyValue() WritableValue
Click to show internal directories.
Click to hide internal directories.