matter

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 14, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDateTimeLayout

func AddDateTimeLayout(layout string)

func AnyStubsInStubs

func AnyStubsInStubs(src, tgt PageStubs) (found bool)

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 {
	Path   string
	Shasum string

	Body   string
	Matter beContext.Context
	Locale language.Tag

	Created time.Time
	Updated time.Time

	FrontMatter     string
	FrontMatterType FrontMatterType

	Stub *PageStub
}

func ParsePageMatter

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

type PageStub

type PageStub struct {
	Bfs      fs.FileSystem
	Point    string
	Shasum   string
	Source   string
	Language language.Tag
	Fallback language.Tag
	EnjinCtx beContext.Context
}

func NewPageStub

func NewPageStub(enjin beContext.Context, bfs fs.FileSystem, point, source, shasum string, fallback language.Tag) (s *PageStub, err error)

type PageStubs

type PageStubs []*PageStub

func (PageStubs) GetShasum

func (s PageStubs) GetShasum(shasum string) (found *PageStub)

func (PageStubs) GetSource

func (s PageStubs) GetSource(source string) (found *PageStub)

func (PageStubs) HasShasum

func (s PageStubs) HasShasum(shasum string) (found bool)

func (PageStubs) Random

func (s PageStubs) Random() (stub *PageStub)

type ValueStubPair

type ValueStubPair struct {
	Value interface{}
	Stub  *PageStub
}

Jump to

Keyboard shortcuts

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