node

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClosingTag

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

ClosingTag is a bbcode closing tag, i.e [/b].

func NewClosingTag

func NewClosingTag(tok token.Token) *ClosingTag

NewClosingTag creates a new closing tag.

func (*ClosingTag) String

func (ct *ClosingTag) String() string

String satisfies to the Node interface.

func (*ClosingTag) TagName

func (ct *ClosingTag) TagName() string

TagName satisfies to the Node interface.

func (*ClosingTag) Token

func (ct *ClosingTag) Token() token.Token

Token satisfies to the Node interface.

type Newline

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

Newline is a new line node.

func NewLine

func NewLine(tok token.Token) *Newline

NewLine creates a new line node.

func (*Newline) String

func (n *Newline) String() string

String satisfies to the Node interface.

func (*Newline) Token

func (n *Newline) Token() token.Token

Token satisfy the Node interface.

type Node

type Node interface {
	// Token returns a main token of the node.
	Token() token.Token
	// String returns a string representing of the node.
	String() string
}

Node is the smallest piece of the parsing result.

type OpeningTag

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

OpeningTag is a bbcode opening tag, i.e. [b]

func NewOpeningTag

func NewOpeningTag(tok token.Token, value string, attrs map[string]string) *OpeningTag

NewOpeningTag creates a new opening tag.

func (*OpeningTag) Attrs

func (ot *OpeningTag) Attrs() map[string]string

Attrs returns a tag attributes.

func (*OpeningTag) String

func (ot *OpeningTag) String() string

String satisfies to the Node interface.

func (*OpeningTag) TagName

func (ot *OpeningTag) TagName() string

TagName satisfies to the Node interface.

func (*OpeningTag) Token

func (ot *OpeningTag) Token() token.Token

Token satisfies to the Node interface.

func (*OpeningTag) Value

func (ot *OpeningTag) Value() string

Value returns a bbcode tag value (string after =).

type SelfClosingTag

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

SelfClosingTag is self-closing bbcode tag, i.e. [url="https://google.com" /]

func NewSelfClosingTag

func NewSelfClosingTag(tok token.Token, value string, attrs map[string]string) *SelfClosingTag

NewSelfClosingTag creates a new opening tag.

func (*SelfClosingTag) String

func (ot *SelfClosingTag) String() string

String satisfies to the Node interface.

func (*SelfClosingTag) TagName

func (ot *SelfClosingTag) TagName() string

TagName satisfies to the Node interface.

func (*SelfClosingTag) Token

func (ot *SelfClosingTag) Token() token.Token

Token satisfies to the Node interface.

func (*SelfClosingTag) Value

func (ot *SelfClosingTag) Value() string

Value returns a bbcode tag value (string after =).

type Tag

type Tag interface {
	Node
	// TagName returns a tag name.
	TagName() string
}

Tag is a bbcode tag. It can be either opening, closing or self-closing.

type Text

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

Text is a text node.

func NewText

func NewText(tok token.Token, val string) *Text

NewText creates a new text node.

func (*Text) Append

func (t *Text) Append(str string)

Append appends a string to the value.

func (*Text) String

func (t *Text) String() string

String satisfies to the Node interface.

func (*Text) Token

func (t *Text) Token() token.Token

Token satisfy the Node interface.

Jump to

Keyboard shortcuts

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