Documentation ¶
Overview ¶
Package pageparser provides a parser for Hugo content files (Markdown, HTML etc.) in Hugo. This implementation is highly inspired by the great talk given by Rob Pike called "Lexical Scanning in Go" It's on YouTube, Google it!. See slides here: http://cuddle.googlecode.com/hg/talk/lex.html
Package pageparser provides a parser for Hugo content files (Markdown, HTML etc.) in Hugo. This implementation is highly inspired by the great talk given by Rob Pike called "Lexical Scanning in Go" It's on YouTube, Google it!. See slides here: http://cuddle.googlecode.com/hg/talk/lex.html
Package pageparser provides a parser for Hugo content files (Markdown, HTML etc.) in Hugo. This implementation is highly inspired by the great talk given by Rob Pike called "Lexical Scanning in Go" It's on YouTube, Google it!. See slides here: http://cuddle.googlecode.com/hg/talk/lex.html
Package pageparser provides a parser for Hugo content files (Markdown, HTML etc.) in Hugo. This implementation is highly inspired by the great talk given by Rob Pike called "Lexical Scanning in Go" It's on YouTube, Google it!. See slides here: http://cuddle.googlecode.com/hg/talk/lex.html
Index ¶
- type Config
- type Item
- func (i Item) IsDone() bool
- func (i Item) IsEOF() bool
- func (i Item) IsError() bool
- func (i Item) IsFrontMatter() bool
- func (i Item) IsInlineShortcodeName() bool
- func (i Item) IsLeftShortcodeDelim() bool
- func (i Item) IsNonWhitespace() bool
- func (i Item) IsRightShortcodeDelim() bool
- func (i Item) IsShortcodeClose() bool
- func (i Item) IsShortcodeMarkupDelimiter() bool
- func (i Item) IsShortcodeName() bool
- func (i Item) IsShortcodeParam() bool
- func (i Item) IsShortcodeParamVal() bool
- func (i Item) IsText() bool
- func (i Item) String() string
- func (i Item) ValStr() string
- type ItemType
- type Items
- type Iterator
- func (t *Iterator) Backup()
- func (t *Iterator) Consume(cnt int)
- func (t *Iterator) Current() Item
- func (t *Iterator) Input() []byte
- func (t *Iterator) IsValueNext() bool
- func (t *Iterator) LineNumber() int
- func (t *Iterator) Next() Item
- func (t *Iterator) Peek() Item
- func (t *Iterator) PeekWalk(walkFn func(item Item) bool)
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Item ¶
func (Item) IsFrontMatter ¶
func (Item) IsInlineShortcodeName ¶
func (Item) IsLeftShortcodeDelim ¶
func (Item) IsNonWhitespace ¶
func (Item) IsRightShortcodeDelim ¶
func (Item) IsShortcodeClose ¶
func (Item) IsShortcodeMarkupDelimiter ¶
func (Item) IsShortcodeName ¶
func (Item) IsShortcodeParam ¶
func (Item) IsShortcodeParamVal ¶
type ItemType ¶
type ItemType int
const ( // page items TypeHTMLStart ItemType // document starting with < as first non-whitespace TypeLeadSummaryDivider // <!--more-->, # more TypeFrontMatterYAML TypeFrontMatterTOML TypeFrontMatterJSON TypeFrontMatterORG TypeEmoji TypeIgnore // // The BOM Unicode byte order marker and possibly others )
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
An Iterator has methods to iterate a parsed page with support going back if needed.
func (*Iterator) Consume ¶
Consume is a convencience method to consume the next n tokens, but back off Errors and EOF.
func (*Iterator) IsValueNext ¶
check for non-error and non-EOF types coming next
func (*Iterator) LineNumber ¶
LineNumber returns the current line number. Used for logging.
type Result ¶
type Result interface { // Iterator returns a new Iterator positioned at the beginning of the parse tree. Iterator() *Iterator // Input returns the input to Parse. Input() []byte }
Result holds the parse result.