site

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//ErrNoFileLoaderFound is when the template failed building
	ErrNoFileLoaderFound = errors.NewError("could not get file loader information", 1)
	//ErrNoFileParserFound is for a failure moving the static folder
	ErrNoFileParserFound = errors.NewError("could not get file parser information", 2)
)
View Source
var (
	//TemplateFunctions are all the template functions defined by modules
	TemplateFunctions = template.FuncMap{}

	//FileLoaders are all the module file loaders
	FileLoaders = make(map[string]FileLoader)
	//FileParsers are all the module file parsers
	FileParsers = make(map[string]FileParser)
	//FilePostProcessors are all the module data post processors
	FilePostProcessors = make(map[string]FPP)
	//SPPs are all the module data post processors
	SPPs = make(map[string]SPP)

	//TemplateFolder is the folder all templates are stored
	TemplateFolder string
	//StaticFolder is the folder all static files are stored
	StaticFolder string
	//OutputFolder is the folder that should be exported to
	OutputFolder string

	//ErrFailedTemplate is when the template failed building
	ErrFailedTemplate = errors.NewError("failed building template", 1)
	//ErrFailedStatic is for a failure moving the static folder
	ErrFailedStatic = errors.NewError("failed to move static folder", 2)
	//ErrFailedGather is for a failure in gathering files.
	ErrFailedGather = errors.NewError("failed to gather files", 3)
	//ErrFailedCreateFS is for a failure in gathering files.
	ErrFailedCreateFS = errors.NewError("couldn't create directory/file", 4)
)

Functions

func Execute

func Execute(sites []*Site) errors.Error

Execute the templates of a []Site into the final files

Types

type ConfigSite

type ConfigSite struct {
	Slug      string        `json:"slug,omitempty"`
	Templates []string      `json:"templates,omitempty"`
	Data      []datafile    `json:"data,omitempty"`
	Sites     []*ConfigSite `json:"sites,omitempty"`
}

ConfigSite is the way a site is defined in the config file

type FPP added in v0.5.4

type FPP interface {
	Process(tt.Data, string) tt.Data
	GetPipe(string) pipeline.Pipe
}

FPP is a function thats able to post-process data

type FileLoader

type FileLoader interface {
	Load(string) []byte
	GetPipe(string) pipeline.Pipe
}

FileLoader is a module that loads data

type FileParser

type FileParser interface {
	Parse([]byte, string) tt.Data
	GetPipe(string) pipeline.Pipe
}

FileParser is a module that parses loaded data

type SPP added in v0.5.4

type SPP interface {
	Process([]*Site, string) []*Site
	GetPipe(string) pipeline.Pipe
}

SPP is a function thats able to post-process data

type Site

type Site struct {
	Slug     string
	Template string
	Data     tt.Data
}

Site is the way a site is defined after all of its data and templates have been collected

func Unfold

func Unfold(configSite *ConfigSite, spps []string) ([]*Site, errors.Error)

Unfold the ConfigSite into a []ConfigSite

Jump to

Keyboard shortcuts

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