parser

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultParser

type DefaultParser struct {
}

func (*DefaultParser) Parse

func (pp *DefaultParser) Parse(path string, entry fs.FileInfo, context *ParserContext) (tree.Node, error)

func (*DefaultParser) Test

func (pp *DefaultParser) Test(path string, entry fs.FileInfo) (bool, error)

type EntryParser

type EntryParser interface {
	Test(path string, entry fs.FileInfo) (bool, error)
	Parse(path string, entry fs.FileInfo, context *ParserContext) (tree.Node, error)
}

type PageAttributes

type PageAttributes struct {
	Title    string                 `mapstructure:"title"`
	Meta     []*tree.PageMetaValue  `mapstructure:"meta"`
	Links    []*tree.PageLinksValue `mapstructure:"links"`
	Template string                 `mapstructure:"template"`
}

type Parser

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

func New

func New(opts ...ParserOption) *Parser

func (*Parser) Parse

func (p *Parser) Parse() (*tree.Site, error)

type ParserContext

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

func (*ParserContext) Content

func (pc *ParserContext) Content(path string) ([]byte, error)

func (*ParserContext) FrontMatter

func (pc *ParserContext) FrontMatter(path string, output any) error

func (*ParserContext) Source

func (pc *ParserContext) Source(path string) ([]byte, error)

type ParserOption

type ParserOption interface {
	Apply(*Parser) error
}

type ParserOptionFunc

type ParserOptionFunc func(*Parser) error

func WithEntryParsers

func WithEntryParsers(parsers ...EntryParser) ParserOptionFunc

func WithSiteFS

func WithSiteFS(siteFS afero.Fs) ParserOptionFunc

func (ParserOptionFunc) Apply

func (apply ParserOptionFunc) Apply(p *Parser) error

Jump to

Keyboard shortcuts

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