valueobject

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Author

type Author struct {
	// contains filtered or unexported fields
}

func NewAuthor

func NewAuthor(name, email string) *Author

func (*Author) Email

func (a *Author) Email() string

func (*Author) Name

func (a *Author) Name() string

type BaseURL

type BaseURL struct {
	WithPath                string
	WithPathNoTrailingSlash string
	WithoutPath             string
	BasePath                string
	BasePathNoTrailingSlash string
	// contains filtered or unexported fields
}

A BaseURL in Hugo is normally on the form scheme://path, but the form scheme: is also valid (mailto:hugo@rules.com).

func NewBaseURLFromString

func NewBaseURLFromString(b string) (BaseURL, error)

func (BaseURL) GetRoot

func (b BaseURL) GetRoot(path string) string

func (BaseURL) HostURL

func (b BaseURL) HostURL() string

HostURL returns the URL to the host root without any path elements.

func (BaseURL) Path

func (b BaseURL) Path() string

func (BaseURL) Port

func (b BaseURL) Port() int

func (BaseURL) String

func (b BaseURL) String() string

func (BaseURL) URL

func (b BaseURL) URL() *url.URL

URL returns a copy of the internal URL. The copy can be safely used and modified.

func (BaseURL) WithPort

func (b BaseURL) WithPort(port int) (BaseURL, error)

func (BaseURL) WithProtocol

func (b BaseURL) WithProtocol(protocol string) (BaseURL, error)

WithProtocol returns the BaseURL prefixed with the given protocol. The Protocol is normally of the form "scheme://", i.e. "webcal://".

type Compiler

type Compiler struct {
	// contains filtered or unexported fields
}

func NewVersion

func NewVersion(ver string) *Compiler

func (Compiler) Version

func (v Compiler) Version() string

type GitInfo

type GitInfo struct {
	// Commit hash.
	Hash string `json:"hash"`
	// Abbreviated commit hash.
	AbbreviatedHash string `json:"abbreviatedHash"`
	// The commit message's subject/title line.
	Subject string `json:"subject"`
	// The author name, respecting .mailmap.
	AuthorName string `json:"authorName"`
	// The author email address, respecting .mailmap.
	AuthorEmail string `json:"authorEmail"`
	// The author date.
	AuthorDate time.Time `json:"authorDate"`
	// The commit date.
	CommitDate time.Time `json:"commitDate"`
}

GitInfo provides information about a version controlled source file.

func NewGitInfo

func NewGitInfo(info gitmap.GitInfo) GitInfo

type GitMap

type GitMap struct {
	ContentDir string
	Repo       *gitmap.GitRepo
}

func (*GitMap) GetInfo

func (g *GitMap) GetInfo(filename string) GitInfo
type Menu []*MenuEntry

Menu is a collection of menu entries.

func (m Menu) Add(me *MenuEntry) Menu
func (m Menu) Sort() Menu
type MenuConfig struct {
	Identifier string
	Parent     string
	Name       string
	Pre        template.HTML
	Post       template.HTML
	URL        string
	PageRef    string
	Weight     int
	Title      string
	// User defined params.
	Params maps.Params
}

MenuConfig holds the configuration for a menu.

type MenuEntry struct {
	// The menu entry configuration.
	MenuConfig

	// The menu containing this menu entry.
	Menu string

	// The URL value from front matter / config.
	ConfiguredURL string

	// Child entries.
	Children Menu

	// TODO, removed
	Page *MenuEntry
}

MenuEntry represents a menu item defined in either Page front matter or in the site config.

type Menus map[string]Menu

Menus is a dictionary of menus.

type OutputFormat

type OutputFormat struct {
	// Rel contains a value that can be used to construct a rel link.
	// This is value is fetched from the output format definition.
	// Note that for pages with only one output format,
	// this method will always return "canonical".
	// As an example, the AMP output format will, by default, return "amphtml".
	//
	// See:
	// https://www.ampproject.org/docs/guides/deploy/discovery
	//
	// Most other output formats will have "alternate" as value for this.
	Rel string

	Format output.Format
	// contains filtered or unexported fields
}

OutputFormat links to a representation of a resource.

func NewOutputFormat

func NewOutputFormat(relPermalink, permalink string, f output.Format) OutputFormat
func (o OutputFormat) Permalink() string

Permalink returns the absolute permalink to this output format.

func (o OutputFormat) RelPermalink() string

RelPermalink returns the relative permalink to this output format.

type OutputFormats

type OutputFormats []OutputFormat

OutputFormats holds a list of the relevant output formats for a given page.

func (OutputFormats) Get

func (o OutputFormats) Get(name string) *OutputFormat

Get gets a OutputFormat given its name, i.e. json, html etc. It returns nil if none found.

type PagePaths

type PagePaths struct {
	TargetPaths map[string]TargetPathsHolder
	// contains filtered or unexported fields
}

func NewPagePaths

func NewPagePaths(ofs output.Formats, page contenthub.PageInfo) (PagePaths, error)

func (PagePaths) OutputFormats

func (l PagePaths) OutputFormats() OutputFormats

type TargetPathDescriptor

type TargetPathDescriptor struct {
	Type output.Format
	Kind string

	Sections []string

	// For regular content pages this is either
	// 1) the Slug, if set,
	// 2) the file base name (TranslationBaseName).
	BaseName string

	// Source directory.
	Dir string

	// Typically a language prefix added to file paths.
	PrefixFilePath string

	// Typically a language prefix added to links.
	PrefixLink string

	// If in multihost mode etc., every link/path needs to be prefixed, even
	// if set in URL.
	ForcePrefix bool

	// URL from front matter if set. Will override any Slug etc.
	URL string

	// The expanded permalink if defined for the section, ready to use.
	ExpandedPermalink string
}

TargetPathDescriptor describes how a file path for a given resource should look like on the file system. The same descriptor is then later used to create both the permalinks and the relative links, paginator URLs etc.

The big motivating behind this is to have only one source of truth for URLs, and by that also get rid of most of the fragile string parsing/encoding etc.

type TargetPaths

type TargetPaths struct {

	// Where to store the file on disk relative to the publish dir. OS slashes.
	TargetFilename string

	// The directory to write sub-resources of the above.
	SubResourceBaseTarget string

	// The base for creating links to sub-resources of the above.
	SubResourceBaseLink string

	// The relative permalink to this resources. Unix slashes.
	Link string
}

func (TargetPaths) GetBasePath

func (p TargetPaths) GetBasePath(isRelativeURL bool) string

GetBasePath returns any path element in baseURL if needed.

func (TargetPaths) PermalinkForBaseURL

func (p TargetPaths) PermalinkForBaseURL(link, baseURL string) string

PermalinkForBaseURL creates a permalink from the given link and baseURL.

func (TargetPaths) PermalinkForOutputFormat

func (p TargetPaths) PermalinkForOutputFormat() string

func (TargetPaths) PrependBasePath

func (p TargetPaths) PrependBasePath(rel string, isAbs bool) string

PrependBasePath prepends any baseURL sub-folder to the given resource

func (p TargetPaths) RelPermalink() string

type TargetPathsHolder

type TargetPathsHolder struct {
	Paths TargetPaths
	OutputFormat
}

func (TargetPathsHolder) TargetPaths

func (t TargetPathsHolder) TargetPaths() TargetPaths

type TemplateDescriptor

type TemplateDescriptor struct {
	// contains filtered or unexported fields
}

func NewTemplateDescriptor

func NewTemplateDescriptor(name, ext string) *TemplateDescriptor

func (*TemplateDescriptor) Extension

func (td *TemplateDescriptor) Extension() string

func (*TemplateDescriptor) Name

func (td *TemplateDescriptor) Name() string

Jump to

Keyboard shortcuts

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