Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JSONParser ¶
type JSONParser struct {
// contains filtered or unexported fields
}
JSONParser is the MetadataParser for JSON
func (*JSONParser) Init ¶
func (j *JSONParser) Init(b *bytes.Buffer) bool
Init prepares the metadata metadata/markdown file and parses it
func (*JSONParser) Markdown ¶
func (j *JSONParser) Markdown() []byte
Markdown returns the markdown text. It should be called only after a call to Parse returns without error.
func (*JSONParser) Metadata ¶
func (j *JSONParser) Metadata() Metadata
Metadata returns parsed metadata. It should be called only after a call to Parse returns without error.
func (*JSONParser) Type ¶
func (j *JSONParser) Type() string
Type returns the kind of metadata parser implemented by this struct.
type Metadata ¶
type Metadata struct { // Page title Title string // Page template Template string // Publish date Date time.Time // Variables to be used with Template Variables map[string]interface{} }
Metadata stores a page's metadata
type NoneParser ¶
type NoneParser struct {
// contains filtered or unexported fields
}
NoneParser is the parser for plaintext markdown with no metadata.
func (*NoneParser) Init ¶
func (n *NoneParser) Init(b *bytes.Buffer) bool
Init prepases and parses the metadata and markdown file
func (*NoneParser) Markdown ¶
func (n *NoneParser) Markdown() []byte
Markdown returns parsed markdown. It should be called only after a call to Parse returns without error.
func (*NoneParser) Metadata ¶
func (n *NoneParser) Metadata() Metadata
Metadata returns parsed metadata. It should be called only after a call to Parse returns without error.
func (*NoneParser) Type ¶
func (n *NoneParser) Type() string
Type returns the kind of parser this struct is.
type Parser ¶
type Parser interface { // Initialize a parser Init(b *bytes.Buffer) bool // Type of metadata Type() string // Parsed metadata. Metadata() Metadata // Raw markdown. Markdown() []byte }
Parser is a an interface that must be satisfied by each parser
type TOMLParser ¶
type TOMLParser struct {
// contains filtered or unexported fields
}
TOMLParser is the Parser for TOML
func (*TOMLParser) Init ¶
func (t *TOMLParser) Init(b *bytes.Buffer) bool
Init prepares and parses the metadata and markdown file itself
func (*TOMLParser) Markdown ¶
func (t *TOMLParser) Markdown() []byte
Markdown returns parser markdown. It should be called only after a call to Parse returns without error.
func (*TOMLParser) Metadata ¶
func (t *TOMLParser) Metadata() Metadata
Metadata returns parsed metadata. It should be called only after a call to Parse returns without error.
func (*TOMLParser) Type ¶
func (t *TOMLParser) Type() string
Type returns the kind of parser this struct is.
type YAMLParser ¶
type YAMLParser struct {
// contains filtered or unexported fields
}
YAMLParser is the Parser for YAML
func (*YAMLParser) Init ¶
func (y *YAMLParser) Init(b *bytes.Buffer) bool
Init prepares the metadata parser for parsing.
func (*YAMLParser) Markdown ¶
func (y *YAMLParser) Markdown() []byte
Markdown renders the text as a byte array
func (*YAMLParser) Metadata ¶
func (y *YAMLParser) Metadata() Metadata
Metadata returns parsed metadata. It should be called only after a call to Parse returns without error.
func (*YAMLParser) Type ¶
func (y *YAMLParser) Type() string
Type returns the kind of metadata parser.