Documentation
¶
Index ¶
- Constants
- Variables
- func FormatBlock(block adoc.BlockElement) string
- func FormatDate(date time.Time, language Language, format DateFormat) string
- func FormatInline(src adoc.InlineElement) string
- func TruncateOnSpace(text string, maxChars int) string
- type DateFormat
- type HTMLPost
- type HTMLSummary
- type Kind
- type Language
- type Post
- type Posts
- func (p Posts) Len() int
- func (p Posts) Less(i, j int) bool
- func (p Posts) Limit(limit int) Posts
- func (p Posts) RemoveKind(kind Kind) Posts
- func (p Posts) SelectKind(wanted Kind) Posts
- func (p Posts) SelectTag(wanted Tag) Posts
- func (p Posts) SelectYear(year string) Posts
- func (p Posts) Sort() Posts
- func (p Posts) Swap(i, j int)
- func (p Posts) TagList() []string
- func (p Posts) YearList() []string
- type Site
- type SiteConfig
- type SiteID
- type StaticPage
- type Tag
- type TemplateConfig
- type XMLPost
Constants ¶
View Source
const ( SITE_EWNL = SiteID("ewnl") SITE_VKVNL = SiteID("vkvnl") )
View Source
const ( KIND_NOTE = Kind("note") KIND_STORY = Kind("story") KIND_ARTICLE = Kind("article") KIND_INVALID = Kind("") )
View Source
const ( LANGUAGE_EN = Language("en") LANGUAGE_NL = Language("nl") LANGUAGE_INVALID = Language("") )
Variables ¶
View Source
var ( SITE_CONFIG_EWNL = &SiteConfig{ ID: SITE_EWNL, BaseURL: "https://erikwinter.nl", PathsWithKind: true, TemplateConfigs: []*TemplateConfig{ { Name: "home", TemplateNames: []string{"list", "head", "menu"}, TemplateExt: "gohtml", Render: renderEWNLHome, }, { Name: "listings", TemplateNames: []string{"list", "head", "menu"}, TemplateExt: "gohtml", Render: renderEWNLListings, }, { Name: "archive", TemplateNames: []string{"archive", "head", "menu"}, TemplateExt: "gohtml", Render: renderEWNLArchive, }, { Name: "static", TemplateNames: []string{"static", "head", "menu"}, TemplateExt: "gohtml", Render: renderEWNLStaticPages, }, { Name: "posts", TemplateNames: []string{"post", "head", "menu"}, TemplateExt: "gohtml", Render: renderEWNLPosts, }, { Name: "rss", TemplateNames: []string{"rss"}, TemplateExt: "goxml", Render: renderEWNLRSS, }, }, KindMap: map[adoc.Kind]Kind{ adoc.KIND_NOTE: KIND_NOTE, adoc.KIND_VKV: KIND_STORY, adoc.KIND_ESSAY: KIND_ARTICLE, adoc.KIND_TUTORIAL: KIND_ARTICLE, adoc.KIND_ARTICLE: KIND_ARTICLE, }, } SITE_CONFIG_VKVNL = &SiteConfig{ ID: SITE_VKVNL, BaseURL: "https://vrijkorteverhalen.nl", PathsWithKind: false, TemplateConfigs: []*TemplateConfig{ { Name: "post", TemplateNames: []string{"post"}, TemplateExt: "gohtml", Render: renderVKVNLPosts, }, { Name: "rss", TemplateNames: []string{"rss"}, TemplateExt: "goxml", Render: renderVKVNLRSS, }, }, KindMap: map[adoc.Kind]Kind{ adoc.KIND_VKV: KIND_STORY, }, } )
View Source
var (
ErrInvalidPost = errors.New("invalid post")
)
View Source
var (
ErrUnknownSiteID = errors.New("unknown site id")
)
Functions ¶
func FormatBlock ¶
func FormatBlock(block adoc.BlockElement) string
func FormatDate ¶
func FormatDate(date time.Time, language Language, format DateFormat) string
func FormatInline ¶
func FormatInline(src adoc.InlineElement) string
func TruncateOnSpace ¶
Types ¶
type DateFormat ¶
type DateFormat int
const ( DATE_SHORT DateFormat = iota DATE_LONG DATE_FORMAL //Sat, 12 Sep 2020 12:32:00 +0200 )
type HTMLSummary ¶
type Post ¶
type Post struct { Date time.Time Kind Kind Language Language Tags []Tag // contains filtered or unexported fields }
func (*Post) HTMLSummary ¶
func (p *Post) HTMLSummary() *HTMLSummary
type Posts ¶
type Posts []*Post
func (Posts) RemoveKind ¶
func (Posts) SelectKind ¶
func (Posts) SelectYear ¶
type Site ¶
type Site struct {
// contains filtered or unexported fields
}
func (*Site) AddFilePost ¶
func (*Site) AddStaticPage ¶
func (*Site) RenderHTML ¶
type SiteConfig ¶
type SiteConfig struct { ID SiteID BaseURL string PathsWithKind bool TemplateConfigs []*TemplateConfig StaticPages []*StaticPage KindMap map[adoc.Kind]Kind }
func NewSiteConfig ¶
func NewSiteConfig(id SiteID) (*SiteConfig, error)
func (*SiteConfig) ParseTemplates ¶
func (sc *SiteConfig) ParseTemplates(tplPath string) error
type StaticPage ¶
type TemplateConfig ¶
Click to show internal directories.
Click to hide internal directories.