metadata

package
v0.8.4-0...-389a6eb Latest Latest
Warning

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

Go to latest
Published: May 7, 2016 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONMetadataParser

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

JSONMetadataParser is the MetadataParser for JSON

func (*JSONMetadataParser) Init

func (j *JSONMetadataParser) Init(b *bytes.Buffer) bool

Parse metadata/markdown file

func (*JSONMetadataParser) Markdown

func (j *JSONMetadataParser) Markdown() []byte

func (*JSONMetadataParser) Metadata

func (j *JSONMetadataParser) Metadata() Metadata

Metadata returns parsed metadata. It should be called only after a call to Parse returns without error.

func (*JSONMetadataParser) Type

func (j *JSONMetadataParser) Type() string

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]string

	// Flags to be used with Template
	Flags map[string]bool
}

Metadata stores a page's metadata

func NewMetadata

func NewMetadata(parsedMap map[string]interface{}) Metadata

NewMetadata() returns a new Metadata struct, loaded with the given map

type MetadataParser

type MetadataParser interface {
	// Initialize a parser
	Init(b *bytes.Buffer) bool

	// Type of metadata
	Type() string

	// Parsed metadata.
	Metadata() Metadata

	// Raw markdown.
	Markdown() []byte
}

MetadataParser is a an interface that must be satisfied by each parser

func GetParser

func GetParser(buf []byte) MetadataParser

GetParser returns a parser for the given data

type NoneMetadataParser

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

TOMLMetadataParser is the MetadataParser for TOML

func (*NoneMetadataParser) Init

func (n *NoneMetadataParser) Init(b *bytes.Buffer) bool

Parse metadata/markdown file

func (*NoneMetadataParser) Markdown

func (n *NoneMetadataParser) Markdown() []byte

func (*NoneMetadataParser) Metadata

func (n *NoneMetadataParser) Metadata() Metadata

Metadata returns parsed metadata. It should be called only after a call to Parse returns without error.

func (*NoneMetadataParser) Parse

func (n *NoneMetadataParser) Parse(b []byte) ([]byte, error)

Parse the metadata

func (*NoneMetadataParser) Type

func (n *NoneMetadataParser) Type() string

type TOMLMetadataParser

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

TOMLMetadataParser is the MetadataParser for TOML

func (*TOMLMetadataParser) Init

func (t *TOMLMetadataParser) Init(b *bytes.Buffer) bool

Parse metadata/markdown file

func (*TOMLMetadataParser) Markdown

func (t *TOMLMetadataParser) Markdown() []byte

func (*TOMLMetadataParser) Metadata

func (t *TOMLMetadataParser) Metadata() Metadata

Metadata returns parsed metadata. It should be called only after a call to Parse returns without error.

func (*TOMLMetadataParser) Type

func (t *TOMLMetadataParser) Type() string

type YAMLMetadataParser

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

YAMLMetadataParser is the MetadataParser for YAML

func (*YAMLMetadataParser) Init

func (y *YAMLMetadataParser) Init(b *bytes.Buffer) bool

func (*YAMLMetadataParser) Markdown

func (y *YAMLMetadataParser) Markdown() []byte

func (*YAMLMetadataParser) Metadata

func (y *YAMLMetadataParser) Metadata() Metadata

Metadata returns parsed metadata. It should be called only after a call to Parse returns without error.

func (*YAMLMetadataParser) Type

func (y *YAMLMetadataParser) Type() string

Jump to

Keyboard shortcuts

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