theme

package
v0.0.0-...-f1f97c7 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2018 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrorMetaNotFound means theme's meta file is missing
	ErrorMetaNotFound = errors.New("need add theme meta file")
	// ErrorOutVersion means theme is out of version
	ErrorOutVersion = errors.New("theme need newer PuGo version")
)

Functions

This section is empty.

Types

type Meta

type Meta struct {
	Name string   `toml:"name" ini:"name"`
	Repo string   `toml:"repo" ini:"repo"`
	URL  string   `toml:"url" ini:"url"`
	Date string   `toml:"date" ini:"date"`
	Desc string   `toml:"desc" ini:"desc"`
	Tags []string `toml:"tags" ini:"-"`

	MinVersion string `toml:"min_version" ini:"min_version"`

	Authors object.AuthorGroup `toml:"author" ini:"-"`
	Refs    []*metaRef         `toml:"ref" ini:"-"`

	License    string `toml:"license" ini:"license"`
	LicenseURL string `toml:"license_url" ini:"license_url"`
}

Meta is description of theme

type Theme

type Theme struct {
	Meta *Meta
	// contains filtered or unexported fields
}

Theme object, maintains a sort of templates for whole site data

func Read

func Read(dir string, pugoVersion string) (*Theme, error)

Read read directory to load new theme

func (*Theme) Dir

func (th *Theme) Dir() string

Dir get theme directory

func (*Theme) Execute

func (th *Theme) Execute(w io.Writer, name string, data interface{}) error

Execute executes template by name with data, write into a Writer

func (*Theme) Func

func (th *Theme) Func(key string, fn interface{})

Func add template func to theme

func (*Theme) Funcs

func (th *Theme) Funcs() template.FuncMap

Funcs return all template functions

func (*Theme) Load

func (th *Theme) Load() error

Load loads templates

func (*Theme) Static

func (th *Theme) Static() string

Static gets static dirname in the theme

func (*Theme) StaticDir

func (th *Theme) StaticDir() string

StaticDir gets static dir in the theme

func (*Theme) StaticFiles

func (th *Theme) StaticFiles() ([]object.SourceItem, error)

StaticFiles get static files in the theme

func (*Theme) Template

func (th *Theme) Template(name string) *template.Template

Template gets template by name

Jump to

Keyboard shortcuts

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