tree

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2021 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	INLINE           = false
	COMPRESS_NUMBERS = false // always on

	AUTO_LINK = false // optimally convert tags containing 'href' attribute to <a>

	VERBOSITY = 0
)
View Source
var ABS_PRECISION = 5
View Source
var AUTO_DOC_TYPE = true
View Source
var GEN_PRECISION = 3 // == -math.Log10(0.001)
View Source
var IsAutoUID func(id string) bool = nil
View Source
var REL_PRECISION = 7

wrt the viewBox

Functions

func AssertUniqueID

func AssertUniqueID(t Tag, ctx context.Context) (idToken *tokens.String, err error)

func FindID

func FindID(tag Tag, idToken *tokens.String) (Tag, int, Tag, bool, error)

func IsTag

func IsTag(key string) bool

func RegisterParents

func RegisterParents(root Tag)

func RoundScalar

func RoundScalar(s float64, prec float64) float64

eg. prec = 0.00001

func WalkText

func WalkText(current Tag, prev []Tag, fn func([]Tag, string) error) error

Types

type Body

type Body struct {
	VisibleTagData
}

func (*Body) AppendChild

func (t *Body) AppendChild(child Tag)

func (*Body) Attributes

func (t *Body) Attributes() *tokens.StringDict

returns ptr, so attributes can be changed in-place

func (*Body) Children

func (t *Body) Children() []Tag

func (*Body) CollectIDs

func (t *Body) CollectIDs(idMap IDMap) error

func (*Body) CollectScripts

func (t *Body) CollectScripts(idMap IDMap, classMap ClassMap, bundle *scripts.InlineBundle) error

func (*Body) Context

func (t *Body) Context() context.Context

func (*Body) DeleteAllChildren

func (t *Body) DeleteAllChildren() error

func (*Body) DeleteChild

func (t *Body) DeleteChild(i int) error

func (*Body) FoldDummy

func (t *Body) FoldDummy()

func (*Body) GetID

func (t *Body) GetID() string

func (*Body) InsertChild

func (t *Body) InsertChild(i int, child Tag) error

func (*Body) Name

func (t *Body) Name() string

func (*Body) NumChildren

func (t *Body) NumChildren() int

func (*Body) Parent

func (t *Body) Parent() Tag

func (*Body) RegisterParent

func (t *Body) RegisterParent(p Tag)

func (*Body) SetID

func (t *Body) SetID(id string)

func (*Body) Validate

func (t *Body) Validate() error

func (*Body) ValidateChildren

func (t *Body) ValidateChildren() error

func (*Body) VerifyElementCount

func (t *Body) VerifyElementCount(i int, ecKey string) error

type Br

type Br struct {
	VisibleTagData
}

func (*Br) AppendChild

func (t *Br) AppendChild(child Tag)

func (*Br) Attributes

func (t *Br) Attributes() *tokens.StringDict

returns ptr, so attributes can be changed in-place

func (*Br) Children

func (t *Br) Children() []Tag

func (*Br) CollectScripts

func (t *Br) CollectScripts(idMap IDMap, classMap ClassMap, bundle *scripts.InlineBundle) error

func (*Br) Context

func (t *Br) Context() context.Context

func (*Br) DeleteAllChildren

func (t *Br) DeleteAllChildren() error

func (*Br) DeleteChild

func (t *Br) DeleteChild(i int) error

func (*Br) FoldDummy

func (t *Br) FoldDummy()

func (*Br) GetID

func (t *Br) GetID() string

func (*Br) InsertChild

func (t *Br) InsertChild(i int, child Tag) error

func (*Br) Name

func (t *Br) Name() string

func (*Br) NumChildren

func (t *Br) NumChildren() int

func (*Br) Parent

func (t *Br) Parent() Tag

func (*Br) RegisterParent

func (t *Br) RegisterParent(p Tag)

func (*Br) SetID

func (t *Br) SetID(id string)

func (*Br) Validate

func (t *Br) Validate() error

func (*Br) ValidateChildren

func (t *Br) ValidateChildren() error

func (*Br) VerifyElementCount

func (t *Br) VerifyElementCount(i int, ecKey string) error

type ClassMap

type ClassMap interface {
	HasTag(class string) bool
	GetTag(class string) []VisibleTag
	AppendTag(class string, t VisibleTag)

	HasScriptClass(class string) bool
}

func NewClassMap

func NewClassMap() ClassMap

type ClassMapData

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

func (*ClassMapData) AppendTag

func (m *ClassMapData) AppendTag(class string, t VisibleTag)

func (*ClassMapData) GetTag

func (m *ClassMapData) GetTag(class string) []VisibleTag

func (*ClassMapData) HasScriptClass

func (m *ClassMapData) HasScriptClass(class string) bool

func (*ClassMapData) HasTag

func (m *ClassMapData) HasTag(class string) bool

type CollectStylesTag

type CollectStylesTag interface {
	CollectIDs(IDMap) error
	CollectClasses(ClassMap) error
	CollectStyles(styles.DocSheet) error
}

type Div

type Div struct {
	VisibleTagData
}

func (*Div) AppendChild

func (t *Div) AppendChild(child Tag)

func (*Div) Attributes

func (t *Div) Attributes() *tokens.StringDict

returns ptr, so attributes can be changed in-place

func (*Div) Children

func (t *Div) Children() []Tag

func (*Div) CollectScripts

func (t *Div) CollectScripts(idMap IDMap, classMap ClassMap, bundle *scripts.InlineBundle) error

func (*Div) Context

func (t *Div) Context() context.Context

func (*Div) DeleteAllChildren

func (t *Div) DeleteAllChildren() error

func (*Div) DeleteChild

func (t *Div) DeleteChild(i int) error

func (*Div) FoldDummy

func (t *Div) FoldDummy()

func (*Div) GetID

func (t *Div) GetID() string

func (*Div) InsertChild

func (t *Div) InsertChild(i int, child Tag) error

func (*Div) Name

func (t *Div) Name() string

func (*Div) NumChildren

func (t *Div) NumChildren() int

func (*Div) Parent

func (t *Div) Parent() Tag

func (*Div) RegisterParent

func (t *Div) RegisterParent(p Tag)

func (*Div) SetID

func (t *Div) SetID(id string)

func (*Div) Validate

func (t *Div) Validate() error

func (*Div) ValidateChildren

func (t *Div) ValidateChildren() error

func (*Div) VerifyElementCount

func (t *Div) VerifyElementCount(i int, ecKey string) error

type DocType

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

func NewAutoDocType

func NewAutoDocType() *DocType

func (*DocType) AppendChild

func (t *DocType) AppendChild(child Tag)

func (*DocType) Attributes

func (t *DocType) Attributes() *tokens.StringDict

returns ptr, so attributes can be changed in-place

func (*DocType) Children

func (t *DocType) Children() []Tag

func (*DocType) CollectScripts

func (t *DocType) CollectScripts(idMap IDMap, classMap ClassMap, bundle *scripts.InlineBundle) error

func (*DocType) Context

func (t *DocType) Context() context.Context

func (*DocType) DeleteAllChildren

func (t *DocType) DeleteAllChildren() error

func (*DocType) DeleteChild

func (t *DocType) DeleteChild(i int) error

func (*DocType) FoldDummy

func (t *DocType) FoldDummy()

func (*DocType) GetID

func (t *DocType) GetID() string

func (*DocType) InsertChild

func (t *DocType) InsertChild(i int, child Tag) error

func (*DocType) Name

func (t *DocType) Name() string

func (*DocType) NumChildren

func (t *DocType) NumChildren() int

func (*DocType) Parent

func (t *DocType) Parent() Tag

func (*DocType) RegisterParent

func (t *DocType) RegisterParent(p Tag)

func (*DocType) SetID

func (t *DocType) SetID(id string)

func (*DocType) Validate

func (t *DocType) Validate() error

func (*DocType) ValidateChildren

func (t *DocType) ValidateChildren() error

func (*DocType) VerifyElementCount

func (t *DocType) VerifyElementCount(i int, ecKey string) error

func (*DocType) Write

func (t *DocType) Write(indent string, nl, tab string) string

type Dummy

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

func (*Dummy) AppendChild

func (t *Dummy) AppendChild(child Tag)

func (*Dummy) Attributes

func (t *Dummy) Attributes() *tokens.StringDict

returns ptr, so attributes can be changed in-place

func (*Dummy) Children

func (t *Dummy) Children() []Tag

func (*Dummy) CollectScripts

func (t *Dummy) CollectScripts(idMap IDMap, classMap ClassMap, bundle *scripts.InlineBundle) error

func (*Dummy) Compress

func (t *Dummy) Compress(vb SVGViewBox)

func (*Dummy) Context

func (t *Dummy) Context() context.Context

func (*Dummy) DeleteAllChildren

func (t *Dummy) DeleteAllChildren() error

func (*Dummy) DeleteChild

func (t *Dummy) DeleteChild(i int) error

func (*Dummy) FoldDummy

func (t *Dummy) FoldDummy()

func (*Dummy) GetID

func (t *Dummy) GetID() string

func (*Dummy) InsertChild

func (t *Dummy) InsertChild(i int, child Tag) error

func (*Dummy) Minify

func (t *Dummy) Minify() bool

func (*Dummy) Name

func (t *Dummy) Name() string

func (*Dummy) NumChildren

func (t *Dummy) NumChildren() int

func (*Dummy) Parent

func (t *Dummy) Parent() Tag

func (*Dummy) RegisterParent

func (t *Dummy) RegisterParent(p Tag)

func (*Dummy) SetID

func (t *Dummy) SetID(id string)

func (*Dummy) Validate

func (t *Dummy) Validate() error

func (*Dummy) ValidateChildren

func (t *Dummy) ValidateChildren() error

func (*Dummy) VerifyElementCount

func (t *Dummy) VerifyElementCount(i int, ecKey string) error

func (*Dummy) Write

func (t *Dummy) Write(indent string, nl, tab string) string

type GenBuilder

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

func (*GenBuilder) Build

func (b *GenBuilder) Build(key string, attr *tokens.StringDict, ctx context.Context) (Tag, error)

generic

type Generic

type Generic struct {
	VisibleTagData
	// contains filtered or unexported fields
}

func (*Generic) AppendChild

func (t *Generic) AppendChild(child Tag)

func (*Generic) Attributes

func (t *Generic) Attributes() *tokens.StringDict

returns ptr, so attributes can be changed in-place

func (*Generic) Children

func (t *Generic) Children() []Tag

func (*Generic) CollectScripts

func (t *Generic) CollectScripts(idMap IDMap, classMap ClassMap, bundle *scripts.InlineBundle) error

func (*Generic) Context

func (t *Generic) Context() context.Context

func (*Generic) DeleteAllChildren

func (t *Generic) DeleteAllChildren() error

func (*Generic) DeleteChild

func (t *Generic) DeleteChild(i int) error

func (*Generic) FoldDummy

func (t *Generic) FoldDummy()

func (*Generic) GetID

func (t *Generic) GetID() string

func (*Generic) InsertChild

func (t *Generic) InsertChild(i int, child Tag) error

func (*Generic) Name

func (t *Generic) Name() string

func (*Generic) NumChildren

func (t *Generic) NumChildren() int

func (*Generic) Parent

func (t *Generic) Parent() Tag

func (*Generic) RegisterParent

func (t *Generic) RegisterParent(p Tag)

func (*Generic) SetID

func (t *Generic) SetID(id string)

func (*Generic) Validate

func (t *Generic) Validate() error

func (*Generic) ValidateChildren

func (t *Generic) ValidateChildren() error

func (*Generic) VerifyElementCount

func (t *Generic) VerifyElementCount(i int, ecKey string) error

func (*Generic) Write

func (t *Generic) Write(indent string, nl, tab string) string

type HTML

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

func (*HTML) AppendChild

func (t *HTML) AppendChild(child Tag)

func (*HTML) ApplyControl

func (t *HTML) ApplyControl(control string, jsUrl string) error

func (*HTML) Attributes

func (t *HTML) Attributes() *tokens.StringDict

returns ptr, so attributes can be changed in-place

func (*HTML) Children

func (t *HTML) Children() []Tag

func (*HTML) CollectClasses

func (t *HTML) CollectClasses(classMap ClassMap) error

func (*HTML) CollectIDs

func (t *HTML) CollectIDs(idMap IDMap) error

func (*HTML) CollectScripts

func (t *HTML) CollectScripts(idMap IDMap, classMap ClassMap, bundle *scripts.InlineBundle) error

func (*HTML) CollectStyles

func (t *HTML) CollectStyles(idMap IDMap, classMap ClassMap, cssUrl string) ([][]string, error)

return the bundleable css rules

func (*HTML) Context

func (t *HTML) Context() context.Context

func (*HTML) DeleteAllChildren

func (t *HTML) DeleteAllChildren() error

func (*HTML) DeleteChild

func (t *HTML) DeleteChild(i int) error

func (*HTML) FoldDummy

func (t *HTML) FoldDummy()

func (*HTML) GetClasses

func (t *HTML) GetClasses() []string

func (*HTML) GetID

func (t *HTML) GetID() string

func (*HTML) IncludeControl

func (t *HTML) IncludeControl(code string) error

func (*HTML) IncludeStyle

func (t *HTML) IncludeStyle(style string) error

func (*HTML) InnerHTML

func (t *HTML) InnerHTML() string

func (*HTML) InsertChild

func (t *HTML) InsertChild(i int, child Tag) error

func (*HTML) Name

func (t *HTML) Name() string

func (*HTML) NumChildren

func (t *HTML) NumChildren() int

func (*HTML) Parent

func (t *HTML) Parent() Tag

func (*HTML) RegisterParent

func (t *HTML) RegisterParent(p Tag)

func (*HTML) SetClasses

func (t *HTML) SetClasses(cs []string)

func (*HTML) SetID

func (t *HTML) SetID(id string)

func (*HTML) ToJSType

func (t *HTML) ToJSType() string

func (*HTML) Validate

func (t *HTML) Validate() error

func (*HTML) ValidateChildren

func (t *HTML) ValidateChildren() error

func (*HTML) VerifyElementCount

func (t *HTML) VerifyElementCount(i int, ecKey string) error

func (*HTML) Write

func (t *HTML) Write(indent string, nl, tab string) string
type Head struct {
	// contains filtered or unexported fields
}

func (*Head) AppendChild

func (t *Head) AppendChild(child Tag)

func (*Head) Attributes

func (t *Head) Attributes() *tokens.StringDict

returns ptr, so attributes can be changed in-place

func (*Head) Children

func (t *Head) Children() []Tag

func (*Head) CollectScripts

func (t *Head) CollectScripts(idMap IDMap, classMap ClassMap, bundle *scripts.InlineBundle) error

func (*Head) Context

func (t *Head) Context() context.Context

func (*Head) DeleteAllChildren

func (t *Head) DeleteAllChildren() error

func (*Head) DeleteChild

func (t *Head) DeleteChild(i int) error

func (*Head) FoldDummy

func (t *Head) FoldDummy()

func (*Head) GetID

func (t *Head) GetID() string

func (*Head) InsertChild

func (t *Head) InsertChild(i int, child Tag) error

func (*Head) Name

func (t *Head) Name() string

func (*Head) NumChildren

func (t *Head) NumChildren() int

func (*Head) Parent

func (t *Head) Parent() Tag

func (*Head) RegisterParent

func (t *Head) RegisterParent(p Tag)

func (*Head) SetID

func (t *Head) SetID(id string)

func (*Head) Validate

func (t *Head) Validate() error

func (*Head) ValidateChildren

func (t *Head) ValidateChildren() error

func (*Head) VerifyElementCount

func (t *Head) VerifyElementCount(i int, ecKey string) error

func (*Head) Write

func (t *Head) Write(indent string, nl, tab string) string

type IDMap

type IDMap interface {
	Has(id string) bool
	Get(id string) IDMapTag
	Set(id string, t IDMapTag)

	Dump() // for debugging
}

func NewIDMap

func NewIDMap() IDMap

type IDMapData

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

func (*IDMapData) Dump

func (m *IDMapData) Dump()

func (*IDMapData) Get

func (m *IDMapData) Get(id string) IDMapTag

func (*IDMapData) Has

func (m *IDMapData) Has(id string) bool

func (*IDMapData) Set

func (m *IDMapData) Set(id string, t IDMapTag)

type IDMapTag

type IDMapTag interface {
	Name() string
	ToJSType() string
	InnerHTML() string // empty if no direct descendant is text
	Context() context.Context
}

only requires a subset of that tag methods

type Img

type Img struct {
	VisibleTagData
}

func (*Img) AppendChild

func (t *Img) AppendChild(child Tag)

func (*Img) Attributes

func (t *Img) Attributes() *tokens.StringDict

returns ptr, so attributes can be changed in-place

func (*Img) Children

func (t *Img) Children() []Tag

func (*Img) CollectScripts

func (t *Img) CollectScripts(idMap IDMap, classMap ClassMap, bundle *scripts.InlineBundle) error

func (*Img) Context

func (t *Img) Context() context.Context

func (*Img) DeleteAllChildren

func (t *Img) DeleteAllChildren() error

func (*Img) DeleteChild

func (t *Img) DeleteChild(i int) error

func (*Img) FoldDummy

func (t *Img) FoldDummy()

func (*Img) GetID

func (t *Img) GetID() string

func (*Img) InsertChild

func (t *Img) InsertChild(i int, child Tag) error

func (*Img) Name

func (t *Img) Name() string

func (*Img) NumChildren

func (t *Img) NumChildren() int

func (*Img) Parent

func (t *Img) Parent() Tag

func (*Img) RegisterParent

func (t *Img) RegisterParent(p Tag)

func (*Img) SetID

func (t *Img) SetID(id string)

func (*Img) Validate

func (t *Img) Validate() error

func (*Img) ValidateChildren

func (t *Img) ValidateChildren() error

func (*Img) VerifyElementCount

func (t *Img) VerifyElementCount(i int, ecKey string) error

func (*Img) Write

func (t *Img) Write(indent string, nl, tab string) string

type Input

type Input struct {
	VisibleTagData
}

func (*Input) AppendChild

func (t *Input) AppendChild(child Tag)

func (*Input) Attributes

func (t *Input) Attributes() *tokens.StringDict

returns ptr, so attributes can be changed in-place

func (*Input) Children

func (t *Input) Children() []Tag

func (*Input) CollectScripts

func (t *Input) CollectScripts(idMap IDMap, classMap ClassMap, bundle *scripts.InlineBundle) error

func (*Input) Context

func (t *Input) Context() context.Context

func (*Input) DeleteAllChildren

func (t *Input) DeleteAllChildren() error

func (*Input) DeleteChild

func (t *Input) DeleteChild(i int) error

func (*Input) FoldDummy

func (t *Input) FoldDummy()

func (*Input) GetID

func (t *Input) GetID() string

func (*Input) InsertChild

func (t *Input) InsertChild(i int, child Tag) error

func (*Input) Name

func (t *Input) Name() string

func (*Input) NumChildren

func (t *Input) NumChildren() int

func (*Input) Parent

func (t *Input) Parent() Tag

func (*Input) RegisterParent

func (t *Input) RegisterParent(p Tag)

func (*Input) SetID

func (t *Input) SetID(id string)

func (*Input) Validate

func (t *Input) Validate() error

func (*Input) ValidateChildren

func (t *Input) ValidateChildren() error

func (*Input) VerifyElementCount

func (t *Input) VerifyElementCount(i int, ecKey string) error

type LeafTag

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

implements Tag interface

func NewLeafTag

func NewLeafTag(ctx context.Context) LeafTag

func (*LeafTag) AppendChild

func (t *LeafTag) AppendChild(child Tag)

func (*LeafTag) Attributes

func (t *LeafTag) Attributes() *tokens.StringDict

func (*LeafTag) Children

func (t *LeafTag) Children() []Tag

func (*LeafTag) CollectClasses

func (t *LeafTag) CollectClasses(classMap ClassMap) error

func (*LeafTag) CollectIDs

func (t *LeafTag) CollectIDs(idMap IDMap) error

func (*LeafTag) CollectScripts

func (t *LeafTag) CollectScripts(idMap IDMap, classMap ClassMap, bundle *scripts.InlineBundle) error

func (*LeafTag) CollectStyles

func (t *LeafTag) CollectStyles(ss styles.DocSheet) error

func (*LeafTag) Context

func (t *LeafTag) Context() context.Context

func (*LeafTag) DeleteAllChildren

func (t *LeafTag) DeleteAllChildren() error

func (*LeafTag) DeleteChild

func (t *LeafTag) DeleteChild(i int) error

func (*LeafTag) FindID

func (t *LeafTag) FindID(id *tokens.String) (Tag, int, Tag, bool, error)

func (*LeafTag) FoldDummy

func (t *LeafTag) FoldDummy()

func (*LeafTag) GetClasses

func (t *LeafTag) GetClasses() []string

func (*LeafTag) GetID

func (t *LeafTag) GetID() string

func (*LeafTag) InsertChild

func (t *LeafTag) InsertChild(i int, child Tag) error

func (*LeafTag) Name

func (t *LeafTag) Name() string

func (*LeafTag) NumChildren

func (t *LeafTag) NumChildren() int

func (*LeafTag) Parent

func (t *LeafTag) Parent() Tag

func (*LeafTag) RegisterParent

func (t *LeafTag) RegisterParent(p Tag)

func (*LeafTag) SetClasses

func (t *LeafTag) SetClasses(cs []string)

func (*LeafTag) SetID

func (t *LeafTag) SetID(s string)

func (*LeafTag) Validate

func (t *LeafTag) Validate() error

func (*LeafTag) VerifyElementCount

func (t *LeafTag) VerifyElementCount(i int, ecKey string) error

func (*LeafTag) Write

func (t *LeafTag) Write(indent string, nl, tab string) string
type Link struct {
	// contains filtered or unexported fields
}

func (*Link) AppendChild

func (t *Link) AppendChild(child Tag)

func (*Link) Attributes

func (t *Link) Attributes() *tokens.StringDict

returns ptr, so attributes can be changed in-place

func (*Link) Children

func (t *Link) Children() []Tag

func (*Link) CollectScripts

func (t *Link) CollectScripts(idMap IDMap, classMap ClassMap, bundle *scripts.InlineBundle) error

func (*Link) Context

func (t *Link) Context() context.Context

func (*Link) DeleteAllChildren

func (t *Link) DeleteAllChildren() error

func (*Link) DeleteChild

func (t *Link) DeleteChild(i int) error

func (*Link) FoldDummy

func (t *Link) FoldDummy()

func (*Link) GetID

func (t *Link) GetID() string

func (*Link) InsertChild

func (t *Link) InsertChild(i int, child Tag) error

func (*Link) Name

func (t *Link) Name() string

func (*Link) NumChildren

func (t *Link) NumChildren() int

func (*Link) Parent

func (t *Link) Parent() Tag

func (*Link) RegisterParent

func (t *Link) RegisterParent(p Tag)

func (*Link) SetID

func (t *Link) SetID(id string)

func (*Link) Validate

func (t *Link) Validate() error

func (*Link) ValidateChildren

func (t *Link) ValidateChildren() error

func (*Link) VerifyElementCount

func (t *Link) VerifyElementCount(i int, ecKey string) error

func (*Link) Write

func (t *Link) Write(indent string, nl, tab string) string

type LoaderScript

type LoaderScript struct {
	LeafTag
	// contains filtered or unexported fields
}

func NewLoaderScript

func NewLoaderScript(content string, ctx context.Context) (*LoaderScript, error)

func (*LoaderScript) Write

func (t *LoaderScript) Write(indent string, nl, tab string) string

type Meta

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

func (*Meta) AppendChild

func (t *Meta) AppendChild(child Tag)

func (*Meta) Attributes

func (t *Meta) Attributes() *tokens.StringDict

returns ptr, so attributes can be changed in-place

func (*Meta) Children

func (t *Meta) Children() []Tag

func (*Meta) CollectScripts

func (t *Meta) CollectScripts(idMap IDMap, classMap ClassMap, bundle *scripts.InlineBundle) error

func (*Meta) Context

func (t *Meta) Context() context.Context

func (*Meta) DeleteAllChildren

func (t *Meta) DeleteAllChildren() error

func (*Meta) DeleteChild

func (t *Meta) DeleteChild(i int) error

func (*Meta) FoldDummy

func (t *Meta) FoldDummy()

func (*Meta) GetID

func (t *Meta) GetID() string

func (*Meta) InsertChild

func (t *Meta) InsertChild(i int, child Tag) error

func (*Meta) Name

func (t *Meta) Name() string

func (*Meta) NumChildren

func (t *Meta) NumChildren() int

func (*Meta) Parent

func (t *Meta) Parent() Tag

func (*Meta) RegisterParent

func (t *Meta) RegisterParent(p Tag)

func (*Meta) SetID

func (t *Meta) SetID(id string)

func (*Meta) Validate

func (t *Meta) Validate() error

func (*Meta) ValidateChildren

func (t *Meta) ValidateChildren() error

func (*Meta) VerifyElementCount

func (t *Meta) VerifyElementCount(i int, ecKey string) error

func (*Meta) Write

func (t *Meta) Write(indent string, nl, tab string) string

type NoChildrenBuilder

type NoChildrenBuilder struct {
}

func (*NoChildrenBuilder) Build

func (b *NoChildrenBuilder) Build(key string, attr *tokens.StringDict, ctx context.Context) (Tag, error)

type Root

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

doesn't need to implement Tag interface TODO: maybe it is more convenient if it DOES implement the Tag interface

func NewRoot

func NewRoot(ctx context.Context) *Root

func (*Root) AppendChild

func (t *Root) AppendChild(child Tag)

func (*Root) ApplyControl

func (t *Root) ApplyControl(control string, jsUrl string) error

func (*Root) Attributes

func (t *Root) Attributes() *tokens.StringDict

returns ptr, so attributes can be changed in-place

func (*Root) Children

func (t *Root) Children() []Tag

func (*Root) CollectClasses

func (t *Root) CollectClasses(classMap ClassMap) error

func (*Root) CollectIDs

func (t *Root) CollectIDs(idMap IDMap) error

func (*Root) CollectScripts

func (t *Root) CollectScripts(idMap IDMap, classMap ClassMap, bundle *scripts.InlineBundle) error

dummy is just to respect the interface

func (*Root) CollectStyles

func (t *Root) CollectStyles(idMap IDMap, classMap ClassMap, cssUrl string) ([][]string, error)

returns the globally bundleable styles

func (*Root) Context

func (t *Root) Context() context.Context

func (*Root) DeleteAllChildren

func (t *Root) DeleteAllChildren() error

func (*Root) DeleteChild

func (t *Root) DeleteChild(i int) error

func (*Root) FoldDummy

func (t *Root) FoldDummy()

func (*Root) GetID

func (t *Root) GetID() string

func (*Root) IncludeControl

func (t *Root) IncludeControl(code string) error

func (*Root) IncludeStyle

func (t *Root) IncludeStyle(styles string) error

func (*Root) InsertChild

func (t *Root) InsertChild(i int, child Tag) error

func (*Root) Name

func (t *Root) Name() string

func (*Root) NumChildren

func (t *Root) NumChildren() int

func (*Root) Parent

func (t *Root) Parent() Tag

func (*Root) RegisterParent

func (t *Root) RegisterParent(p Tag)

func (*Root) SetID

func (t *Root) SetID(id string)

func (*Root) Validate

func (t *Root) Validate() error

func (*Root) ValidateChildren

func (t *Root) ValidateChildren() error

func (*Root) VerifyElementCount

func (t *Root) VerifyElementCount(i int, ecKey string) error

func (*Root) Write

func (t *Root) Write(indent string, nl string, tab string) string

dummy args are just for interface

type SVG

type SVG struct {
	VisibleTagData
}

func (*SVG) AppendChild

func (t *SVG) AppendChild(child Tag)

func (*SVG) Attributes

func (t *SVG) Attributes() *tokens.StringDict

returns ptr, so attributes can be changed in-place

func (*SVG) Children

func (t *SVG) Children() []Tag

func (*SVG) CollectScripts

func (t *SVG) CollectScripts(idMap IDMap, classMap ClassMap, bundle *scripts.InlineBundle) error

func (*SVG) Compress

func (t *SVG) Compress(vb SVGViewBox)

func (*SVG) Context

func (t *SVG) Context() context.Context

func (*SVG) DeleteAllChildren

func (t *SVG) DeleteAllChildren() error

func (*SVG) DeleteChild

func (t *SVG) DeleteChild(i int) error

func (*SVG) FoldDummy

func (t *SVG) FoldDummy()

func (*SVG) GetID

func (t *SVG) GetID() string

func (*SVG) InsertChild

func (t *SVG) InsertChild(i int, child Tag) error

func (*SVG) Minify

func (t *SVG) Minify() bool

func (*SVG) Name

func (t *SVG) Name() string

func (*SVG) NumChildren

func (t *SVG) NumChildren() int

func (*SVG) Parent

func (t *SVG) Parent() Tag

func (*SVG) RegisterParent

func (t *SVG) RegisterParent(p Tag)

func (*SVG) SetID

func (t *SVG) SetID(id string)

func (*SVG) Validate

func (t *SVG) Validate() error

func (*SVG) ValidateChildren

func (t *SVG) ValidateChildren() error

func (*SVG) VerifyElementCount

func (t *SVG) VerifyElementCount(i int, ecKey string) error

func (*SVG) Write

func (t *SVG) Write(indent string, nl, tab string) string

type SVGRoot

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

func NewSVGRoot

func NewSVGRoot(ctx context.Context) *SVGRoot

func (*SVGRoot) AppendChild

func (t *SVGRoot) AppendChild(child Tag)

func (*SVGRoot) Attributes

func (t *SVGRoot) Attributes() *tokens.StringDict

returns ptr, so attributes can be changed in-place

func (*SVGRoot) Children

func (t *SVGRoot) Children() []Tag

func (*SVGRoot) CollectScripts

func (t *SVGRoot) CollectScripts(idMap IDMap, classMap ClassMap, bundle *scripts.InlineBundle) error

func (*SVGRoot) Context

func (t *SVGRoot) Context() context.Context

func (*SVGRoot) DeleteAllChildren

func (t *SVGRoot) DeleteAllChildren() error

func (*SVGRoot) DeleteChild

func (t *SVGRoot) DeleteChild(i int) error

func (*SVGRoot) FoldDummy

func (t *SVGRoot) FoldDummy()

func (*SVGRoot) GetID

func (t *SVGRoot) GetID() string

func (*SVGRoot) InsertChild

func (t *SVGRoot) InsertChild(i int, child Tag) error

func (*SVGRoot) Minify

func (t *SVGRoot) Minify()

func (*SVGRoot) Name

func (t *SVGRoot) Name() string

func (*SVGRoot) NumChildren

func (t *SVGRoot) NumChildren() int

func (*SVGRoot) Parent

func (t *SVGRoot) Parent() Tag

func (*SVGRoot) RegisterParent

func (t *SVGRoot) RegisterParent(p Tag)

func (*SVGRoot) SetID

func (t *SVGRoot) SetID(id string)

func (*SVGRoot) Validate

func (t *SVGRoot) Validate() error

func (*SVGRoot) ValidateChildren

func (t *SVGRoot) ValidateChildren() error

func (*SVGRoot) VerifyElementCount

func (t *SVGRoot) VerifyElementCount(i int, ecKey string) error

func (*SVGRoot) Write

func (t *SVGRoot) Write(indent string, nl string, tab string) string

type SVGTag

type SVGTag interface {
	Tag

	// TODO: take g transforms into account when going down the tree
	Compress(vb SVGViewBox)

	// returns true if can be removed
	Minify() bool // for svg documents created by drawing programs
}

func NewSVGDummy

func NewSVGDummy(attr *tokens.StringDict, ctx context.Context) (SVGTag, error)

type SVGTagData

type SVGTagData struct {
	VisibleTagData
}

func NewSVGTagData

func NewSVGTagData(name string, attr *tokens.StringDict, ctx context.Context) (SVGTagData, error)

func (*SVGTagData) AppendChild

func (t *SVGTagData) AppendChild(child Tag)

func (*SVGTagData) Attributes

func (t *SVGTagData) Attributes() *tokens.StringDict

returns ptr, so attributes can be changed in-place

func (*SVGTagData) Children

func (t *SVGTagData) Children() []Tag

func (*SVGTagData) CollectScripts

func (t *SVGTagData) CollectScripts(idMap IDMap, classMap ClassMap, bundle *scripts.InlineBundle) error

func (*SVGTagData) Compress

func (t *SVGTagData) Compress(vb SVGViewBox)

func (*SVGTagData) Context

func (t *SVGTagData) Context() context.Context

func (*SVGTagData) DeleteAllChildren

func (t *SVGTagData) DeleteAllChildren() error

func (*SVGTagData) DeleteChild

func (t *SVGTagData) DeleteChild(i int) error

func (*SVGTagData) FoldDummy

func (t *SVGTagData) FoldDummy()

func (*SVGTagData) GetID

func (t *SVGTagData) GetID() string

func (*SVGTagData) InsertChild

func (t *SVGTagData) InsertChild(i int, child Tag) error

func (*SVGTagData) Minify

func (t *SVGTagData) Minify() bool

func (*SVGTagData) Name

func (t *SVGTagData) Name() string

func (*SVGTagData) NumChildren

func (t *SVGTagData) NumChildren() int

func (*SVGTagData) Parent

func (t *SVGTagData) Parent() Tag

func (*SVGTagData) RegisterParent

func (t *SVGTagData) RegisterParent(p Tag)

func (*SVGTagData) SetID

func (t *SVGTagData) SetID(id string)

func (*SVGTagData) Validate

func (t *SVGTagData) Validate() error

func (*SVGTagData) ValidateChildren

func (t *SVGTagData) ValidateChildren() error

func (*SVGTagData) VerifyElementCount

func (t *SVGTagData) VerifyElementCount(i int, ecKey string) error

type SVGViewBox

type SVGViewBox interface {
	CompressXY(x float64, y float64) (float64, float64)
	CompressX(x float64) float64
	CompressY(y float64) float64
	CompressDXDY(dx float64, dy float64) (float64, float64)
	CompressDX(dx float64) float64
	CompressDY(dy float64) float64
	CompressScalar(s float64) float64

	CompressSelf() string
}

func NewViewBoxFromString

func NewViewBoxFromString(s string, ctx context.Context) (SVGViewBox, error)

type SVGViewBoxData

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

func (*SVGViewBoxData) CompressDX

func (vb *SVGViewBoxData) CompressDX(dx float64) float64

func (*SVGViewBoxData) CompressDXDY

func (vb *SVGViewBoxData) CompressDXDY(dx float64, dy float64) (float64, float64)

func (*SVGViewBoxData) CompressDY

func (vb *SVGViewBoxData) CompressDY(dy float64) float64

func (*SVGViewBoxData) CompressScalar

func (vb *SVGViewBoxData) CompressScalar(s float64) float64

func (*SVGViewBoxData) CompressSelf

func (vb *SVGViewBoxData) CompressSelf() string

func (*SVGViewBoxData) CompressX

func (vb *SVGViewBoxData) CompressX(x float64) float64

func (*SVGViewBoxData) CompressXY

func (vb *SVGViewBoxData) CompressXY(x float64, y float64) (float64, float64)

func (*SVGViewBoxData) CompressY

func (vb *SVGViewBoxData) CompressY(y float64) float64

type Script

type Script struct {
	LeafTag
	// contains filtered or unexported fields
}

reuse tagData's write functions

func (*Script) CollectScripts

func (t *Script) CollectScripts(idMap IDMap, classMap ClassMap, bundle *scripts.InlineBundle) error

func (*Script) Write

func (t *Script) Write(indent string, nl, tab string) string

type SrcScript

type SrcScript struct {
	LeafTag
	// contains filtered or unexported fields
}

func NewSrcScript

func NewSrcScript(src string, ctx context.Context) (*SrcScript, error)

func (*SrcScript) Write

func (t *SrcScript) Write(indent string, nl, tab string) string

type Style

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

func (*Style) AppendChild

func (t *Style) AppendChild(child Tag)

func (*Style) Attributes

func (t *Style) Attributes() *tokens.StringDict

returns ptr, so attributes can be changed in-place

func (*Style) Children

func (t *Style) Children() []Tag

func (*Style) CollectClasses

func (t *Style) CollectClasses(ClassMap) error

func (*Style) CollectIDs

func (t *Style) CollectIDs(IDMap) error

func (*Style) CollectScripts

func (t *Style) CollectScripts(idMap IDMap, classMap ClassMap, bundle *scripts.InlineBundle) error

func (*Style) CollectStyles

func (t *Style) CollectStyles(styles.DocSheet) error

func (*Style) Compress

func (t *Style) Compress(vb SVGViewBox)

implement SVGTag interface

func (*Style) Context

func (t *Style) Context() context.Context

func (*Style) DeleteAllChildren

func (t *Style) DeleteAllChildren() error

func (*Style) DeleteChild

func (t *Style) DeleteChild(i int) error

func (*Style) FoldDummy

func (t *Style) FoldDummy()

func (*Style) GetID

func (t *Style) GetID() string

func (*Style) InsertChild

func (t *Style) InsertChild(i int, child Tag) error

func (*Style) Minify

func (t *Style) Minify() bool

func (*Style) Name

func (t *Style) Name() string

func (*Style) NumChildren

func (t *Style) NumChildren() int

func (*Style) Parent

func (t *Style) Parent() Tag

func (*Style) RegisterParent

func (t *Style) RegisterParent(p Tag)

func (*Style) SetID

func (t *Style) SetID(id string)

func (*Style) Validate

func (t *Style) Validate() error

func (*Style) ValidateChildren

func (t *Style) ValidateChildren() error

func (*Style) VerifyElementCount

func (t *Style) VerifyElementCount(i int, ecKey string) error

func (*Style) Write

func (t *Style) Write(indent string, nl, tab string) string

type Tag

type Tag interface {
	Name() string
	Attributes() *tokens.StringDict

	NumChildren() int
	AppendChild(child Tag)
	InsertChild(i int, child Tag) error // original i is shifted right
	DeleteChild(i int) error
	DeleteAllChildren() error

	FoldDummy()
	VerifyElementCount(i int, ecKey string) error

	Children() []Tag
	Context() context.Context

	RegisterParent(Tag)
	Parent() Tag

	CollectScripts(idMap IDMap, classMap ClassMap, bundle *scripts.InlineBundle) error

	Validate() error
	Write(indent string, nl, tab string) string
	GetID() string
	SetID(id string)
}

func BuildTag

func BuildTag(key string, attr *tokens.StringDict, ctx context.Context) (Tag, error)

func NewBody

func NewBody(attr *tokens.StringDict, ctx context.Context) (Tag, error)

func NewBr

func NewBr(attr *tokens.StringDict, ctx context.Context) (Tag, error)

func NewDiv

func NewDiv(attr *tokens.StringDict, ctx context.Context) (Tag, error)

func NewDocType

func NewDocType(attr *tokens.StringDict, ctx context.Context) (Tag, error)

func NewDummy

func NewDummy(attr *tokens.StringDict, ctx context.Context) (Tag, error)

func NewGeneric

func NewGeneric(key string, attr *tokens.StringDict, inline bool, ctx context.Context) (Tag, error)

func NewHTML

func NewHTML(attr *tokens.StringDict, ctx context.Context) (Tag, error)

func NewHead

func NewHead(attr *tokens.StringDict, ctx context.Context) (Tag, error)

func NewImg

func NewImg(attr *tokens.StringDict, ctx context.Context) (Tag, error)

func NewInput

func NewInput(attr *tokens.StringDict, ctx context.Context) (Tag, error)
func NewLink(attr *tokens.StringDict, ctx context.Context) (Tag, error)

func NewMeta

func NewMeta(attr *tokens.StringDict, ctx context.Context) (Tag, error)

func NewSVG

func NewSVG(attr *tokens.StringDict, ctx context.Context) (Tag, error)

func NewScript

func NewScript(attr *tokens.StringDict, content string, ctx context.Context) (Tag, error)

func NewStyle

func NewStyle(attr *tokens.StringDict, content string, ctx context.Context) (Tag, error)
func NewStyleSheetLink(relPath string, ctx context.Context) (Tag, error)

func NewTitle

func NewTitle(attr *tokens.StringDict, ctx context.Context) (Tag, error)

func NewXMLHeader

func NewXMLHeader(attr *tokens.StringDict, ctx context.Context) (Tag, error)

type TagBuilder

type TagBuilder interface {
	Build(key string, attr *tokens.StringDict, ctx context.Context) (Tag, error)
}

type Text

type Text struct {
	LeafTag
	// contains filtered or unexported fields
}

func NewText

func NewText(value string, ctx context.Context) *Text

func NewTextValue

func NewTextValue(value string, ctx context.Context) Text

func (*Text) Compress

func (t *Text) Compress(vb SVGViewBox)

func (*Text) Minify

func (t *Text) Minify() bool

func (*Text) Value

func (t *Text) Value() string

func (*Text) Write

func (t *Text) Write(indent string, nl, tab string) string

type Title

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

func (*Title) AppendChild

func (t *Title) AppendChild(child Tag)

func (*Title) Attributes

func (t *Title) Attributes() *tokens.StringDict

returns ptr, so attributes can be changed in-place

func (*Title) Children

func (t *Title) Children() []Tag

func (*Title) CollectScripts

func (t *Title) CollectScripts(idMap IDMap, classMap ClassMap, bundle *scripts.InlineBundle) error

func (*Title) Context

func (t *Title) Context() context.Context

func (*Title) DeleteAllChildren

func (t *Title) DeleteAllChildren() error

func (*Title) DeleteChild

func (t *Title) DeleteChild(i int) error

func (*Title) FoldDummy

func (t *Title) FoldDummy()

func (*Title) GetID

func (t *Title) GetID() string

func (*Title) InsertChild

func (t *Title) InsertChild(i int, child Tag) error

func (*Title) Name

func (t *Title) Name() string

func (*Title) NumChildren

func (t *Title) NumChildren() int

func (*Title) Parent

func (t *Title) Parent() Tag

func (*Title) RegisterParent

func (t *Title) RegisterParent(p Tag)

func (*Title) SetID

func (t *Title) SetID(id string)

func (*Title) Validate

func (t *Title) Validate() error

func (*Title) ValidateChildren

func (t *Title) ValidateChildren() error

func (*Title) VerifyElementCount

func (t *Title) VerifyElementCount(i int, ecKey string) error

func (*Title) Write

func (t *Title) Write(indent string, nl, tab string) string

type VisibleTag

type VisibleTag interface {
	styles.StyledTag

	Context() context.Context

	CollectStylesTag
}

type VisibleTagData

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

func NewVisibleTag

func NewVisibleTag(name string, selfClosing bool, attr *tokens.StringDict, ctx context.Context) (VisibleTagData, error)

func (*VisibleTagData) AppendChild

func (t *VisibleTagData) AppendChild(child Tag)

func (*VisibleTagData) Attributes

func (t *VisibleTagData) Attributes() *tokens.StringDict

returns ptr, so attributes can be changed in-place

func (*VisibleTagData) Children

func (t *VisibleTagData) Children() []Tag

func (*VisibleTagData) CollectClasses

func (t *VisibleTagData) CollectClasses(classMap ClassMap) error

func (*VisibleTagData) CollectIDs

func (t *VisibleTagData) CollectIDs(idMap IDMap) error

func (*VisibleTagData) CollectScripts

func (t *VisibleTagData) CollectScripts(idMap IDMap, classMap ClassMap, bundle *scripts.InlineBundle) error

func (*VisibleTagData) CollectStyles

func (t *VisibleTagData) CollectStyles(ss styles.DocSheet) error

func (*VisibleTagData) Context

func (t *VisibleTagData) Context() context.Context

func (*VisibleTagData) DeleteAllChildren

func (t *VisibleTagData) DeleteAllChildren() error

func (*VisibleTagData) DeleteChild

func (t *VisibleTagData) DeleteChild(i int) error

func (*VisibleTagData) FoldDummy

func (t *VisibleTagData) FoldDummy()

func (*VisibleTagData) GetClasses

func (t *VisibleTagData) GetClasses() []string

func (*VisibleTagData) GetID

func (t *VisibleTagData) GetID() string

func (*VisibleTagData) InnerHTML

func (t *VisibleTagData) InnerHTML() string

func (*VisibleTagData) InsertChild

func (t *VisibleTagData) InsertChild(i int, child Tag) error

func (*VisibleTagData) Name

func (t *VisibleTagData) Name() string

func (*VisibleTagData) NumChildren

func (t *VisibleTagData) NumChildren() int

func (*VisibleTagData) Parent

func (t *VisibleTagData) Parent() Tag

func (*VisibleTagData) RegisterParent

func (t *VisibleTagData) RegisterParent(p Tag)

func (*VisibleTagData) RemoveTmpAttribute

func (t *VisibleTagData) RemoveTmpAttribute(key string)

func (*VisibleTagData) SetClasses

func (t *VisibleTagData) SetClasses(c []string)

func (*VisibleTagData) SetID

func (t *VisibleTagData) SetID(id string)

func (*VisibleTagData) SetTmpAttribute

func (t *VisibleTagData) SetTmpAttribute(key string, valueToken tokens.Token)

func (*VisibleTagData) ToJSType

func (t *VisibleTagData) ToJSType() string

func (*VisibleTagData) ValidateChildren

func (t *VisibleTagData) ValidateChildren() error

func (*VisibleTagData) VerifyElementCount

func (t *VisibleTagData) VerifyElementCount(i int, ecKey string) error

func (*VisibleTagData) Write

func (t *VisibleTagData) Write(indent string, nl, tab string) string

func (*VisibleTagData) WriteWrappedAutoHref

func (t *VisibleTagData) WriteWrappedAutoHref(indent string, nl, tab string) string

type XMLHeader

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

func (*XMLHeader) AppendChild

func (t *XMLHeader) AppendChild(child Tag)

func (*XMLHeader) Attributes

func (t *XMLHeader) Attributes() *tokens.StringDict

returns ptr, so attributes can be changed in-place

func (*XMLHeader) Children

func (t *XMLHeader) Children() []Tag

func (*XMLHeader) CollectScripts

func (t *XMLHeader) CollectScripts(idMap IDMap, classMap ClassMap, bundle *scripts.InlineBundle) error

func (*XMLHeader) Context

func (t *XMLHeader) Context() context.Context

func (*XMLHeader) DeleteAllChildren

func (t *XMLHeader) DeleteAllChildren() error

func (*XMLHeader) DeleteChild

func (t *XMLHeader) DeleteChild(i int) error

func (*XMLHeader) FoldDummy

func (t *XMLHeader) FoldDummy()

func (*XMLHeader) GetID

func (t *XMLHeader) GetID() string

func (*XMLHeader) InsertChild

func (t *XMLHeader) InsertChild(i int, child Tag) error

func (*XMLHeader) Name

func (t *XMLHeader) Name() string

func (*XMLHeader) NumChildren

func (t *XMLHeader) NumChildren() int

func (*XMLHeader) Parent

func (t *XMLHeader) Parent() Tag

func (*XMLHeader) RegisterParent

func (t *XMLHeader) RegisterParent(p Tag)

func (*XMLHeader) SetID

func (t *XMLHeader) SetID(id string)

func (*XMLHeader) Validate

func (t *XMLHeader) Validate() error

func (*XMLHeader) ValidateChildren

func (t *XMLHeader) ValidateChildren() error

func (*XMLHeader) VerifyElementCount

func (t *XMLHeader) VerifyElementCount(i int, ecKey string) error

func (*XMLHeader) Write

func (t *XMLHeader) Write(indent string, nl, tab string) string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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