processors

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: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DOCTYPE = "<!DOCTYPE %s"
	PUBLIC  = "public"
	SYSTEM  = "system"
)

Variables

This section is empty.

Functions

func NewDummyProcessor

func NewDummyProcessor() *dummyProcessor

Types

type Argument

type Argument struct {
	Name    string
	PkgName string
	Type    string
	Val     string
	Declare string
	IsPb    bool
}

* There are three different places a go:arg can appear: * - A template definition * <div go:template="<template name>" go:arg="<name>[pb]: <type> [= expression]"></div> * - A replaceable definition * <div go:replaceable="<replaceable name>" go:arg="<name>[pb]: <expression>"></div> * - A template call * <div go:call="#<template name>" go:arg="<name>[pb]: <expression>"></div>

func NewArgCall

func NewArgCall(argCall string) *Argument

func NewArgDef

func NewArgDef(argDef string) *Argument

func ParseArgCalls

func ParseArgCalls(argCalls string) []*Argument

func ParseArgDefs

func ParseArgDefs(argDefs string) []*Argument

type BaseProcessor

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

func (*BaseProcessor) GetNext

func (b *BaseProcessor) GetNext() Processor

func (*BaseProcessor) HasNext

func (b *BaseProcessor) HasNext() bool

func (*BaseProcessor) SetNext

func (b *BaseProcessor) SetNext(next Processor)

type FilterInstance

type FilterInstance struct {
	Name   string
	Start  token.Pos
	End    token.Pos
	Pivot  token.Pos // Unused
	Params string
}

type GoArgProcessor

type GoArgProcessor struct {
	BaseProcessor
	// contains filtered or unexported fields
}

func NewArgProcessor

func NewArgProcessor(args []*Argument) *GoArgProcessor

func (*GoArgProcessor) Process

func (a *GoArgProcessor) Process(writer io.Writer, ctx *TagContext)

type GoCallProcessor

type GoCallProcessor struct {
	BaseProcessor
	// contains filtered or unexported fields
}

func NewCallProcessor

func NewCallProcessor(pkgPath, relPkgPath, closurePkgPrefix, closurePkgName, templateName string, args []*Argument,
	replacements []*Replacement, callerAttrs []html.Attribute) *GoCallProcessor

func (*GoCallProcessor) Process

func (c *GoCallProcessor) Process(writer io.Writer, ctx *TagContext)

type GoCallbackProcessor

type GoCallbackProcessor struct {
	BaseProcessor
	// contains filtered or unexported fields
}

* Callback processor gives a chance to execute a special processing when * the processing chain reaches its end but before the call stack starts to * go back.

func NewCallbackProcessor

func NewCallbackProcessor(callback ProcessorCallbackFunc) *GoCallbackProcessor

func (*GoCallbackProcessor) Process

func (c *GoCallbackProcessor) Process(writer io.Writer, context *TagContext)

type GoCaseProcessor

type GoCaseProcessor struct {
	BaseProcessor
	// contains filtered or unexported fields
}

func NewCaseProcessor

func NewCaseProcessor(expression string) *GoCaseProcessor

func (*GoCaseProcessor) Process

func (gcp *GoCaseProcessor) Process(writer io.Writer, ctx *TagContext)

type GoCommentProcessor

type GoCommentProcessor struct {
	BaseProcessor
	// contains filtered or unexported fields
}

func NewCommentProcessor

func NewCommentProcessor(comment string) *GoCommentProcessor

func (*GoCommentProcessor) Process

func (c *GoCommentProcessor) Process(writer io.Writer, ctx *TagContext)

type GoContentProcessor

type GoContentProcessor struct {
	BaseProcessor
	// contains filtered or unexported fields
}

func NewContentProcessor

func NewContentProcessor(expression string) *GoContentProcessor

func (*GoContentProcessor) Process

func (c *GoContentProcessor) Process(writer io.Writer, ctx *TagContext)

type GoDefaultProcessor

type GoDefaultProcessor struct {
	BaseProcessor
}

func NewDefaultProcessor

func NewDefaultProcessor() *GoDefaultProcessor

func (*GoDefaultProcessor) Process

func (s *GoDefaultProcessor) Process(writer io.Writer, ctx *TagContext)

type GoDocTypeProcessor

type GoDocTypeProcessor struct {
	BaseProcessor
	// contains filtered or unexported fields
}

func NewDocTypeProcessor

func NewDocTypeProcessor(name string, attrs []html.Attribute) *GoDocTypeProcessor

func (*GoDocTypeProcessor) Process

func (d *GoDocTypeProcessor) Process(writer io.Writer, ctx *TagContext)

type GoForProcessor

type GoForProcessor struct {
	BaseProcessor
	// contains filtered or unexported fields
}

func NewForProcessor

func NewForProcessor(forLine string) *GoForProcessor

func (*GoForProcessor) Process

func (f *GoForProcessor) Process(writer io.Writer, ctx *TagContext)

type GoHeadProcessor

type GoHeadProcessor struct {
	BaseProcessor
}

func NewHeadProcessor

func NewHeadProcessor() *GoHeadProcessor

func (*GoHeadProcessor) Process

func (gheadp *GoHeadProcessor) Process(writer io.Writer, ctx *TagContext)

type GoIfProcessor

type GoIfProcessor struct {
	BaseProcessor
	// contains filtered or unexported fields
}

func NewIfProcessor

func NewIfProcessor(conditional string) *GoIfProcessor

func (*GoIfProcessor) Process

func (i *GoIfProcessor) Process(writer io.Writer, ctx *TagContext)

type GoReplaceableProcessor

type GoReplaceableProcessor struct {
	BaseProcessor
	// contains filtered or unexported fields
}

func NewReplaceableProcessor

func NewReplaceableProcessor(tmplName string, slotName string, args []*Argument) *GoReplaceableProcessor

func (*GoReplaceableProcessor) Process

func (r *GoReplaceableProcessor) Process(writer io.Writer, ctx *TagContext)

type GoSettingsProcessor

type GoSettingsProcessor struct {
	BaseProcessor
	Name string
}

func NewSettingsProcessor

func NewSettingsProcessor(name string) *GoSettingsProcessor

func (*GoSettingsProcessor) Process

func (s *GoSettingsProcessor) Process(writer io.Writer, ctx *TagContext)

type GoSwitchProcessor

type GoSwitchProcessor struct {
	BaseProcessor
	// contains filtered or unexported fields
}

func NewSwitchProcessor

func NewSwitchProcessor(expression string) *GoSwitchProcessor

func (*GoSwitchProcessor) Process

func (s *GoSwitchProcessor) Process(writer io.Writer, ctx *TagContext)

type GoTagProcessor

type GoTagProcessor struct {
	BaseProcessor
	// contains filtered or unexported fields
}

func NewTagProcessor

func NewTagProcessor(tagName string, omitTag string, firstTag bool, needsClosing bool,
	attrs []html.Attribute) *GoTagProcessor

func (*GoTagProcessor) AddChild

func (t *GoTagProcessor) AddChild(child Processor)

func (*GoTagProcessor) Process

func (t *GoTagProcessor) Process(writer io.Writer, ctx *TagContext)

type GoTextProcessor

type GoTextProcessor struct {
	BaseProcessor
	// contains filtered or unexported fields
}

func NewTextProcessor

func NewTextProcessor(text string) *GoTextProcessor

func (*GoTextProcessor) Process

func (i *GoTextProcessor) Process(writer io.Writer, ctx *TagContext)

type GoVarProcessor

type GoVarProcessor struct {
	BaseProcessor
	// contains filtered or unexported fields
}

func NewVarProcessor

func NewVarProcessor(varDef string) *GoVarProcessor

func NewVarsProcessor

func NewVarsProcessor(varStrs string) *GoVarProcessor

func (*GoVarProcessor) Process

func (gvp *GoVarProcessor) Process(writer io.Writer, ctx *TagContext)

type Processor

type Processor interface {
	HasNext() bool
	GetNext() Processor
	SetNext(next Processor)
	Process(writer io.Writer, context *TagContext)
}

type ProcessorCallbackFunc

type ProcessorCallbackFunc func()

type RegisteredFilter

type RegisteredFilter struct {
	PkgName string
	Type    string
	VarName string
}

type Replacement

type Replacement struct {
	Name string
	Head Processor
	Args []*Argument
}

type SelectorInstance

type SelectorInstance struct {
	Name    string
	NewName string
	Start   token.Pos
	End     token.Pos
}

type TagContext

type TagContext struct {
	ExprParser *expl.ExprParser

	AutoEscape   bool
	OutputFormat string
	// contains filtered or unexported fields
}

func NewTagContext

func NewTagContext(pkgMgr *pkgmgr.PkgManager, pkgRefs pkgmgr.AliasReferer, outputFormat string) *TagContext

func (*TagContext) GetFilters

func (ctx *TagContext) GetFilters() map[string]*RegisteredFilter

func (*TagContext) MaybeAddImports

func (ctx *TagContext) MaybeAddImports(expression string)

func (*TagContext) NextId

func (ctx *TagContext) NextId() int

func (*TagContext) RewriteExpression

func (ctx *TagContext) RewriteExpression(originalExpr string) (string, error)

type VarDef

type VarDef struct {
	Name string
	Val  string
	IsPb bool
}

Jump to

Keyboard shortcuts

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