runtime

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2018 License: BSD-2-Clause Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MERGEABLE_ATTRS = map[string]bool{
	"class": true,
	"style": true,
}

Functions

func DecodeRpcRequestOrFail

func DecodeRpcRequestOrFail(input io.Reader, settings *TemplateSettings, args interface{})

func EscapeAttr

func EscapeAttr(attr string) string

func EscapeContent

func EscapeContent(a interface{}) string

func IndirectString

func IndirectString(a interface{}) string

func InitGoats

func InitGoats(settings *GoatsSettings)

func IsMergeable

func IsMergeable(attrName string) bool

Types

type BaseTemplate

type BaseTemplate struct {
	// contains filtered or unexported fields
}

func NewBaseTemplate

func NewBaseTemplate(writer io.Writer, settings *TemplateSettings) *BaseTemplate

func (*BaseTemplate) FormatString

func (bt *BaseTemplate) FormatString(text string, a ...interface{})

func (*BaseTemplate) GetCallerAttrsFunc

func (bt *BaseTemplate) GetCallerAttrsFunc() CallerAttrsFunc

func (*BaseTemplate) GetSettings

func (bt *BaseTemplate) GetSettings() *TemplateSettings

func (*BaseTemplate) GetWriter

func (bt *BaseTemplate) GetWriter() io.Writer

func (*BaseTemplate) SetCallerAttrsFunc

func (bt *BaseTemplate) SetCallerAttrsFunc(callerAttrsFunc CallerAttrsFunc)

func (*BaseTemplate) WriteString

func (bt *BaseTemplate) WriteString(text string)

type BuiltinFilter

type BuiltinFilter struct{}

func NewBuiltinFilter

func NewBuiltinFilter() *BuiltinFilter

func (*BuiltinFilter) Capfirst

func (bf *BuiltinFilter) Capfirst(a interface{}) string

func (*BuiltinFilter) Center

func (bf *BuiltinFilter) Center(a interface{}, width int) string

func (*BuiltinFilter) Cut

func (bf *BuiltinFilter) Cut(a interface{}, removed string) string

func (*BuiltinFilter) Debug

func (bf *BuiltinFilter) Debug(a interface{}) string

*

  • Prints an arbitrary variable's detailed information to help template authors
  • to debug. This is supposed to be used for dev mode only and thus it might have
  • a compromised performance.

func (*BuiltinFilter) FloatFormat

func (bf *BuiltinFilter) FloatFormat(a interface{}, precision int) string

func (*BuiltinFilter) Format

func (bf *BuiltinFilter) Format(fmtStr string, a ...interface{}) string

func (*BuiltinFilter) Join

func (bf *BuiltinFilter) Join(a interface{}, separator string) string

func (*BuiltinFilter) Length

func (bf *BuiltinFilter) Length(a []interface{}) int

func (*BuiltinFilter) Ljust

func (bf *BuiltinFilter) Ljust(a interface{}, width int) string

func (*BuiltinFilter) Quote

func (bf *BuiltinFilter) Quote(a interface{}) string

func (*BuiltinFilter) Rjust

func (bf *BuiltinFilter) Rjust(a interface{}, width int) string

func (*BuiltinFilter) Title

func (bf *BuiltinFilter) Title(a interface{}) string

func (*BuiltinFilter) UnixDate

func (bf *BuiltinFilter) UnixDate(format string, a interface{}) string

Example:

<div go:content="unixdate('01/02/2006 15:04:05'), 1390637053836182000"></div>

func (*BuiltinFilter) UnixNanoDate

func (bf *BuiltinFilter) UnixNanoDate(format string, a interface{}) string

Example:

<div go:content="unixnanodate('01/02/2006 15:04:05'), 1390637053836182000"></div>

type CallerAttrsFunc

type CallerAttrsFunc func() (TagAttrs, bool, bool)

type GoatsSettings

type GoatsSettings struct {
	DevServerPort int    // Only used for dev mode
	PkgRoot       string // Only used for dev mode
	TemplateDir   string // Only used for dev mode
	OutputDir     string // Only used for dev mode
}

func NewGoatsSettings

func NewGoatsSettings() *GoatsSettings

type LoopVar

type LoopVar struct {
	Total       int
	Counter     int
	Counter0    int
	RevCounter  int
	RevCounter0 int
	First       bool
	Last        bool
}

type ReplaceableFunc

type ReplaceableFunc func()

type TagAttrs

type TagAttrs map[string]string

func (TagAttrs) AddAttr

func (ta TagAttrs) AddAttr(name string, a interface{})

func (TagAttrs) GenTagAndAttrs

func (ta TagAttrs) GenTagAndAttrs(writer io.Writer, tagName string)

func (TagAttrs) MergeFrom

func (ta TagAttrs) MergeFrom(fromAttrs map[string]string)

type Template

type Template interface {
	GetCallerAttrsFunc() CallerAttrsFunc
	SetCallerAttrsFunc(CallerAttrsFunc)
}

type TemplateSettings

type TemplateSettings struct {
	OmitDocType bool
	DebugMode   bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL