contenthub

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	KindPage    = "page"
	KindHome    = "home"
	KindSection = "section"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildStateReseter

type BuildStateReseter interface {
	ResetBuildState()
}

type ContentConvertProvider

type ContentConvertProvider interface {
	GetContentConvertProvider(name string) ConverterProvider
}

type ContentHub

type ContentHub interface {
	CollectPages() error
	PreparePages() error
	RenderPages(td TemplateDescriptor, cb func(info PageInfo) error) error

	RenderString(ctx context.Context, args ...any) (goTmpl.HTML, error)

	SetTemplateExecutor(exec Template)

	Title
}

type ContentNode

type ContentNode interface {
	identity.IdentityProvider
	identity.ForEeachIdentityProvider
	stale.Marker
	BuildStateReseter

	Path() string
	IsContentNodeBranch() bool
}

type ContentProvider

type ContentProvider interface {
	Content() (any, error)
}

ContentProvider provides the content related values for a Page.

type Converter

type Converter interface {
	Convert(ctx markdown.RenderContext) (markdown.Result, error)
}

Converter wraps the Convert method that converts some markup into another format, e.g. Markdown to HTML.

type ConverterProvider

type ConverterProvider interface {
	New(ctx markdown.DocumentContext) (Converter, error)
	Name() string
}

ConverterProvider creates converters.

type ConverterRegistry

type ConverterRegistry interface {
	Get(name string) ConverterProvider
}

type File

type File interface {
	FileWithoutOverlap
	// contains filtered or unexported methods
}

File represents a source file. This is a temporary construct until we resolve page.Page conflicts.

type FileProvider

type FileProvider interface {
	File() File
}

FileProvider provides the source file.

type FileWithoutOverlap

type FileWithoutOverlap interface {

	// Filename gets the full path and filename to the file.
	Filename() string

	// Dir gets the name of the directory that contains this file.
	// The directory is relative to the content root.
	Dir() string

	// Ext gets the file extension, i.e "myblogpost.md" will return "md".
	Ext() string

	// LogicalName is filename and extension of the file.
	LogicalName() string

	// BaseFileName is a filename without extension.
	BaseFileName() string

	// TranslationBaseName is a filename with no extension,
	// not even the optional language extension part.
	TranslationBaseName() string

	// ContentBaseName is a either TranslationBaseName or name of containing folder
	// if file is a leaf bundle.
	ContentBaseName() string

	// UniqueID is the MD5 hash of the file's path and is for most practical applications,
	// Hugo content files being one of them, considered to be unique.
	UniqueID() string

	FileInfo() fs.FileMetaInfo
}

type FsService

type FsService interface {
	NewFileMetaInfo(filename string) fs.FileMetaInfo

	LayoutFs() afero.Fs
	ContentFs() afero.Fs

	WalkContent(start string, cb fs.WalkCallback, conf fs.WalkwayConfig) error
}

type LangService

type LangService interface {
	IsLanguageValid(lang string) bool
	GetSourceLang(source string) (string, bool)
	GetLanguageIndex(lang string) (int, error)
	DefaultLanguage() string
}

type MediaService

type MediaService interface {
	MediaTypes() media.Types
}

type OrdinalWeightPage

type OrdinalWeightPage interface {
	Weight() int
	Ordinal() int

	Page
}

type Page

type Page interface {
	RawContentProvider

	PageSource
	PageMeta

	Title() string
	Kind() string
	IsHome() bool
	IsPage() bool
	IsSection() bool
	IsAncestor(other Page) bool
	Eq(other Page) bool

	Layouts() []string
	PageOutputs() ([]PageOutput, error)

	Pages(langIndex int) Pages
	Terms(langIndex int, taxonomy string) Pages
	Translations() Pages
}

Page is the core interface in Hugo.

type PageIdentity

type PageIdentity interface {
	identity.Identity

	PageLanguage() string
	PageLanguageIndex() int
}

type PageInfo

type PageInfo interface {
	Kind() string
	Sections() []string
	Dir() string
	Name() string
	Buffer() *bytes.Buffer
}

type PageMeta

type PageMeta interface {
	Description() string
	Params() maps.Params
	PageWeight() int

	ShouldList(global bool) bool
	ShouldListAny() bool
	NoLink() bool
}

type PageMetaProvider

type PageMetaProvider interface {

	// Kind The Page Kind. One of page, home, section, taxonomy, term.
	Kind() string

	// SectionsEntries Returns a slice of sections (directories if it's a file) to this
	// Page.
	SectionsEntries() []string

	// Layout The configured layout to use to render this page. Typically set in front matter.
	Layout() string

	// Type is a discriminator used to select layouts etc. It is typically set
	// in front matter, but will fall back to the root section.
	Type() string

	Lang() string
	Path() string
}

PageMetaProvider provides page metadata, typically provided via front matter.

type PageOutput

type PageOutput interface {
	TargetFilePath() string
	TargetSubResourceDir() string
	TargetPrefix() string
	TargetFormat() output.Format

	Content() (any, error)
	Summary() goTmpl.HTML
	TableOfContents() goTmpl.HTML
}

type PageSource

type PageSource interface {
	PageIdentity() PageIdentity
	PageFile() File

	stale.Staler

	Section() string
	Paths() *paths.Path
	Path() string
	Opener() pio.OpenReadSeekCloser
}

type PageWithoutContent

type PageWithoutContent interface {
	// FileProvider For pages backed by a file.
	FileProvider

	PageMetaProvider
}

PageWithoutContent is the Page without any of the content methods.

type Pages

type Pages []Page

type ProviderProvider

type ProviderProvider interface {
	New() (ConverterProvider, error)
}

ProviderProvider creates converter providers.

type RawContentProvider

type RawContentProvider interface {
	// RawContent returns the raw, unprocessed content of the page excluding any front matter.
	RawContent() string
	PureContent() string
}

RawContentProvider provides the raw, unprocessed content of the page.

type Services

type Services interface {
	LangService
	FsService
	TaxonomyService
	MediaService
}

type Taxonomy

type Taxonomy interface {
	Singular() string // e.g. "category"
	Plural() string   // e.g. "categories"
}

type TaxonomyService

type TaxonomyService interface {
	Views() []Taxonomy
}

type Template

type Template interface {
	ExecuteWithContext(ctx context.Context, tmpl template.Preparer, wr io.Writer, data any) error
	LookupVariants(name string) []template.Preparer
	LookupVariant(name string, variants template.Variants) (template.Preparer, bool, bool)
}

type TemplateDescriptor

type TemplateDescriptor interface {
	Name() string
	Extension() string
}

type Title

type Title interface {
	CreateTitle(raw string) string
}

type WalkFunc

type WalkFunc func(Page) error

type WalkTaxonomyFunc

type WalkTaxonomyFunc func(taxonomy string, term string, page OrdinalWeightPage) error

type WeightedContentNode

type WeightedContentNode interface {
	ContentNode
	Weight() int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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