Documentation ¶
Overview ¶
Package bbcode implements a parser and HTML generator for BBCode.
Index ¶
Constants ¶
View Source
const ( TEXT = "text" OPENING_TAG = "opening" CLOSING_TAG = "closing" )
Variables ¶
View Source
var DefaultTagCompilers map[string]TagCompilerFunc
Functions ¶
func CompileText ¶
func CompileText(in *BBCodeNode) string
func InsertNewlines ¶
func InsertNewlines(out *HTMLTag)
Types ¶
type BBClosingTag ¶
type BBCodeNode ¶
type BBCodeNode struct { Token Parent *BBCodeNode Children []*BBCodeNode ClosingTag *BBClosingTag Compiler *Compiler Info interface{} }
func Parse ¶
func Parse(tokens chan Token) *BBCodeNode
func (*BBCodeNode) GetOpeningTag ¶
func (n *BBCodeNode) GetOpeningTag() *BBOpeningTag
type BBOpeningTag ¶
func (*BBOpeningTag) String ¶
func (t *BBOpeningTag) String() string
type Compiler ¶
type Compiler struct { AutoCloseTags bool IgnoreUnmatchedClosingTags bool // contains filtered or unexported fields }
func NewCompiler ¶
func (Compiler) CompileTree ¶
func (c Compiler) CompileTree(node *BBCodeNode) *HTMLTag
CompileTree transforms BBCodeNode into an HTML tag.
func (Compiler) SetDefault ¶
func (c Compiler) SetDefault(compiler TagCompilerFunc)
func (Compiler) SetTag ¶
func (c Compiler) SetTag(tag string, compiler TagCompilerFunc)
type HTMLTag ¶
HTMLTag represents a DOM node.
func CompileRaw ¶
func CompileRaw(in *BBCodeNode) *HTMLTag
func NewHTMLTag ¶
NewHTMLTag creates a new HTMLTag with string contents specified by value.
func (*HTMLTag) AppendChild ¶
type TagCompilerFunc ¶
type TagCompilerFunc func(*BBCodeNode) (*HTMLTag, bool)
var DefaultTagCompiler TagCompilerFunc
Click to show internal directories.
Click to hide internal directories.