Documentation ¶
Overview ¶
Package html is an HTML5 lexer following the specifications at http://www.w3.org/TR/html5/syntax.html.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Hash ¶
type Hash uint32
Hash defines perfect hashes for a predefined list of strings
const ( Iframe Hash = 0x6 // iframe Math Hash = 0x604 // math Plaintext Hash = 0x1e09 // plaintext Script Hash = 0xa06 // script Style Hash = 0x1405 // style Svg Hash = 0x1903 // svg Textarea Hash = 0x2308 // textarea Title Hash = 0xf05 // title Xmp Hash = 0x1c03 // xmp )
Unique hash definitions to be used instead of strings
type Lexer ¶
type Lexer struct {
// contains filtered or unexported fields
}
Lexer is the state for the lexer.
func NewLexer ¶
func NewLexer(r *parse.Input) *Lexer
NewLexer returns a new Lexer for a given io.Reader.
Example ¶
l := NewLexer(parse.NewInputString("<span class='user'>John Doe</span>")) out := "" for { tt, data := l.Next() if tt == ErrorToken { break } out += string(data) } fmt.Println(out)
Output: <span class='user'>John Doe</span>
func (*Lexer) AttrVal ¶
AttrVal returns the attribute value when an AttributeToken was returned from Next.
func (*Lexer) Err ¶
Err returns the error encountered during lexing, this is often io.EOF but also other errors can be returned.
type TokenType ¶
type TokenType uint32
TokenType determines the type of token, eg. a number or a semicolon.
Click to show internal directories.
Click to hide internal directories.