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) Body ¶
func (j *JSONParser) Body() []byte
Body returns the body 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) Parse ¶
func (j *JSONParser) Parse(by []byte) bool
Parse processes the document and prepares the metadata and body
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 name Template string // Variables to be used with Template Variables map[string]interface{} }
Metadata stores a page's metadata
func NewMetadata ¶
NewMetadata returns a new Metadata struct, loaded with the given map
type NoneParser ¶
type NoneParser struct {
// contains filtered or unexported fields
}
NoneParser is the parser for plaintext with no metadata.
func (*NoneParser) Body ¶
func (n *NoneParser) Body() []byte
Body returns parsed body. 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) Parse ¶
func (n *NoneParser) Parse(b []byte) bool
Parse prepases and parses the metadata and body
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 Parse(b []byte) bool // Type of metadata Type() string // Parsed metadata. Metadata() Metadata // Raw body Body() []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) Body ¶
func (t *TOMLParser) Body() []byte
Body returns parser the body. 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) Parse ¶
func (t *TOMLParser) Parse(by []byte) bool
Parse prepares and parses the metadata and body
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) 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) Parse ¶
func (y *YAMLParser) Parse(by []byte) bool
Parse prepares the metadata parser for parsing.
func (*YAMLParser) Type ¶
func (y *YAMLParser) Type() string
Type returns the kind of metadata parser.