deps

package
v0.0.0-...-5b3a7c8 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deps

type Deps struct {
	// The logger to use.
	Log loggers.Logger `json:"-"`

	// The PathSpec to use
	*helpers.PathSpec `json:"-"`

	// All the output formats available for the current site.
	OutputFormatsConfig output.Formats

	// The Resource Spec to use
	ResourceSpec *resources.Spec

	// The SourceSpec to use
	SourceSpec *source.SourceSpec `json:"-"`

	// The ContentSpec to use
	*helpers.ContentSpec `json:"-"`

	// The site building.
	Site page.Site

	// The file systems to use.
	Fs *hugofs.Fs `json:"-"`

	// The configuration to use
	Cfg config.Provider `json:"-"`

	// The language in use. TODO(bep) consolidate with site
	Language *langs.Language

	// The translation func to use
	Translate func(translationID string, templateData any) string `json:"-"`
	// contains filtered or unexported fields
}

Deps holds dependencies used by many. There will be normally only one instance of deps in play at a given time, i.e. one per Site built.

func New

func New(cfg DepsCfg) (*Deps, error)

New initializes a Dep struct. Defaults are set for nil values, but TemplateProvider, TranslationProvider and Language are always required.

func (*Deps) LoadResources

func (d *Deps) LoadResources() error

LoadResources loads translations and templates.

func (*Deps) SetTextTmpl

func (d *Deps) SetTextTmpl(tmpl tpl.TemplateParseFinder)

func (*Deps) SetTmpl

func (d *Deps) SetTmpl(tmpl tpl.TemplateHandler)

func (*Deps) TextTmpl

func (d *Deps) TextTmpl() tpl.TemplateParseFinder

func (*Deps) Tmpl

func (d *Deps) Tmpl() tpl.TemplateHandler

type DepsCfg

type DepsCfg struct {
	// The language to use.
	Language *langs.Language

	// The file systems to use
	Fs *hugofs.Fs

	// The Site in use
	Site page.Site

	// The configuration to use.
	Cfg config.Provider

	// The media types configured.
	MediaTypes media.Types

	// The output formats configured.
	OutputFormats output.Formats

	// Template handling.
	TemplateProvider ResourceProvider
}

DepsCfg contains configuration options that can be used to configure Hugo on a global level, i.e. logging etc. Nil values will be given default values.

type ResourceProvider

type ResourceProvider interface {
	Update(deps *Deps) error
	Clone(deps *Deps) error
}

ResourceProvider is used to create and refresh, and clone resources needed.

Jump to

Keyboard shortcuts

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