pagesfromdata

package
v0.126.1 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildInfo

type BuildInfo struct {
	NumPagesAdded      uint64
	NumResourcesAdded  uint64
	EnableAllLanguages bool
	ChangedIdentities  []identity.Identity
	DeletedPaths       []string
	Path               *paths.Path
}

type BuildState

type BuildState struct {
	StaleVersion uint32

	EnableAllLanguages bool

	// Paths deleted in the current build.
	DeletedPaths []string

	// Changed identities in the current build.
	ChangedIdentities []identity.Identity

	NumPagesAdded     uint64
	NumResourcesAdded uint64
	// contains filtered or unexported fields
}

func (*BuildState) PrepareNextBuild

func (b *BuildState) PrepareNextBuild()

type PagesFromDataTemplateContext

type PagesFromDataTemplateContext interface {
	// AddPage adds a new page to the site.
	// The first return value will always be an empty string.
	AddPage(any) (string, error)

	// AddResource adds a new resource to the site.
	// The first return value will always be an empty string.
	AddResource(any) (string, error)

	// The site to which the pages will be added.
	Site() page.Site

	// The same template may be executed multiple times for multiple languages.
	// The Store can be used to store state between these invocations.
	Store() *maps.Scratch

	// By default, the template will be executed for the language
	// defined by the _content.gotmpl file (e.g. its mount definition).
	// This method can be used to activate the template for all languages.
	// The return value will always be an empty string.
	EnableAllLanguages() string
}

type PagesFromTemplate

type PagesFromTemplate struct {
	PagesFromTemplateOptions
	PagesFromTemplateDeps
	// contains filtered or unexported fields
}

func NewPagesFromTemplate

func NewPagesFromTemplate(opts PagesFromTemplateOptions) *PagesFromTemplate

func (*PagesFromTemplate) AddChange

func (b *PagesFromTemplate) AddChange(id identity.Identity)

func (PagesFromTemplate) CloneForGoTmpl

func (PagesFromTemplate) CloneForSite

func (p PagesFromTemplate) CloneForSite(s page.Site) *PagesFromTemplate

func (*PagesFromTemplate) Execute

func (p *PagesFromTemplate) Execute(ctx context.Context) (BuildInfo, error)

func (*PagesFromTemplate) GetDependencyManagerForScope

func (p *PagesFromTemplate) GetDependencyManagerForScope(scope int) identity.Manager

func (*PagesFromTemplate) MarkStale

func (b *PagesFromTemplate) MarkStale()

func (*PagesFromTemplate) StaleVersion

func (b *PagesFromTemplate) StaleVersion() uint32

type PagesFromTemplateDeps

type PagesFromTemplateDeps struct {
	TmplFinder tpl.TemplateParseFinder
	TmplExec   tpl.TemplateExecutor
}

type PagesFromTemplateOptions

type PagesFromTemplateOptions struct {
	Site         page.Site
	DepsFromSite func(page.Site) PagesFromTemplateDeps

	DependencyManager identity.Manager

	Watching bool

	HandlePage     func(pt *PagesFromTemplate, p *pagemeta.PageConfig) error
	HandleResource func(pt *PagesFromTemplate, p *pagemeta.ResourceConfig) error

	GoTmplFi hugofs.FileMetaInfo
}

Jump to

Keyboard shortcuts

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