Documentation
¶
Index ¶
- Variables
- func ApplyTransforms(k string, v any, tx []ValueTransformer) (any, error)
- func ConfigDefault(config *SiteConfig)
- func EmailMarshal(data map[string]any) ([]byte, error)
- func EmailUnmarshal(src []byte, out map[string]any, tx ...ValueTransformer) error
- func Identity(wr io.Writer, src io.Reader, data any) error
- func Joiner(head MetaHeadType, meta []byte, body []byte) []byte
- func LoadContent(config SiteConfig, out *[]ContentSourceConfig) error
- func Main2(config SiteConfig, pages *[]ContentSourceConfig) error
- func MetaSplitEmail(s []byte) ([]byte, []byte)
- func MetaSplitJson(s []byte) ([]byte, []byte)
- func MetaSplitToml(s []byte) ([]byte, []byte)
- func MetaSplitYaml(s []byte) ([]byte, []byte)
- func MultiRender(renders []Renderer, initial []byte, data any) error
- func Set(kv map[string]any, k string, v any, tx []ValueTransformer) error
- func Splitter(head MetaHeadType, s []byte) ([]byte, []byte)
- type ContentSourceConfig
- type ContentSplitter
- type MetaHeadType
- type MetaParser
- type Renderer
- type SiteConfig
- type TemplateRouter
- type ValueTransformer
Constants ¶
This section is empty.
Variables ¶
View Source
var MetaHeadEmail = MetaHeadType{ Name: "email", Prefix: []byte(""), Suffix: []byte("\n\n\n"), KeepMarkers: false, }
View Source
var MetaHeadJson = MetaHeadType{ Name: "json", Prefix: []byte("{\n"), Suffix: []byte("\n}\n"), KeepMarkers: true, }
View Source
var MetaHeadToml = MetaHeadType{ Name: "toml", Prefix: []byte("+++\n"), Suffix: []byte("\n+++\n"), KeepMarkers: false, }
View Source
var MetaHeadYaml = MetaHeadType{ Name: "yaml", Prefix: []byte("---\n"), Suffix: []byte("\n---\n"), KeepMarkers: false, }
Functions ¶
func ApplyTransforms ¶
func ApplyTransforms(k string, v any, tx []ValueTransformer) (any, error)
func ConfigDefault ¶
func ConfigDefault(config *SiteConfig)
func EmailUnmarshal ¶
func EmailUnmarshal(src []byte, out map[string]any, tx ...ValueTransformer) error
func LoadContent ¶
func LoadContent(config SiteConfig, out *[]ContentSourceConfig) error
func Main2 ¶
func Main2(config SiteConfig, pages *[]ContentSourceConfig) error
func MetaSplitEmail ¶
func MetaSplitJson ¶
func MetaSplitToml ¶
func MetaSplitYaml ¶
Types ¶
type ContentSourceConfig ¶
Default ContentSource -- it's just a map any with some specific accessors
func MetaParseJson ¶
func MetaParseJson(s []byte) (ContentSourceConfig, error)
MetaParseJson that reads front matter as JSON, using the golang stdlib, and returns a map[string]any type.
func (ContentSourceConfig) Get ¶
func (csc ContentSourceConfig) Get(key string) string
func (ContentSourceConfig) InputFile ¶
func (csc ContentSourceConfig) InputFile() string
func (ContentSourceConfig) OutputFile ¶
func (csc ContentSourceConfig) OutputFile() string
func (ContentSourceConfig) TemplateName ¶
func (csc ContentSourceConfig) TemplateName() string
type ContentSplitter ¶
Splits Input into metadata and the main content/body
type MetaHeadType ¶
type MetaParser ¶
type MetaParser func(s []byte) (ContentSourceConfig, error)
MetaParser parses the front matter and returns a content source
func MetaParseEmail ¶
func MetaParseEmail(tx ...ValueTransformer) MetaParser
MetaParseEmail parsed input as "email headers" (better name TBD)
type Renderer ¶
"Template Macro" processes source and writing output
"data" is optional supplemental data. It is just passed on to the
underlying implementation. If not used, then data can be nil.
func NewTemplateMacro ¶
create a simple macro maker. You pass-in whatever funcs.
each page is parsed as a text/template then executed
func WriteOutput ¶
type SiteConfig ¶
type SiteConfig struct {
BaseTemplate string
ContentDir string
MetaSplit ContentSplitter
MetaParser MetaParser
InputExt string // ".md"
OutputExt string // ".html"
IndexSource string // "index.md"
IndexDest string // "index.html"
Pipeline []Renderer
}
type TemplateRouter ¶
func (TemplateRouter) ExecuteTemplate ¶
type ValueTransformer ¶
func AsList ¶
func AsList(key string) ValueTransformer
Source Files
¶
Click to show internal directories.
Click to hide internal directories.