Documentation
¶
Overview ¶
Package parser provides tag parsing and tracking for content pages.
Generic taxonomy system for tags, categories, series, and custom taxonomies. Provides unified parsing, tracking, and organization of content classifications.
Index ¶
- type ContentParser
- func (p *ContentParser) GetMarkdownProcessor() goldmark.Markdown
- func (p *ContentParser) GetOrCreateSection(dir string) *content.Node
- func (p *ContentParser) Parse(rootDir string) error
- func (p *ContentParser) ParseFiles(rootDir string, files []string) error
- func (p *ContentParser) ParseTaxonomies(pageConfig *config.FrontMatter, pageNode *content.Node)
- func (p *ContentParser) RemovePageFromAllTaxonomies(pageNode *content.Node)
- func (p *ContentParser) ResetStats()
- func (p *ContentParser) SetShortcodeTemplates(templates *template.Template)
- type ParseStats
- type SeriesPage
- type TagEntry
- type Taxonomy
- type TaxonomyEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContentParser ¶
type ContentParser struct {
Site *config.Site
ContentMap map[string]*content.Node
Tags map[string]*TagEntry
Taxonomies map[string]*Taxonomy
// contains filtered or unexported fields
}
func NewParser ¶
func NewParser(cfg *config.Site) *ContentParser
func (*ContentParser) GetMarkdownProcessor ¶
func (p *ContentParser) GetMarkdownProcessor() goldmark.Markdown
func (*ContentParser) GetOrCreateSection ¶
func (p *ContentParser) GetOrCreateSection(dir string) *content.Node
func (*ContentParser) Parse ¶
func (p *ContentParser) Parse(rootDir string) error
func (*ContentParser) ParseFiles ¶ added in v0.0.29
func (p *ContentParser) ParseFiles(rootDir string, files []string) error
func (*ContentParser) ParseTaxonomies ¶ added in v0.0.33
func (p *ContentParser) ParseTaxonomies(pageConfig *config.FrontMatter, pageNode *content.Node)
ParseTaxonomies extracts and indexes all taxonomies from frontmatter.
func (*ContentParser) RemovePageFromAllTaxonomies ¶ added in v0.0.33
func (p *ContentParser) RemovePageFromAllTaxonomies(pageNode *content.Node)
RemovePageFromAllTaxonomies removes a page from all taxonomy entries. This should be called before re-parsing a page's taxonomies during incremental builds.
func (*ContentParser) ResetStats ¶ added in v0.0.29
func (p *ContentParser) ResetStats()
func (*ContentParser) SetShortcodeTemplates ¶ added in v0.0.33
func (p *ContentParser) SetShortcodeTemplates(templates *template.Template)
type ParseStats ¶ added in v0.0.29
type SeriesPage ¶ added in v0.0.33
type SeriesPage struct {
Node *content.Node
Order int // series_order from frontmatter
Position int // Calculated position (1-based)
}
SeriesPage wraps a page with its position in a series.
type Taxonomy ¶ added in v0.0.33
type Taxonomy struct {
Name string // Taxonomy name (e.g., "tags", "series")
Entries map[string]*TaxonomyEntry // Slug -> entry mapping
Config config.TaxonomyConfig // Configuration
}
Taxonomy represents a classification system (tags, categories, series, etc.)
func NewTaxonomy ¶ added in v0.0.33
func NewTaxonomy(name string, cfg config.TaxonomyConfig) *Taxonomy
NewTaxonomy creates a new taxonomy with the given configuration.
func (*Taxonomy) GetOrCreateEntry ¶ added in v0.0.33
func (t *Taxonomy) GetOrCreateEntry(term, slug string) *TaxonomyEntry
GetOrCreateEntry gets or creates a taxonomy entry for a term.
type TaxonomyEntry ¶ added in v0.0.33
type TaxonomyEntry struct {
Term string // Original term (e.g., "Git Mastery")
Slug string // URL-friendly slug
Pages []*content.Node // Associated pages
Count int // Number of pages
Metadata map[string]any // Extra data (e.g., series order)
Seen map[string]struct{} // Deduplication tracking
}
TaxonomyEntry tracks pages for a specific taxonomy term.
func NewTaxonomyEntry ¶ added in v0.0.33
func NewTaxonomyEntry(term, slug string) *TaxonomyEntry
NewTaxonomyEntry creates a new taxonomy entry for a term.
func (*TaxonomyEntry) AddPage ¶ added in v0.0.33
func (te *TaxonomyEntry) AddPage(node *content.Node, metadata map[string]any)
AddPage adds a page to this taxonomy entry.
func (*TaxonomyEntry) GetSeriesPages ¶ added in v0.0.33
func (te *TaxonomyEntry) GetSeriesPages() []*SeriesPage
GetSeriesPages returns pages ordered by series_order for a series taxonomy entry.