site

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//ErrNoDataLoaderFound means a data loader does not have a function
	ErrNoDataLoaderFound = errors.NewError("could not get data loader information", 1)
	//ErrNoDataParserFound means a data parser does not have a function
	ErrNoDataParserFound = errors.NewError("could not get data parser information", 2)
	//ErrNoDataPostProcessorFound means a data post processor does not have a function
	ErrNoDataPostProcessorFound = errors.NewError("could not get data post processor information", 3)
	//ErrNoRangeVariable means a data range attribute does not specify a variable
	ErrNoRangeVariable = errors.NewError("could not get variable for range", 3)
)
View Source
var (
	//TemplateFunctions are all the template functions defined by modules
	TemplateFunctions = template.FuncMap{}

	//DataLoaders are all the module data loaders
	DataLoaders = make(map[string]DataLoader)
	//DataParsers are all the module file parsers
	DataParsers = make(map[string]DataParser)
	//DataPostProcessors are all the module data post processors
	DataPostProcessors = make(map[string]DPP)
	//SPPs are all the module site post processors
	SPPs = make(map[string]SPP)

	//Iterators are all the module iterators
	Iterators = make(map[string]Iterator)

	//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)
	//ErrUsingUnknownModule is when a user uses a module that is not registered.
	ErrUsingUnknownModule = errors.NewError("module is used but not registered", 5)
)
View Source
var (
	//ErrNoIteratorFound means an iterator does not have a function
	ErrNoIteratorFound = errors.NewError("could not get iterator information", 11)
)

Functions

func Execute

func Execute(sites []*Site, log *ui.UI) errors.Error

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

func GetTemplateTree added in v0.13.0

func GetTemplateTree(template string) *parse.Tree

GetTemplateTree gets the template according to

func PostProcess added in v0.10.0

func PostProcess(sites *[]*Site, spps []string, log *ui.UI) errors.Error

PostProcess all sites

func RemoveTemplate added in v0.13.0

func RemoveTemplate(path string)

Cleans a template from the template cache

Types

type ConfigSite

type ConfigSite struct {
	Iterators      map[string]IteratorData `json:"iterators,omitempty"`
	Slug           string                  `json:"slug,omitempty"`
	Templates      []string                `json:"templates,omitempty"`
	Data           []Data                  `json:"data,omitempty"`
	Sites          []ConfigSite            `json:"sites,omitempty"`
	IteratorValues map[string]string       `json:"-"`
	Dependencies   []string                `json:"-"`
}

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

func DeepCopy added in v0.13.0

func DeepCopy(cSite ConfigSite) ConfigSite

DeepCopy deep copies the site.

func Unfold

func Unfold(configSite *ConfigSite, log *ui.UI) ([]ConfigSite, errors.Error)

Unfold the ConfigSite into a []ConfigSite

type DPP added in v0.9.0

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

DPP is a function thats able to post-process data

type Data added in v0.9.2

type Data struct {
	ShouldRange     string
	Loader          string
	LoaderArguments string
	Parser          string
	ParserArguments string
	PostProcessors  []DataPostProcessor
}

Data is info about data from the config

func (*Data) MarshalJSON added in v0.9.2

func (df *Data) MarshalJSON() ([]byte, error)

MarshalJSON marshalls the data

func (*Data) String added in v0.9.2

func (df *Data) String() string

func (*Data) UnmarshalJSON added in v0.9.2

func (df *Data) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshalls the data

type DataLoader added in v0.9.0

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

DataLoader is a module that loads data

type DataParser added in v0.9.0

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

DataParser is a module that parses loaded data

type DataPostProcessor added in v0.9.2

type DataPostProcessor struct {
	PostProcessor          string
	PostProcessorArguments string
}

DataPostProcessor is info about a data post processor from the config

type Iterator added in v0.9.0

type Iterator interface {
	GetIterations(string) []string
}

Iterator is a function thats able to post-process data

type IteratorData added in v0.9.2

type IteratorData struct {
	Iterator          string
	IteratorArguments string
	List              []string
}

IteratorData is info about an iterator from the config

func (IteratorData) MarshalJSON added in v0.9.2

func (i IteratorData) MarshalJSON() ([]byte, error)

MarshalJSON marshalls the iterator data

func (IteratorData) String added in v0.9.2

func (i IteratorData) String() string

func (*IteratorData) UnmarshalJSON added in v0.9.2

func (i *IteratorData) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshalls the iterator 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 Gather added in v0.10.0

func Gather(cSite ConfigSite, log *ui.UI) (*Site, errors.Error)

Gather after unfolding

Jump to

Keyboard shortcuts

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