rangolib

package
v0.0.0-...-71c995c Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2015 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const TOML = '+'
View Source
const YAML = '-'

Variables

This section is empty.

Functions

func RunHugo

func RunHugo() ([]byte, error)

Types

type Asset

type Asset struct {
	Name string `json:"name"`
	Path string `json:"path"`
}

func NewAsset

func NewAsset(path, filename string, file io.Reader) (*Asset, error)

func (Asset) Resample

func (a Asset) Resample()

type Config

type Config struct {
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig(path string) *Config

func (Config) Create

func (c Config) Create() (*os.File, error)

Create empties the config file and returns the fd to it

func (Config) Open

func (c Config) Open() (*os.File, error)

Open returns a fd to the config file

func (Config) Parse

func (c Config) Parse() (*ConfigMap, error)

Parse converts the config file into a readable map

func (Config) Save

func (c Config) Save(config *ConfigMap) error

Save saves the config to disk

type ConfigManager

type ConfigManager interface {
	Parse() (*ConfigMap, error)
	Save(config *ConfigMap) error
}

type ConfigMap

type ConfigMap map[string]interface{}

type Dir

type Dir struct{}

func NewDir

func NewDir() *Dir

func (Dir) Create

func (d Dir) Create(dirname string) (*File, error)

Create creates a new directory

func (Dir) Destroy

func (d Dir) Destroy(dirname string) error

Destroy will delete a directory and it's contents

func (Dir) Read

func (d Dir) Read(dirname string) (Files, error)

Read lists the contents of a directory

func (Dir) Update

func (d Dir) Update(src string, dest string) (*File, error)

Update renames an existing directory

type DirManager

type DirManager interface {
	Read(string) (Files, error)
	Create(string) (*File, error)
	Update(string, string) (*File, error)
	Destroy(string) error
}

type File

type File struct {
	Name    string `json:"name"`
	Path    string `json:"path"`
	IsDir   bool   `json:"isDir"`
	Size    int64  `json:"size"`
	ModTime int64  `json:"modTime"`
}

func NewFile

func NewFile(path string, info os.FileInfo) *File

NewFile constructs a new File based on a path and file info

func (*File) Load

func (f *File) Load(info os.FileInfo)

type Files

type Files []*File

type Frontmatter

type Frontmatter map[string]interface{}

Frontmatter stores encodeable data

type Page

type Page struct{}

func NewPage

func NewPage() *Page

func (Page) Create

func (p Page) Create(dirname string, fm Frontmatter, content []byte) (*PageFile, error)

CreatePage creates a new file and saves page content to it

func (Page) Destroy

func (p Page) Destroy(fp string) error

Destroy deletes a page

func (Page) Read

func (p Page) Read(fp string) (*PageFile, error)

ReadPage reads a page from disk

func (Page) Update

func (p Page) Update(fp string, fm Frontmatter, content []byte) (*PageFile, error)

UpdatePage changes the content of an existing page

type PageFile

type PageFile struct {
	Path     string      `json:"path"`
	Metadata Frontmatter `json:"metadata"`
	Content  string      `json:"content"`
}

Page represents a markdown file

func (*PageFile) Save

func (p *PageFile) Save() error

type PageManager

type PageManager interface {
	Read(fp string) (*PageFile, error)
	Create(fp string, fm Frontmatter, content []byte) (*PageFile, error)
	Update(fp string, fm Frontmatter, content []byte) (*PageFile, error)
	Destroy(fp string) error
}

Jump to

Keyboard shortcuts

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