entity

package
v0.0.0-...-4abba12 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: Apache-2.0 Imports: 31 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 Language

type Language struct {
	LangSvc site.LanguageService
	// contains filtered or unexported fields
}

func (*Language) Collator

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

func (*Language) CurrentLanguageIndex

func (l *Language) CurrentLanguageIndex() int

func (*Language) Lang

func (l *Language) Lang() string

func (*Language) LanguageCode

func (l *Language) LanguageCode() string

func (*Language) LanguageDirection

func (l *Language) LanguageDirection() string

func (*Language) LanguageName

func (l *Language) LanguageName() string

func (*Language) LanguagePrefix

func (l *Language) LanguagePrefix() string

func (*Language) Languages

func (l *Language) Languages() []Language

func (*Language) Location

func (l *Language) Location() *time.Location
type Navigation struct {
	// contains filtered or unexported fields
}

type Page

type Page struct {
	contenthub.Page
	contenthub.PageOutput

	*Site
	// contains filtered or unexported fields
}

func (*Page) Data

func (p *Page) Data() map[string]any

func (*Page) Date

func (p *Page) Date() time.Time

func (*Page) ExpiryDate

func (p *Page) ExpiryDate() time.Time

func (*Page) File

func (p *Page) File() contenthub.File

func (*Page) Lastmod

func (p *Page) Lastmod() time.Time

func (*Page) OutputFormats

func (p *Page) OutputFormats() valueobject.OutputFormats

func (*Page) Pages

func (p *Page) Pages() contenthub.Pages

func (*Page) Params

func (p *Page) Params() maps.Params
func (p *Page) Permalink() string

func (*Page) PublishDate

func (p *Page) PublishDate() time.Time
func (p *Page) RelPermalink() string

func (*Page) Resources

func (p *Page) Resources() PageResources

func (*Page) Section

func (p *Page) Section() string

func (*Page) Sites

func (p *Page) Sites() *sites

func (*Page) Translations

func (p *Page) Translations() []string

type PageResources

type PageResources []resources.Resource

func (PageResources) ByType

func (r PageResources) ByType(typ any) PageResources

ByType returns resources of a given resource type (e.g. "image").

func (PageResources) Get

func (r PageResources) Get(name any) resources.Resource

Get locates the name given in Resources. The search is case insensitive.

func (PageResources) GetMatch

func (r PageResources) GetMatch(pattern any) resources.Resource

GetMatch finds the first Resource matching the given pattern, or nil if none found. See Match for a more complete explanation about the rules used.

type Pages

type Pages []Page

func (Pages) Len

func (p Pages) Len() int

Len returns the number of pages in the list.

func (Pages) String

func (p Pages) String() string

type Publisher

type Publisher struct {
	Fs afero.Fs
}

func (*Publisher) Publish

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

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

func (*Publisher) PublishFiles

func (p *Publisher) PublishFiles(fr io.ReadSeekCloser, filenames ...string) error

func (*Publisher) PublishSource

func (p *Publisher) PublishSource(src *bytes.Buffer, filename ...string) error

type Render

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

type Site

type Site struct {
	ContentSvc   site.ContentService
	ResourcesSvc site.ResourceService

	Publisher *Publisher

	Template site.Template

	*valueobject.Author
	*valueobject.Compiler

	Title string

	*URL
	*Language
	*Navigation

	Log loggers.Logger `json:"-"`
	// contains filtered or unexported fields
}

func (*Site) AbsURL

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

func (*Site) Build

func (s *Site) Build(t site.Template) error

func (*Site) GetPage

func (s *Site) GetPage(ref ...string) (*Page, error)

func (*Site) GitInfo

func (s *Site) GitInfo() valueobject.GitInfo

func (*Site) Home

func (s *Site) Home() *Page

func (*Site) IsMultiLingual

func (s *Site) IsMultiLingual() bool

func (*Site) Menus

func (s *Site) Menus() valueobject.Menus

func (*Site) Pages

func (s *Site) Pages() contenthub.Pages

func (*Site) Params

func (s *Site) Params() maps.Params

func (*Site) PrepareLazyLoads

func (s *Site) PrepareLazyLoads()

func (*Site) RelURL

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

func (*Site) Taxonomies

func (s *Site) Taxonomies() TaxonomyList

type Taxonomy

type Taxonomy map[string]contenthub.OrdinalWeightPage

A Taxonomy is a map of keywords to a list of pages. For example

TagTaxonomy['technology'] = WeightedPages
TagTaxonomy['go']  =  WeightedPages

type TaxonomyList

type TaxonomyList map[string]Taxonomy

The TaxonomyList is a list of all taxonomies and their values e.g. List['tags'] => TagTaxonomy (from above)

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