content

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterExpr

func FilterExpr(filter string) func(*Page) bool

Types

type Asset

type Asset struct {
	File      string
	Path      string
	Permalink string
}

type Assets

type Assets []*Asset

type File

type File struct {
	Path         string // tech/develop/rust/rust-note.fr.md
	Dir          string // tech/develop/rust
	Name         string // rust-note.fr.md
	BaseName     string // rust-note
	LanguageName string // fr
	Ext          string // md
}

func (*File) GetFullPath

func (file *File) GetFullPath() string

func (*File) GetSectionPath

func (file *File) GetSectionPath() string

type Format

type Format struct {
	Name      string
	Path      string
	Template  string
	Permalink string
}

type Formats

type Formats []*Format

func (Formats) Find

func (fs Formats) Find(name string) *Format

type FrontMatter

type FrontMatter struct {
	*viper.Viper
}

func NewFrontMatter

func NewFrontMatter(m map[string]any) *FrontMatter

func (*FrontMatter) Get added in v0.1.6

func (fm *FrontMatter) Get(key string, defaults ...any) any

func (*FrontMatter) GetBool added in v0.1.6

func (fm *FrontMatter) GetBool(key string, defaults ...bool) bool

func (*FrontMatter) GetInt added in v0.1.6

func (fm *FrontMatter) GetInt(key string, defaults ...int) int

func (*FrontMatter) GetInt32 added in v0.1.6

func (fm *FrontMatter) GetInt32(key string, defaults ...int32) int32

func (*FrontMatter) GetInt64 added in v0.1.6

func (fm *FrontMatter) GetInt64(key string, defaults ...int64) int64

func (*FrontMatter) GetString added in v0.1.6

func (fm *FrontMatter) GetString(key string, defaults ...string) string

func (*FrontMatter) GetStringMap added in v0.1.6

func (fm *FrontMatter) GetStringMap(key string, defaults ...map[string]any) map[string]any

func (*FrontMatter) GetStringSlice added in v0.1.6

func (fm *FrontMatter) GetStringSlice(key string, defaults ...[]string) []string

func (*FrontMatter) MergeFrom

func (fm *FrontMatter) MergeFrom(m map[string]any)

type Heading added in v0.1.6

type Heading = parser.Heading

type Node

type Node struct {
	File        *File
	FrontMatter *FrontMatter

	Toc        []*Heading
	Lang       string
	Slug       string
	Title      string
	Summary    string
	Content    string
	RawContent string
}

type Page

type Page struct {
	*Node

	IsBundle  bool
	Draft     bool
	Hidden    bool
	WordCount int64

	Date     time.Time
	Modified time.Time

	Path      string
	Permalink string

	Assets  Assets
	Formats Formats

	Prev *Page
	Next *Page
}

type Pages

type Pages []*Page

func (Pages) FilterBy

func (pages Pages) FilterBy(filter string) Pages

func (Pages) First

func (pages Pages) First() *Page

func (Pages) GroupBy

func (pages Pages) GroupBy(key string) TaxonomyTerms

func (Pages) Last

func (pages Pages) Last() *Page

func (Pages) OrderBy

func (pages Pages) OrderBy(key string) Pages

func (Pages) PaginateBy

func (pages Pages) PaginateBy(number int, path string, paginatePath string) []*Paginator[*Page]

func (Pages) Related

func (pages Pages) Related() *RelatedPages

func (Pages) SortBy

func (pages Pages) SortBy(key string)

type Paginator

type Paginator[T any] struct {
	Next    *Paginator[T]
	Prev    *Paginator[T]
	Total   int
	PageNum int
	List    []T
	Path    string
	All     []*Paginator[T]
}

func Paginate

func Paginate[T any](list []T, number int, path string, paginatePath string) []*Paginator[T]

func (*Paginator[T]) First

func (p *Paginator[T]) First() *Paginator[T]

func (*Paginator[T]) HasNext

func (p *Paginator[T]) HasNext() bool

func (*Paginator[T]) HasPrev

func (p *Paginator[T]) HasPrev() bool

func (*Paginator[T]) Last

func (p *Paginator[T]) Last() *Paginator[T]

func (*Paginator[T]) Page

func (p *Paginator[T]) Page(number int) *Paginator[T]

type Processor

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

func NewProcessor

func NewProcessor(ctx *core.Context, opts ...ProcessorOption) *Processor

func (*Processor) IsPage

func (d *Processor) IsPage(fullpath string) bool

func (*Processor) IsPageBundle

func (d *Processor) IsPageBundle(fullpath string) ([]string, bool)

func (*Processor) IsSection

func (d *Processor) IsSection(fullpath string) ([]string, bool)

func (*Processor) ParsePage

func (d *Processor) ParsePage(fullpath string, isBundle bool) (*Page, error)

func (*Processor) ParsePageAssets

func (d *Processor) ParsePageAssets(fullpath string, page *Page) (Assets, error)

func (*Processor) ParsePageFormats

func (d *Processor) ParsePageFormats(page *Page) Formats

func (*Processor) ParseRootSection

func (d *Processor) ParseRootSection(fullpath string) (Sections, error)

func (*Processor) ParseSection

func (d *Processor) ParseSection(fullpath string) (*Section, error)

func (*Processor) ParseSectionAssets

func (d *Processor) ParseSectionAssets(fullpath string, section *Section) Assets

func (*Processor) ParseSectionFormats

func (d *Processor) ParseSectionFormats(section *Section) Formats

func (*Processor) ParseTaxonomies

func (d *Processor) ParseTaxonomies(pages Pages, lang string) Taxonomies

func (*Processor) ParseTaxonomyTermFormats

func (d *Processor) ParseTaxonomyTermFormats(term *TaxonomyTerm, lang string) Formats

func (*Processor) ParseTaxonomyTerms

func (d *Processor) ParseTaxonomyTerms(taxonomy *Taxonomy, pages Pages, lang string) TaxonomyTerms

func (*Processor) RenderPage

func (d *Processor) RenderPage(page *Page, tplset template.TemplateSet, writer core.Writer) error

func (*Processor) RenderSection

func (d *Processor) RenderSection(section *Section, tplset template.TemplateSet, writer core.Writer) error

func (*Processor) RenderTaxonomy

func (d *Processor) RenderTaxonomy(taxonomy *Taxonomy, tplset template.TemplateSet, writer core.Writer) error

func (*Processor) RenderTaxonomyTerm

func (d *Processor) RenderTaxonomyTerm(term *TaxonomyTerm, tplset template.TemplateSet, writer core.Writer) error

func (*Processor) RenderTemplate

func (d *Processor) RenderTemplate(path string, tpl template.Template, vars map[string]any, writer core.Writer) error

type ProcessorOption

type ProcessorOption func(*Processor)

func WithParser

func WithParser(p parser.Parser) ProcessorOption

type RelatedPages

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

func (*RelatedPages) Next

func (r *RelatedPages) Next(page *Page) *Page

func (*RelatedPages) Prev

func (r *RelatedPages) Prev(page *Page) *Page

type Section

type Section struct {
	*Node

	Path      string
	Permalink string

	Pages    Pages
	Assets   Assets
	Formats  Formats
	Children Sections
}

type Sections

type Sections []*Section

func (Sections) Len

func (secs Sections) Len() int

func (Sections) Less

func (secs Sections) Less(i, j int) bool

func (Sections) Swap

func (secs Sections) Swap(i, j int)

type Taxonomies

type Taxonomies []*Taxonomy

func (Taxonomies) SortBy

func (ts Taxonomies) SortBy(key string)

type Taxonomy

type Taxonomy struct {
	Lang      string
	Name      string
	Weight    int
	Path      string
	Permalink string
	Terms     TaxonomyTerms
}

type TaxonomyTerm

type TaxonomyTerm struct {
	Name string

	Slug      string
	Path      string
	Permalink string

	Parent   *TaxonomyTerm
	Children TaxonomyTerms

	Pages    Pages
	Formats  Formats
	Taxonomy *Taxonomy
}

func (*TaxonomyTerm) FindChild

func (term *TaxonomyTerm) FindChild(name string) *TaxonomyTerm

func (*TaxonomyTerm) GetFullName

func (term *TaxonomyTerm) GetFullName() string

type TaxonomyTerms

type TaxonomyTerms []*TaxonomyTerm

func (TaxonomyTerms) OrderBy

func (terms TaxonomyTerms) OrderBy(key string) TaxonomyTerms

func (TaxonomyTerms) SortBy

func (terms TaxonomyTerms) SortBy(key string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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