matter

package
v0.5.12 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeStanza

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

func UnmarshalFrontMatter added in v0.5.0

func UnmarshalFrontMatter(data []byte, matterType FrontMatterType) (matter context.Context, err error)

Types

type FrontMatterType

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

func ParseContent

func ParseContent(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

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) Copy

func (pm *PageMatter) Copy() (copied *PageMatter)

func (*PageMatter) DecodeJsonBody

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

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

func (*PageMatter) DecodeJsonBodyWith

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