matter

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDateTimeLayout

func AddDateTimeLayout(layout string)

func MakeFrontMatterStanza added in v0.2.0

func MakeFrontMatterStanza(fmt FrontMatterType, ctx context.Context) (stanza string)

func ParseDateTime

func ParseDateTime(value string) (t time.Time, err error)

func ParseJson

func ParseJson(content string) (m context.Context, err error)

func ParseToml

func ParseToml(content string) (m context.Context, err error)

func ParseYaml

func ParseYaml(content string) (m context.Context, err error)

Types

type FrontMatterType

type FrontMatterType string
const (
	TomlMatter FrontMatterType = "toml"
	JsonMatter FrontMatterType = "json"
	YamlMatter FrontMatterType = "yaml"
	NoneMatter FrontMatterType = "none"
)

func ParseFrontMatterContent

func ParseFrontMatterContent(raw string) (matter, content string, matterType FrontMatterType)

type PageMatter

type PageMatter struct {
	Origin string

	Path   string
	Shasum string

	Body   string
	Matter beContext.Context
	Locale language.Tag

	Created time.Time
	Updated time.Time

	FrontMatter     string
	FrontMatterType FrontMatterType

	Stub interface{}
}

func NewPageMatter added in v0.2.0

func NewPageMatter(origin string, path, body string, frontMatterType FrontMatterType, matter beContext.Context) (pm *PageMatter)

func ParsePageMatter

func ParsePageMatter(origin string, path string, created, updated time.Time, raw []byte) (pm *PageMatter, err error)

func (*PageMatter) Bytes

func (pm *PageMatter) Bytes() (data []byte, err error)

Bytes rebuilds the page matter's file data, overriding FrontMatter with the Matter content, in the FrontMatterType format

func (*PageMatter) DecodeJsonBody added in v0.2.2

func (pm *PageMatter) DecodeJsonBody() (data beContext.Context, err error)

DecodeJsonBody decodes the .Body from JSON and returns the context data

func (*PageMatter) DecodeJsonBodyWith added in v0.2.2

func (pm *PageMatter) DecodeJsonBodyWith(v interface{}) (err error)

Jump to

Keyboard shortcuts

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