entity

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: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OpenFileForWriting

func OpenFileForWriting(fs afero.Fs, filename string) (afero.File, error)

OpenFileForWriting opens or creates the given file. If the target directory does not exist, it gets created.

Types

type Collator

type Collator struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*Collator) CompareStrings

func (c *Collator) CompareStrings(a, b string) int

CompareStrings compares a and b. It returns -1 if a < b, 1 if a > b and 0 if a == b. Note that the Collator is not thread safe, so you may want to acquire a lock on it before calling this method.

type DestinationPublisher

type DestinationPublisher struct {
	Fs afero.Fs
}

DestinationPublisher is the default and currently only publisher in Hugo. This publisher prepares and publishes an item to the defined destination, e.g. /public.

func (*DestinationPublisher) Publish

func (p *DestinationPublisher) Publish(d site.Descriptor) error

Publish applies any relevant transformations and writes the file to its destination, e.g. /public.

type Language

type Language struct {
	Config []site.LanguageConfig
	// contains filtered or unexported fields
}

func (*Language) Collator

func (l *Language) Collator() *collate.Collator

func (*Language) DefaultContentLanguage

func (l *Language) DefaultContentLanguage() site.LanguageConfig

func (*Language) LanguagePrefix

func (l *Language) LanguagePrefix() string

func (*Language) Location

func (l *Language) Location() *time.Location

type Site

type Site struct {
	// Output formats defined in site config per Page Kind, or some defaults
	// if not set.
	// Output formats defined in Page front matter will override these.
	OutputFormats map[string]valueobject.Formats

	// The output formats that we need to render this site in. This slice
	// will be fixed once set.
	// This will be the union of Site.Pages' outputFormats.
	// This slice will be sorted.
	RenderFormats valueobject.Formats

	// All the output formats and media types available for this site.
	// These values will be merged from the Hugo defaults, the site config and,
	// finally, the language settings.
	OutputFormatsConfig valueobject.Formats
	MediaTypesConfig    media.Types

	Publisher site.Publisher

	ContentHub contenthub.ContentHub

	*URL
	*Language
}

func (*Site) AbsURL

func (s *Site) AbsURL(in string) string

func (*Site) Build

func (s *Site) Build() error

func (*Site) RelURL

func (s *Site) RelURL(in string) string

type URL

type URL struct {
	Base      string
	Canonical bool

	*valueobject.BaseURL
}

func (*URL) BasePathNoSlash

func (u *URL) BasePathNoSlash() string

func (*URL) IsAbsURL

func (u *URL) IsAbsURL(in string) (bool, error)

func (*URL) MakePath

func (u *URL) MakePath(s string) string

MakePath takes a string with any characters and replace it so the string could be used in a path. It does so by creating a Unicode-sanitized string, with the spaces replaced, whilst preserving the original casing of the string. E.g. Social Media -> Social-Media

func (*URL) MakePathSanitized

func (u *URL) MakePathSanitized(s string) string

MakePathSanitized creates a Unicode-sanitized string, with the spaces replaced

func (*URL) URLEscape

func (u *URL) URLEscape(uri string) string

URLEscape escapes unicode letters.

func (*URL) URLize

func (u *URL) URLize(uri string) string

URLize is similar to MakePath, but with Unicode handling Example:

uri: Vim (text editor)
urlize: vim-text-editor

Jump to

Keyboard shortcuts

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