templates

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2018 License: Apache-2.0 Imports: 19 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Module

type Module struct {
	ConfigModule *config.Module
	Logger       *logger.Module
	Pkg          *pkg.Module

	Stores []store.ThemeStore
	// contains filtered or unexported fields
}

Module templates provides support for looking up and using themes and their corresponding templates.

func (*Module) CheckThemeForUpdate added in v0.2.0

func (m *Module) CheckThemeForUpdate(name string) (bool, string, string, error)

CheckThemeForUpdate checks the given theme for updates, and if it has updates, returns true, and the current ref and the latest ref.

func (*Module) GetAsset

func (m *Module) GetAsset(name string) (*models.ThemeAsset, error)

GetAsset searches all installed themes for the named asset

func (*Module) GetRegistryURL added in v0.2.0

func (m *Module) GetRegistryURL() string

GetRegistryURL returns the configured registry URL

func (*Module) GetTemplate

func (m *Module) GetTemplate(theme, template string) (*models.ThemeTemplate, error)

GetTemplate returns the template for the given theme and template.

func (*Module) GetTheme

func (m *Module) GetTheme(name string) (*models.Theme, string, error)

GetTheme returns an installed theme with all related assets populated.

func (*Module) Init

func (m *Module) Init(c *service.Config)

Init implements service.Init

func (*Module) InstallThemeFromPackage

func (m *Module) InstallThemeFromPackage(p *packages.Package) error

InstallThemeFromPackage to the default store from a remote git. todo: check for existing package

func (*Module) ListThemes

func (m *Module) ListThemes() ([]*models.Theme, error)

ListThemes returns a list of all installed themes.

func (*Module) NotFound

func (m *Module) NotFound(rw http.ResponseWriter, req *http.Request)

NotFound serves a 404 page from a 404.html asset, if it exists.

func (*Module) Registry

func (m *Module) Registry() (*packages.Registry, error)

Registry syncs and returns the current registry instance.

func (*Module) RenderPage added in v0.2.0

func (m *Module) RenderPage(w io.Writer, page *models.Page, context *context.EngineContext) error

Render a page using the theme and template specified therein.

func (*Module) SearchRegistry

func (m *Module) SearchRegistry(themeName string) (*packages.Package, error)

SearchRegistry searches the registry for the given theme name.

func (*Module) ServeHTTP

func (m *Module) ServeHTTP(rw http.ResponseWriter, req *http.Request)

ServeHTTP serves theme assets

func (*Module) UpdateTheme added in v0.2.0

func (m *Module) UpdateTheme(name, ref string) error

type ThemesConfig

type ThemesConfig struct {
	Themes struct {
		Path        string `json:"path"`
		RegistryURL string `json:"registry_url"`
	} `json:"themes"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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