trees

package
v2.0.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2017 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package trees is a work inspired by a experiemental package by now authors of Vecty(github.com/gopherjs/vecty), although the provide similar API, the underline nature of how gutrees behave and function is heavily different from its original. It provides a markup style that is seperate from the browser DOM yet capable of being generated into one and spots a quick virtual diffing system that makes it easy to upgrade existing markup with less cycles.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Hide will set any markup top level root into a style of display none.
	Hide hideMarkup

	// Show will set any markup top level root into a style of display block.
	Show showMarkup
)
View Source
var ErrNotAttr = errors.New("Value type is not n Attribute type")

ErrNotAttr relating to the attribute types

View Source
var ErrNotElem = errors.New("*Markup is not a *Markup type")

ErrNotElem is returned when the markup type does not match the *Markup type

View Source
var ErrNotFound = errors.New("Item not found")

ErrNotFound relating to the attribute types

View Source
var ErrNotMarkup = errors.New("Value does not match *Markup interface types")

ErrNotMarkup is returned when the value/pointer type does not match the *Markup interface type

View Source
var ErrNotStyle = errors.New("Value type is not a Style type")

ErrNotStyle relating to the style types

View Source
var ErrNotText = errors.New("*Markup is not a *Text type")

ErrNotText is returned when the markup type is not a text markup

View Source
var Query queryCtrl

Query defines a package level variable for access the query interface which handles running css queries on markup structures.

SimpleElementWriter provides a default writer using the basic attribute and style writers

Functions

func AttrContains

func AttrContains(e Attributes, f, val string) bool

AttrContains returns the attributes that have the specified text within the naming convention and if it also contains the set val if not an empty "", NOTE: string.Contains is used

func Augment

func Augment(root *Markup, m ...*Markup)

Augment adds new markup to an the root if its Element

func EqualAttributes

func EqualAttributes(e, em Attributes) bool

EqualAttributes returns true/false if the elements and the giving markup have equal attribute

func EqualStyles

func EqualStyles(e, em Styles) bool

EqualStyles returns true/false if the style values are all equal attribute.

func ParseTemplateInto

func ParseTemplateInto(root *Markup, markup string, binding interface{})

ParseTemplateInto parses the provided string has a template which is processed with the provided binding and passed into the root.

func ParseToRoot

func ParseToRoot(root *Markup, markup string)

ParseToRoot passes the markup generated from the markup added to the provided root.

func ParseTreeToText

func ParseTreeToText(markup string, withReturns bool) (io.WriterTo, error)

ParseTreeToText takes a string markup and returns a *Markup which contains the full structure transpiled into the gutrees markup block structure.

func RandString

func RandString(n int) string

RandString generates a set of random numbers of a set length

func ReplaceAttribute

func ReplaceAttribute(m Attributes, name string, val string)

ReplaceAttribute replaces a specific attribute with the given name with the supplied value.

func ReplaceORAddAttribute

func ReplaceORAddAttribute(m Properties, name string, val string)

ReplaceORAddAttribute replaces a specific attribute with the given name with the supplied value if not found it adds a new one if found and if the type does not match a *CSSStyle then it stops.

func ReplaceORAddStyle

func ReplaceORAddStyle(m Properties, name string, val string)

ReplaceORAddStyle replaces a specific style with the given name with the supplied value if not found it adds a new one if found and if the type does not match a *CSSStyle then it stops.

func ReplaceStyle

func ReplaceStyle(m Styles, name string, val string)

ReplaceStyle replaces a specific style with the given name with the supplied value.

func SetMode

func SetMode(ms Mode)

SetMode sets the working mode for the library printers.

func StyleContains

func StyleContains(e Styles, f, val string) bool

StyleContains returns the styles that contain the specified name and if the val is not empty then that contains the specified value also, note that strings NOTE: string.Contains is used

func Templated

func Templated(tml string, bind interface{}, processor func(string) string) (string, error)

Templated takes a giving string, parses into a template, runs against the processor and parses the provided result into a markup.

Types

type Appliable

type Appliable interface {
	Apply(*Markup)
}

Appliable define the interface specification for applying changes to elements elements in tree

type AppliableTarget

type AppliableTarget struct {
	Request  Appliable
	Target   string
	Multiple bool
}

AppliableTarget defines a struct which takes a giving appliable and target attempting to add the Appliable to the roots target child.

func ApplyIn

func ApplyIn(child Appliable, target string, multiple bool) AppliableTarget

ApplyIn adds the giving Appliable to the giving target/targets if multiple is set to true and many are found and returns the a new Appliable which will perform the action.

func (AppliableTarget) Apply

func (e AppliableTarget) Apply(em *Markup)

Apply will attempt to search for the target within the root and append to that giving child else ignoring the call.

type AttrPrinter

type AttrPrinter interface {
	Print([]Property) string
}

AttrPrinter defines a printer interface for writing out a Attribute objects into a string form

type AttrWriter

type AttrWriter struct{}

AttrWriter provides a concrete struct that meets the AttrPrinter interface

var SimpleAttrWriter AttrWriter

SimpleAttrWriter provides a basic attribute writer

func (AttrWriter) Print

func (m AttrWriter) Print(a []Property) string

Print returns a stringed repesentation of the attribute object

type Attribute

type Attribute struct {
	Name  string
	Value string
	After func(*Markup)
}

Attribute define the struct for attributes

func NewAttr

func NewAttr(name, val string) *Attribute

NewAttr returns a new attribute instance.

func NewAttrWith

func NewAttrWith(name, val string, after func(*Markup)) *Attribute

NewAttrWith returns a new attribute instance with a provided function to call to provide a after effect to the markup.

func (*Attribute) Apply

func (a *Attribute) Apply(e *Markup)

Apply applies a set change to the giving element attributes list

func (*Attribute) Clone

func (a *Attribute) Clone() Property

Clone replicates the attribute into a unique instance

func (*Attribute) Render

func (a *Attribute) Render() (string, string)

Render returns the key and value for this attribute rendered.

type Attributes

type Attributes interface {
	Attributes() []Property
}

Attributes defines an interface that returns a list of attributes.

type CSSStyle

type CSSStyle struct {
	Name  string
	Value string
}

CSSStyle define the style specification for element styles

func NewCSSStyle

func NewCSSStyle(name, val string) *CSSStyle

NewCSSStyle returns a new style instance

func (*CSSStyle) Apply

func (s *CSSStyle) Apply(e *Markup)

Apply applies a set change to the giving element style list

func (*CSSStyle) Clone

func (s *CSSStyle) Clone() Property

Clone replicates the style into a unique instance

func (*CSSStyle) Render

func (s *CSSStyle) Render() (string, string)

Render returns the key and value for this style rendered.

type ClassList

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

ClassList defines the list type for class lists.

func NewClassList

func NewClassList(c ...string) *ClassList

NewClassList returns a new ClassList instance.

func (*ClassList) Add

func (c *ClassList) Add(classes ...string)

Add adds a class name into the lists.

func (*ClassList) Apply

func (c *ClassList) Apply(em *Markup)

Apply checks for a class attribute

func (ClassList) Clone

func (c ClassList) Clone() Property

Clone replicates the lists of classnames.

func (*ClassList) Render

func (c *ClassList) Render() (string, string)

Render returns the key and value for this style rendered.

type Clonable

type Clonable interface {
	CopyTo(*Markup)
	Clone() *Markup
}

Clonable defines an interface for objects that can be cloned

type DeferredApply

type DeferredApply struct {
	Request Appliable
	Adders  []Appliable
}

DeferredApply will apply a giving set of values to a giving root.

func ApplyTo

func ApplyTo(child Appliable, children ...Appliable) DeferredApply

ApplyTo adds the giving Appliables to the target during calls to Apply.

func (DeferredApply) Apply

func (d DeferredApply) Apply(em *Markup)

Apply will attempt to search for the target within the root and append to that giving child else ignoring the call.

type ElementWriter

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

ElementWriter writes out the element out as a string matching the html tag rules

func NewElementWriter

func NewElementWriter(aw AttrPrinter, sw StylePrinter, tw TextPrinter) *ElementWriter

NewElementWriter returns a new writer for Element objects

func (*ElementWriter) Print

func (m *ElementWriter) Print(e *Markup) string

Print returns the string representation of the element

func (*ElementWriter) Write

func (m *ElementWriter) Write(ma *Markup) (string, error)

Write prints the giving *Markup as a string else returns an error.

type Event

type Event struct {
	Type                     string
	PreventDefault           bool
	StopPropagation          bool
	UseCapture               bool
	StopImmediatePropagation bool
	Tree                     *Markup
	Remove                   common.Remover
	// contains filtered or unexported fields
}

Event provide a meta registry for helps in registering events for dom markups which is translated to the nodes themselves

func NewEvent

func NewEvent(options ...EventOptions) *Event

NewEvent returns a event object that allows registering events to eventlisteners.

func (*Event) Apply

func (e *Event) Apply(ex *Markup)

Apply adds the event into the elements events lists

func (*Event) Clone

func (e *Event) Clone() *Event

Clone returns a new Event object from this.

func (*Event) EventJSON

func (e *Event) EventJSON() EventJSON

EventJSON returns the event json structure which represent the giving event.

func (*Event) EventName

func (e *Event) EventName() string

EventName returns the giving name of the event.

func (*Event) EventSelector

func (e *Event) EventSelector() string

EventSelector returns the selector for this events tree.

func (*Event) ID

func (e *Event) ID() string

ID returns the uique event id string for the event.

func (*Event) ParentEventSelector

func (e *Event) ParentEventSelector() string

ParentEventSelector returns the parent selector for this events markup tree.

func (*Event) String

func (e *Event) String() string

String returns the string representation of the giving event.

func (*Event) Target

func (e *Event) Target() string

Target returns the target of the giving event.

type EventJSON

type EventJSON struct {
	ParentSelector           string `json:"ParentSelector"`
	EventSelector            string `json:"EventSelector"`
	EventName                string `json:"EventName"`
	Event                    string `json:"Event"`
	PreventDefault           bool   `json:"PreventDefault"`
	StopPropagation          bool   `json:"StopPropagation"`
	UseCapture               bool   `json:"UseCapture"`
	StopImmediatePropagation bool   `json:"StopImmediatePropagation"`
}

EventJSON defines a struct which contains the giving events and and tree of the giving tree.

type EventOptions

type EventOptions func(*Event)

EventOptions defines a function type used to apply specific operations to a Event object.

func EventTarget

func EventTarget(target string) EventOptions

EventTarget sets the type of event.

func EventType

func EventType(eventType string) EventOptions

EventType sets the type of event.

func PreventDefault

func PreventDefault(state bool) EventOptions

PreventDefault sets the type of event.

func StopImmediatePropagation

func StopImmediatePropagation(state bool) EventOptions

StopImmediatePropagation sets the type of event.

func StopPropagation

func StopPropagation(state bool) EventOptions

StopPropagation sets the type of event.

func UseCapture

func UseCapture(state bool) EventOptions

UseCapture sets the type of event.

type Events

type Events interface {
	Events() []Event
}

Events defines an interface that returns a list of events.

type HideMorpher

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

HideMorpher defines a morpher which sets the giving markup as removed.

func (*HideMorpher) Morph

func (r *HideMorpher) Morph(m *Markup) *Markup

Morph sets the markup received as removed.

func (*HideMorpher) Off

func (r *HideMorpher) Off(m interface{})

Off switches the state of the morpher to set hidden state to be true.

func (*HideMorpher) On

func (r *HideMorpher) On(m interface{})

On switches the state of the morpher out of a hidden state to be true.

type Markup

type Markup struct {
	ID string
	// contains filtered or unexported fields
}

Markup represent a concrete implementation of a element node.

func CSSStylesheet

func CSSStylesheet(styles interface{}, bind interface{}, ext *css.Rule, plain bool) *Markup

CSSStylesheet provides a function that takes style rules which returns a stylesheet embeded into the provided element parent and is built on the gu/css package which collects necessary details from its parent to only target where it gets mounted.

func ElementsUsingStyle

func ElementsUsingStyle(root *Markup, key string, val string) []*Markup

ElementsUsingStyle returns the children within the element matching the stlye restrictions passed. NOTE: is uses StyleContains

func ElementsWithAttr

func ElementsWithAttr(root *Markup, key string, val string) []*Markup

ElementsWithAttr returns the children within the element matching the stlye restrictions passed. NOTE: is uses AttrContains

func ElementsWithTag

func ElementsWithTag(root *Markup, tag string) []*Markup

ElementsWithTag returns elements matching the tag type in the parent markup children list only without going deeper into children's children lists.

func If

func If(state bool, m func() *Markup) *Markup

If returns the markup when the giving state is true.

func MarkdownTemplate

func MarkdownTemplate(tml string, bind interface{}) *Markup

MarkdownTemplate returns a markup generated from a markup down string which is built into a markup. If an error occured, it will be turned into an error tag with the contents of the error.

func NewMarkup

func NewMarkup(tag string, autoClose bool) *Markup

NewMarkup returns a new element instance giving the specified name which is used as a tag name.

func NewText

func NewText(txt string, dl ...interface{}) *Markup

NewText returns a new Text instance element

func ParseAndFirst

func ParseAndFirst(markup string) *Markup

ParseAndFirst expects the markup provided to only have one root element which will be returned.

func ParseAsRoot

func ParseAsRoot(root string, markup string) *Markup

ParseAsRoot returns the markup generated from the provided markup, returning them as children of the provided root.

func ParseFirstOrMakeRoot

func ParseFirstOrMakeRoot(markup string) *Markup

ParseFirstOrMakeRoot attempts to parse the giving markup and returns the element if only one else creates a div and adds all children as part of div.

func ParseTemplate

func ParseTemplate(markup string, binding interface{}) []*Markup

ParseTemplate parses the provided string has a template which is processed with the provided binding.

func ParseTree

func ParseTree(markup string) []*Markup

ParseTree takes a string markup and returns a *Markup which contains the full structure transpiled into the gutrees markup block structure.

func When

func When(state bool, first, other *Markup) *Markup

When returns the first or other markup when the giving state is false or true.

func (*Markup) AddAttribute

func (e *Markup) AddAttribute(p Property)

AddAttribute adds a property to the attribute property list.

func (*Markup) AddChild

func (e *Markup) AddChild(child ...*Markup)

AddChild adds a new markup as the children of this element

func (*Markup) AddEvent

func (e *Markup) AddEvent(ev Event)

AddEvent adds an event into the event list for this element.

func (*Markup) AddMorpher

func (e *Markup) AddMorpher(m ...Morpher)

AddMorpher adds the provided morphers into the elements lists.

func (*Markup) AddStyle

func (e *Markup) AddStyle(p Property)

AddStyle adds a property to the style property list.

func (*Markup) Apply

func (e *Markup) Apply(em *Markup)

Apply adds the giving element into the current elements children tree

func (*Markup) ApplyChildren

func (e *Markup) ApplyChildren(em *Markup)

ApplyChildren applies the internal children of the markup to the provided parent.

func (*Markup) ApplyMorphers

func (e *Markup) ApplyMorphers() *Markup

ApplyMorphers calls all elemental morphers sequentially applying them to the element and passes the result as the input of the next morpher unless. If any morpher returns nil, then the element is reused again until all morphers are called.

func (*Markup) Attributes

func (e *Markup) Attributes() []Property

Attributes return the internal attribute list of the element

func (*Markup) AutoClosed

func (e *Markup) AutoClosed() bool

AutoClosed returns true/false if this element uses a </> or a <></> tag convention

func (*Markup) Children

func (e *Markup) Children() []*Markup

Children returns the children list for the element

func (*Markup) Clean

func (e *Markup) Clean()

Clean cleans out all internal markup marked as removable.

func (*Markup) Clone

func (e *Markup) Clone() *Markup

Clone makes a new copy of the markup structure

func (*Markup) CopyTo

func (e *Markup) CopyTo(co *Markup)

CopyTo transfers all attributes to a giving root from the called base.

func (*Markup) EHTML

func (e *Markup) EHTML() template.HTML

EHTML returns the html string wrapped by a template.HTML type to avoid getting escaped by go templates. The returned html is rendered using the default SimpleElementWriter and represents the DOM of the giving element.

func (*Markup) EachChild

func (e *Markup) EachChild(fn func(*Markup))

EachChild iterates all children from this giving root down with all childrens allowing the callback to process the child has needed.

func (*Markup) EachEvent

func (e *Markup) EachEvent(fn func(*Event, *Markup))

EachEvent iterates all events from this giving root down with all childrens allowing the callback to process the events has needed.

func (*Markup) Empty

func (e *Markup) Empty()

Empty resets the elements children list as 0 length

func (*Markup) EventID

func (e *Markup) EventID() string

EventID returns the selector used for tagging events for a markup.

func (*Markup) Events

func (e *Markup) Events() []Event

Events return the elements events

func (*Markup) FirstChild

func (e *Markup) FirstChild() *Markup

FirstChild returns the first child in the markup children list.

func (*Markup) HTML

func (e *Markup) HTML() string

HTML returns the html string representing the DOM of the giving element. The returned html is rendered using the default SimpleElementWriter.

func (*Markup) Hash

func (e *Markup) Hash() string

Hash returns the current hash of the Element

func (*Markup) IDSelector

func (e *Markup) IDSelector(useParent bool) string

IDSelector returns the unique selector for the giving markup.

func (*Markup) LastChild

func (e *Markup) LastChild() *Markup

LastChild returns the last child in the markup children list.

func (*Markup) MarshalJSON

func (e *Markup) MarshalJSON() ([]byte, error)

MarshalJSON returns the html representation of the giving markup.

func (*Markup) Morphers

func (e *Markup) Morphers() []Morpher

Morphers returns the slice of Morphers used by this markup.

func (*Markup) Name

func (e *Markup) Name() string

Name returns the tag name of the element

func (*Markup) NthChild

func (e *Markup) NthChild(index int) *Markup

NthChild returns the giving child at the index position.

func (*Markup) Reconcile

func (e *Markup) Reconcile(em *Markup) bool

Reconcile takes a old markup and reconciles its uid and its children with these information,it returns a true/false telling the parent if the children swapped hashes. The reconcilation uses the order in which elements are added, if the order and element types are same then the uid are swapped, else it firsts checks the element type, but if not the same adds the old one into the new list as removed then continues the check. The system takes position of elements in the old and new as very important and I cant stress this enough, "Element Positioning" in the markup are very important, If a Anchor was the first element in the old render and the next pass returns a Div in the position for that Anchor in the new render, the old Anchor will be marked as removed and will be removed from the dom and ignored by the writers. When two elements position are same and their types are the same then a checkup process is done using the elements attributes, this is done to determine if the hash value of the new should be swapped with the old. We cant use style properties here because they are the most volatile of the set and will periodically be either changed and returned to normal values eg display: none to display: block and vise-versa, so only attributes are used in the check process.

func (*Markup) Remove

func (e *Markup) Remove()

Remove sets the markup as removable and adds a 'NodeRemoved' attribute to it.

func (*Markup) Removed

func (e *Markup) Removed() bool

Removed returns true/false if the Element is marked removed

func (*Markup) Styles

func (e *Markup) Styles() []Property

Styles return the internal style list of the element

func (*Markup) SwapHash

func (e *Markup) SwapHash(hash string)

SwapHash swaps the hash of the internal Element.

func (*Markup) SwapUID

func (e *Markup) SwapUID(uid string)

SwapUID swaps the uid of the internal Element.

func (*Markup) TextContent

func (e *Markup) TextContent() string

TextContent returns the elements text value by either running a text content function if provided else defaulting to the textContent field.

func (*Markup) TreeJSON

func (e *Markup) TreeJSON() MarkupJSON

TreeJSON returns the giving MarkupJSON for this giving markup and the events related to this markup.

func (*Markup) UID

func (e *Markup) UID() string

UID returns the current uid of the Element

func (*Markup) UnRemove

func (e *Markup) UnRemove()

UnRemove sets the markup as not to be removable.

func (*Markup) UnmarshalJSON

func (e *Markup) UnmarshalJSON(data []byte) error

UnmarshalJSON the provided data and adds the giving children into the giving root.

func (*Markup) UpdateHash

func (e *Markup) UpdateHash()

UpdateHash updates the Element hash value

type MarkupJSON

type MarkupJSON struct {
	TreeID string      `json:"TreeID"`
	Events []EventJSON `json:"Events"`
	Markup string      `json:"Markup"`
}

MarkupJSON defines a struct which contains the giving events and and tree of the giving tree.

type Mode

type Mode int

Mode defines the behaviour of the printer setup. Where each increasing mode affects the behaviour and final form of the print outs.

const (
	// Normal mode means all Ids, Hashes are printed and
	// This allows us to see the state of a reconciled tree.
	Normal Mode = iota

	// Pretty mode means all Ids and Hashes are not printed and
	// all removals are left behind to ensure debugging is possible.
	// Removals are cleaned out.
	Pretty
)

func GetMode

func GetMode() Mode

GetMode returns the current working mode for the libraries printers.

type Morpher

type Morpher interface {
	Morph(*Markup) *Markup
}

Morpher defines an interface which morphs the giving markup based on its current internal state based on some internal condition.

type Morphers

type Morphers interface {
	Morphers() []Morphers
	AddMorpher(...Morpher)
	ApplyMorphers() *Markup
}

Morphers exposes a method to allow adding morphers.

type Properties

type Properties interface {
	AddAttribute(Property)
	Attributes() []Property

	AddStyle(Property)
	Styles() []Property

	AddEvent(Event)
	Events() []Event
}

Properties interface defines a type that has Attributes

type Property

type Property interface {
	Apply(*Markup)
	Clone() Property
	Render() (string, string)
}

Property defines the interface for attributes in trees. It provides a apply and RenderAttribute which returns the key and value for that attribute.

func GetAttr

func GetAttr(e Attributes, f string) (Property, error)

GetAttr returns the attribute with the specified tag name

func GetAttrs

func GetAttrs(e Attributes, f, val string) []Property

GetAttrs returns the attributes that have the specified text within the naming convention and if it also contains the set val if not an empty "", NOTE: string.Contains is used

func GetStyle

func GetStyle(e Styles, f string) (Property, error)

GetStyle returns the style with the specified tag name

func GetStyles

func GetStyles(e Styles, f, val string) []Property

GetStyles returns the styles that contain the specified name and if not empty that contains the specified value also, note that strings NOTE: string.Contains is used when checking value parameter if present

func IfProperty

func IfProperty(state bool, m func() Property) Property

IfProperty returns the property when the giving state is true.

func WhenProperty

func WhenProperty(state bool, first Property, other Property) Property

WhenProperty checks if the giving state is true and returns the first property else returns the second.

type RemoveMorpher

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

RemoveMorpher defines a morpher which sets the giving markup as removed.

func (*RemoveMorpher) Morph

func (r *RemoveMorpher) Morph(m *Markup) *Markup

Morph sets the markup received as removed.

func (*RemoveMorpher) Off

func (r *RemoveMorpher) Off(m interface{})

Off switches the state of the morpher to set remove to be true.

func (*RemoveMorpher) On

func (r *RemoveMorpher) On(m interface{})

On switches the state of the morpher out of a remove to be true.

type Selector

type Selector struct {
	Tag       string
	ID        string
	Psuedo    string
	AttrOp    string
	AttrName  string
	AttrValue string
	Classes   []string
	Children  []*Selector
	Order     map[string]string
}

Selector defines a structure which defines the requirements for a given matching to be processed.

func (*Selector) GetClass

func (s *Selector) GetClass() string

GetClass returns the class string for this selector.

func (*Selector) GetID

func (s *Selector) GetID() string

GetID returns the id string for this selector.

func (*Selector) GetSelector

func (s *Selector) GetSelector() string

GetSelector returns the selector received for the given selector.

type StylePrinter

type StylePrinter interface {
	Print([]Property) string
}

StylePrinter defines a printer interface for writing out a style objects into a string form

type StyleWriter

type StyleWriter struct{}

StyleWriter provides a concrete struct that meets the AttrPrinter interface

var SimpleStyleWriter StyleWriter

SimpleStyleWriter provides a basic style writer

func (StyleWriter) Print

func (m StyleWriter) Print(s []Property) string

Print returns a stringed repesentation of the style object

type Styles

type Styles interface {
	Styles() []Property
}

Styles defines an interface that returns a list of styles.

type SwitchMorpher

type SwitchMorpher interface {
	Morpher
	On(interface{})
	Off(interface{})
}

SwitchMorpher defines an interface which allows switching the behaviour of which determines what the markup provided gets morphed into. This allows a nice simple binary morph of input based on certain conditions.

type TextMarkup

type TextMarkup interface {
	TextContent() string
}

TextMarkup defines a interface for text based markup.

type TextPrinter

type TextPrinter interface {
	Print(*Markup) string
}

TextPrinter defines a printer interface for writing out a text type markup into a string form

type TextWriter

type TextWriter struct{}

TextWriter writes out the text element/node for the vdom into a string

var SimpleTextWriter TextWriter

SimpleTextWriter provides a basic text writer

func (TextWriter) Print

func (m TextWriter) Print(t *Markup) string

Print returns the string representation of the text object

Directories

Path Synopsis
Package events defines the event binding system that combines different libraries to create a interesting event system.
Package events defines the event binding system that combines different libraries to create a interesting event system.

Jump to

Keyboard shortcuts

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