generator

package
v0.0.0-...-4acf0ac Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2020 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByCountDesc

type ByCountDesc []*Tag

ByCountDesc sorts the tags

func (ByCountDesc) Len

func (t ByCountDesc) Len() int

func (ByCountDesc) Less

func (t ByCountDesc) Less(i, j int) bool

func (ByCountDesc) Swap

func (t ByCountDesc) Swap(i, j int)

type ByDateDesc

type ByDateDesc []*Post

ByDateDesc is the sorting object for posts

func (ByDateDesc) Len

func (p ByDateDesc) Len() int

func (ByDateDesc) Less

func (p ByDateDesc) Less(i, j int) bool

func (ByDateDesc) Swap

func (p ByDateDesc) Swap(i, j int)

type Generator

type Generator interface {
	Generate() error
}

Generator interface

type IndexData

type IndexData struct {
	HTMLTitle       string
	PageTitle       string
	Content         template.HTML
	Year            int
	Name            string
	CanonicalLink   string
	MetaDescription string
	HighlightCSS    template.CSS
}

IndexData is a data container for the landing page

type IndexWriter

type IndexWriter struct {
	BlogTitle       string
	BlogDescription string
	BlogAuthor      string
	BlogURL         string
}

IndexWriter writer index.html files

func (*IndexWriter) WriteIndexHTML

func (i *IndexWriter) WriteIndexHTML(path, pageTitle, metaDescription string, content template.HTML, t *template.Template) error

WriteIndexHTML writes an index.html file

type ListingConfig

type ListingConfig struct {
	Posts                  []*Post
	Template               *template.Template
	Destination, PageTitle string
	IsIndex                bool
	Writer                 *IndexWriter
}

ListingConfig holds the configuration for the listing page

type ListingData

type ListingData struct {
	Title      string
	Date       string
	Short      string
	Link       string
	TimeToRead string
	Tags       []*Tag
}

ListingData holds the data for the listing page

type ListingGenerator

type ListingGenerator struct {
	Config *ListingConfig
}

ListingGenerator Object

func (*ListingGenerator) Generate

func (g *ListingGenerator) Generate() error

Generate starts the listing generation

type Meta

type Meta struct {
	Title      string
	Short      string
	Date       string
	Tags       []string
	ParsedDate time.Time
}

Meta is a data container for Metadata

type Post

type Post struct {
	Name      string
	HTML      []byte
	Meta      *Meta
	ImagesDir string
	Images    []string
}

Post holds data for a post

type PostConfig

type PostConfig struct {
	Post        *Post
	Destination string
	Template    *template.Template
	Writer      *IndexWriter
}

PostConfig holds the post's configuration

type PostGenerator

type PostGenerator struct {
	Config *PostConfig
}

PostGenerator object

func (*PostGenerator) Generate

func (g *PostGenerator) Generate() error

Generate generates a post

type RSSConfig

type RSSConfig struct {
	Posts           []*Post
	Destination     string
	DateFormat      string
	Language        string
	BlogURL         string
	BlogDescription string
	BlogTitle       string
}

RSSConfig holds the configuration for an RSS feed

type RSSGenerator

type RSSGenerator struct {
	Config *RSSConfig
}

RSSGenerator object

func (*RSSGenerator) Generate

func (g *RSSGenerator) Generate() error

Generate creates an RSS feed

type SiteConfig

type SiteConfig struct {
	Sources     []string
	Destination string
	Config      *config.Config
}

SiteConfig holds the sources and destination folder

type SiteGenerator

type SiteGenerator struct {
	Config *SiteConfig
}

SiteGenerator object

func New

func New(config *SiteConfig) *SiteGenerator

New creates a new SiteGenerator

func (*SiteGenerator) Generate

func (g *SiteGenerator) Generate() error

Generate starts the static blog generation

type SitemapConfig

type SitemapConfig struct {
	Posts       []*Post
	TagPostsMap map[string][]*Post
	Destination string
	BlogURL     string
	Statics     []string
}

SitemapConfig holds the config for the sitemap

type SitemapGenerator

type SitemapGenerator struct {
	Config *SitemapConfig
}

SitemapGenerator object

func (*SitemapGenerator) Generate

func (g *SitemapGenerator) Generate() error

Generate creates the sitemap

type StaticsConfig

type StaticsConfig struct {
	FileToDestination map[string]string
	TemplateToFile    map[string]string
	Template          *template.Template
	Writer            *IndexWriter
}

StaticsConfig holds the data for the static sites

type StaticsGenerator

type StaticsGenerator struct {
	Config *StaticsConfig
}

StaticsGenerator object

func (*StaticsGenerator) Generate

func (g *StaticsGenerator) Generate() error

Generate creates the static pages

type Tag

type Tag struct {
	Name  string
	Link  string
	Count int
}

Tag holds the data for a Tag

type TagsConfig

type TagsConfig struct {
	TagPostsMap map[string][]*Post
	Template    *template.Template
	Destination string
	Writer      *IndexWriter
}

TagsConfig holds the tag's config

type TagsGenerator

type TagsGenerator struct {
	Config *TagsConfig
}

TagsGenerator object

func (*TagsGenerator) Generate

func (g *TagsGenerator) Generate() error

Generate creates the tags page

Jump to

Keyboard shortcuts

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