gmnhg

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2022 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Sort

func Sort(sortable interface{}) interface{}

func SortRev

func SortRev(sortable interface{}) interface{}

Types

type Metadata added in v0.4.0

type Metadata struct {
	Title      string    `yaml:"title" toml:"title" json:"title" org:"title"`
	IsDraft    bool      `yaml:"draft" toml:"draft" json:"draft" org:"draft"`
	Layout     string    `yaml:"layout" toml:"layout" json:"layout" org:"layout"`
	Date       time.Time `yaml:"date" toml:"date" json:"date" org:"date"`
	Summary    string    `yaml:"summary" toml:"summary" json:"summary" org:"summary"`
	IsHeadless bool      `yaml:"headless" toml:"headless" json:"headless" org:"headless"`
}

Metadata contains all recognized Hugo properties.

func ParseMetadata added in v0.4.0

func ParseMetadata(source []byte) (markdown []byte, metadata Metadata)

ParseMetadata extracts TOML/JSON/YAML/org-mode format front matter from Markdown text. If no metadata is found, markdown will be equal to source.

TOML front matter is identified as +++ symbols at the very start of the text, followed by TOML content, followed by another +++ (YAML is the same, but with ---). JSON front matter is identified as a JSON object followed by two newline symbols. org-mode front matter is identified as a set of #+KEY: VALUE lines, the first line started with anything else but #+ ends the front matter.

type Post

type Post struct {
	Post     []byte
	Metadata Metadata
	Link     string
}

type Posts

type Posts []Post

Posts implements sort.Interface.

func (Posts) Len

func (p Posts) Len() int

func (Posts) Less

func (p Posts) Less(i, j int) bool

func (Posts) Swap

func (p Posts) Swap(i, j int)

Jump to

Keyboard shortcuts

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