Documentation
¶
Overview ¶
Package processor builds dependency graphs and processes articles for output.
Package processor builds dependency graphs and taxonomies from parsed articles.
Index ¶
- func BuildCategoryIndex(articles []*model.ProcessedArticle) map[string][]*model.ProcessedArticle
- func BuildTagIndex(articles []*model.ProcessedArticle) map[string][]*model.ProcessedArticle
- func CalculateDiff(oldGraph, newGraph *model.DependencyGraph) (*model.ChangeSet, error)
- func CalculateImpact(g *model.DependencyGraph, changedPath string) []string
- func LoadTaxonomyRegistry(taxonomyDir string) (*model.TaxonomyRegistry, error)
- func ValidateArticleTaxonomies(articles []*model.ProcessedArticle, registry *model.TaxonomyRegistry) []error
- type Processor
- type SiteProcessor
- func (p *SiteProcessor) BuildDependencyGraph(articles []*model.ProcessedArticle) (*model.DependencyGraph, error)
- func (p *SiteProcessor) BuildTaxonomyRegistry(articles []*model.ProcessedArticle, cfg model.Config) (*model.TaxonomyRegistry, error)
- func (p *SiteProcessor) BuildTranslationMap(articles []*model.ProcessedArticle)
- func (p *SiteProcessor) Process(articles []*model.Article, cfg model.Config) ([]*model.ProcessedArticle, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildCategoryIndex ¶
func BuildCategoryIndex(articles []*model.ProcessedArticle) map[string][]*model.ProcessedArticle
BuildCategoryIndex returns a map from category name to the articles that use it.
func BuildTagIndex ¶
func BuildTagIndex(articles []*model.ProcessedArticle) map[string][]*model.ProcessedArticle
BuildTagIndex returns a map from tag name to the articles that use that tag.
func CalculateDiff ¶
func CalculateDiff(oldGraph, newGraph *model.DependencyGraph) (*model.ChangeSet, error)
CalculateDiff compares two dependency graphs and returns a ChangeSet describing added, deleted, and modified nodes.
func CalculateImpact ¶
func CalculateImpact(g *model.DependencyGraph, changedPath string) []string
CalculateImpact returns all node paths that are transitively impacted when changedPath changes (i.e., changedPath plus all its transitive dependents).
func LoadTaxonomyRegistry ¶
func LoadTaxonomyRegistry(taxonomyDir string) (*model.TaxonomyRegistry, error)
LoadTaxonomyRegistry reads tags.yaml and categories.yaml from taxonomyDir and returns the combined TaxonomyRegistry. Missing files are treated as empty (no error).
func ValidateArticleTaxonomies ¶
func ValidateArticleTaxonomies(articles []*model.ProcessedArticle, registry *model.TaxonomyRegistry) []error
ValidateArticleTaxonomies checks that every tag and category referenced in an article exists in the registry. It returns one error per violation.
Types ¶
type Processor ¶
type Processor interface {
// Process converts a slice of Articles into ProcessedArticles, rendering
// Markdown to HTML, extracting summaries, resolving output paths, etc.
Process(articles []*model.Article, cfg model.Config) ([]*model.ProcessedArticle, error)
// BuildDependencyGraph constructs the full DependencyGraph from the
// complete set of ProcessedArticles.
BuildDependencyGraph(articles []*model.ProcessedArticle) (*model.DependencyGraph, error)
// BuildTaxonomyRegistry collects all tags and categories referenced across
// all articles and validates them against the configured taxonomy YAML files.
BuildTaxonomyRegistry(articles []*model.ProcessedArticle, cfg model.Config) (*model.TaxonomyRegistry, error)
// BuildTranslationMap links articles that share a TranslationKey by
// populating their Translations field. Should be called after Process.
BuildTranslationMap(articles []*model.ProcessedArticle)
}
Processor enriches raw Article data and builds the site-wide dependency graph and taxonomy registry that are required for incremental builds.
type SiteProcessor ¶
type SiteProcessor struct{}
SiteProcessor implements the Processor interface.
func NewSiteProcessor ¶
func NewSiteProcessor() *SiteProcessor
NewSiteProcessor returns a new SiteProcessor.
func (*SiteProcessor) BuildDependencyGraph ¶
func (p *SiteProcessor) BuildDependencyGraph(articles []*model.ProcessedArticle) (*model.DependencyGraph, error)
BuildDependencyGraph constructs a DependencyGraph from all processed articles, linking each article to its tag, category, and archive (year) nodes.
func (*SiteProcessor) BuildTaxonomyRegistry ¶
func (p *SiteProcessor) BuildTaxonomyRegistry(articles []*model.ProcessedArticle, cfg model.Config) (*model.TaxonomyRegistry, error)
BuildTaxonomyRegistry collects all unique tags and categories referenced across the article set and returns a TaxonomyRegistry.
func (*SiteProcessor) BuildTranslationMap ¶
func (p *SiteProcessor) BuildTranslationMap(articles []*model.ProcessedArticle)
BuildTranslationMap populates the Translations field of each ProcessedArticle that has a TranslationKey set, linking it to sibling articles in other locales. Call this once after all articles have been processed.
func (*SiteProcessor) Process ¶
func (p *SiteProcessor) Process(articles []*model.Article, cfg model.Config) ([]*model.ProcessedArticle, error)
Process converts raw Articles into ProcessedArticles by rendering Markdown to HTML, extracting summaries, and computing output paths.