fmatter

package
v0.0.0-...-377c8ea Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2015 License: MIT Imports: 6 Imported by: 0

README

fmatter

A TOML Front Matter parser, using BurntSushi's toml package. View the godoc documentation here. The TOML package used is pure Go, unlike the goyaml package used in the original fmatter package. TOML seems to be a good alternate format for front matter, too.

Installation

go get github.com/james4k/fmatter/toml

New to Go? Have a look at how import paths work.

Documentation

Overview

Package fmatter is a TOML Front Matter parser, using the github.com/BurntSushi/toml package.

DEPRECATED. This was a terrible idea.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Read

func Read(data []byte, frontmatter interface{}) (content []byte, err error)

Read detects and parses the front matter data, and returns the remaining contents. If no front matter is found, the entire file contents are returned. frontmatter is passed to toml.Decode

Example
data := []byte(`---
title = "Some Title"
---
content`)

var frontmatter struct{ Title string }
content, _ := Read(data, &frontmatter)
fmt.Println(content)
Output:

func ReadFile

func ReadFile(filename string, frontmatter interface{}) (content []byte, err error)

ReadFile read an entire file into memory, and calls Read which parses the front matter data and returns the remaining file contents.

Types

This section is empty.

Jump to

Keyboard shortcuts

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