parser

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2016 License: Apache-2.0 Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (

	// HTMLLead identifies the start of HTML documents.
	HTMLLead = "<"
	// YAMLLead identifies the start of YAML frontmatter.
	YAMLLead = "-"
	// YAMLDelimUnix identifies the end of YAML front matter on Unix.
	YAMLDelimUnix = "---\n"
	// YAMLDelimDOS identifies the end of YAML front matter on Windows.
	YAMLDelimDOS = "---\r\n"
	// YAMLDelim identifies the YAML front matter delimiter.
	YAMLDelim = "---"
	// TOMLLead identifies the start of TOML front matter.
	TOMLLead = "+"
	// TOMLDelimUnix identifies the end of TOML front matter on Unix.
	TOMLDelimUnix = "+++\n"
	// TOMLDelimDOS identifies the end of TOML front matter on Windows.
	TOMLDelimDOS = "+++\r\n"
	// TOMLDelim identifies the TOML front matter delimiter.
	TOMLDelim = "+++"
	// JSONLead identifies the start of JSON frontmatter.
	JSONLead = "{"
	// HTMLCommentStart identifies the start of HTML comment.
	HTMLCommentStart = "<!--"
	// HTMLCommentEnd identifies the end of HTML comment.
	HTMLCommentEnd = "-->"
	// BOM Unicode byte order marker
	BOM = '\ufeff'
)

Variables

This section is empty.

Functions

func DetectFrontMatter

func DetectFrontMatter(mark rune) (f *frontmatterType)

DetectFrontMatter detects the type of frontmatter analysing its first character.

func FormatSanitize

func FormatSanitize(kind string) string

TODO(bep) move to helpers

func FormatToLeadRune

func FormatToLeadRune(kind string) rune

func HandleJSONMetaData

func HandleJSONMetaData(datum []byte) (interface{}, error)

func HandleTOMLMetaData

func HandleTOMLMetaData(datum []byte) (interface{}, error)

func HandleYAMLMetaData

func HandleYAMLMetaData(datum []byte) (interface{}, error)

func InterfaceToConfig

func InterfaceToConfig(in interface{}, mark rune) ([]byte, error)

func InterfaceToFrontMatter

func InterfaceToFrontMatter(in interface{}, mark rune) ([]byte, error)

Types

type Page

type Page interface {
	FrontMatter() []byte
	Content() []byte
	IsRenderable() bool
	Metadata() (interface{}, error)
}

Page represents a parsed content page.

func ReadFrom

func ReadFrom(r io.Reader) (p Page, err error)

ReadFrom reads the content from an io.Reader and constructs a page.

Jump to

Keyboard shortcuts

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