contenthub

package
v0.0.0-...-394db76 Latest Latest
Warning

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

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

Documentation

Index

Constants

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

Variables

View Source
var AllKindsInPages = []string{KindPage, KindHome, KindSection}

Functions

This section is empty.

Types

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 TemplateExecutor)

	Title
}

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) (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

	// Extension is an alias to Ext().
	// Deprecated: Use Ext instead.
	Extension() 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() fsVO.FileMetaInfo
}

type Fs

type Fs interface {
	LayoutFs() afero.Fs
	ContentFs() afero.Fs
}

type Page

type Page interface {
	ContentProvider
	PageWithoutContent
}

Page is the core interface in Hugo.

type PageInfo

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

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
}

PageMetaProvider provides page metadata, typically provided via front matter.

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 ProviderProvider

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

ProviderProvider creates converter providers.

type Result

type Result interface {
	Bytes() []byte
}

Result represents the minimum returned from Convert.

type TemplateDescriptor

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

type TemplateExecutor

type TemplateExecutor interface {
	ExecuteWithContext(ctx context.Context, tmpl template.Preparer, wr io.Writer, data any) error
	LookupLayout(d template.LayoutDescriptor) (template.Preparer, bool, error)
}

type Title

type Title interface {
	CreateTitle(raw string) string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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