site

package
v0.0.0-...-5528bf3 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2020 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

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("")
)
View Source
const (
	TITLE_PREFIX           = "= "
	SUBTITLE_PREFIX        = "== "
	SUBSUBTITLE_PREFIX     = "=== "
	PARAGRAPH_SEPARATOR    = "\n\n"
	LINE_SEPARATOR         = "\n"
	CODE_PREFIX            = "----\n"
	CODE_SUFFIX            = "\n----"
	LISTITEM_PREFIX        = "* "
	PARAGRAPH_CONTINUATION = "\n+\n"
)

Variables

View Source
var (
	ErrInvalidPost = errors.New("invalid post")
)

Functions

func ParseHeader

func ParseHeader(text string, post *Post)

Types

type BlockElement

type BlockElement interface {
	Text() string
	BlockHTML() string
}

type CodeBlock

type CodeBlock string

func (CodeBlock) BlockHTML

func (cb CodeBlock) BlockHTML() string

func (CodeBlock) Text

func (cb CodeBlock) Text() string

type CodeText

type CodeText string

func (CodeText) InlineHTML

func (ct CodeText) InlineHTML() string

func (CodeText) Text

func (ct CodeText) Text() string

type DateFormat

type DateFormat int
const (
	DATE_SHORT DateFormat = iota
	DATE_LONG
	DATE_FORMAL //Sat, 12 Sep 2020 12:32:00 +0200
)

type EmpText

type EmpText string

func (EmpText) InlineHTML

func (et EmpText) InlineHTML() string

func (EmpText) Text

func (et EmpText) Text() string

type HTMLPost

type HTMLPost struct {
	Slug      string
	Title     string
	DateLong  string
	DateShort string
	Content   string
}

type HTMLSummary

type HTMLSummary struct {
	Link      string
	Title     string
	Language  Language
	DateShort string
	DateLong  string
	Summary   string
}

type InlineElement

type InlineElement interface {
	Text() string
	InlineHTML() string
}

func ParseInline

func ParseInline(text string) []InlineElement

type InlineType

type InlineType int

type Kind

type Kind string

func NewKind

func NewKind(kind string) Kind

type Language

type Language string

func NewLanguage

func NewLanguage(text string) Language
type Link struct {
	// contains filtered or unexported fields
}
func NewLink(url, title string) Link

func (Link) InlineHTML

func (l Link) InlineHTML() string

func (Link) Text

func (l Link) Text() string

type List

type List []ListItem

func (List) BlockHTML

func (l List) BlockHTML() string

func (List) Text

func (l List) Text() string

type ListItem

type ListItem []InlineElement

func (ListItem) HTML

func (li ListItem) HTML() string

func (ListItem) Text

func (li ListItem) Text() string

type Paragraph

type Paragraph []InlineElement

func (Paragraph) BlockHTML

func (p Paragraph) BlockHTML() string

func (Paragraph) Text

func (p Paragraph) Text() string

type PlainText

type PlainText string

func (PlainText) InlineHTML

func (pt PlainText) InlineHTML() string

func (PlainText) Text

func (pt PlainText) Text() string

type Post

type Post struct {
	Title    string
	Author   string
	Kind     Kind
	Language Language
	Path     string
	Date     time.Time
	Tags     []Tag
	Content  []BlockElement
}

func NewPost

func NewPost(text string) Post

func (Post) FormattedDate

func (p Post) FormattedDate(format DateFormat) string
func (p *Post) FullLink() string

func (*Post) HTMLPost

func (p *Post) HTMLPost() *HTMLPost

func (*Post) HTMLSummary

func (p *Post) HTMLSummary() *HTMLSummary
func (p *Post) Link() string

func (Post) Slug

func (p Post) Slug() string

func (*Post) XMLPost

func (p *Post) XMLPost() *XMLPost

func (*Post) Year

func (p *Post) Year() string

type Posts

type Posts []Post

func (Posts) FilterByKind

func (p Posts) FilterByKind(wanted Kind) Posts

func (Posts) FilterByTag

func (p Posts) FilterByTag(wanted Tag) Posts

func (Posts) FilterByYear

func (p Posts) FilterByYear(year string) Posts

func (Posts) HTMLSummaries

func (p Posts) HTMLSummaries() []*HTMLSummary

func (Posts) Len

func (p Posts) Len() int

func (Posts) Less

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

func (Posts) Limit

func (p Posts) Limit(limit int) Posts

func (Posts) Sort

func (p Posts) Sort() Posts

func (Posts) Swap

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

func (Posts) TagList

func (p Posts) TagList() []string

func (Posts) YearList

func (p Posts) YearList() []string

type Site

type Site struct {
	// contains filtered or unexported fields
}

func New

func New(resourcesPath string) (*Site, error)

func (*Site) AddFilePost

func (s *Site) AddFilePost(fPath string) error

func (*Site) AddFolderPost

func (s *Site) AddFolderPost(kind Kind, fPath string) error

func (*Site) RenderHTML

func (s *Site) RenderHTML(targetPath string) error

type StaticPage

type StaticPage struct {
	Name       string
	Template   *template.Template
	SourcePath string
}

type StrongEmpText

type StrongEmpText string

func (StrongEmpText) InlineHTML

func (set StrongEmpText) InlineHTML() string

func (StrongEmpText) Text

func (set StrongEmpText) Text() string

type StrongText

type StrongText string

func (StrongText) InlineHTML

func (st StrongText) InlineHTML() string

func (StrongText) Text

func (st StrongText) Text() string

type SubSubTitle

type SubSubTitle string

func (SubSubTitle) BlockHTML

func (st SubSubTitle) BlockHTML() string

func (SubSubTitle) Text

func (st SubSubTitle) Text() string

type SubTitle

type SubTitle string

func (SubTitle) BlockHTML

func (st SubTitle) BlockHTML() string

func (SubTitle) Text

func (st SubTitle) Text() string

type Tag

type Tag string

type XMLPost

type XMLPost struct {
	Link       string
	Title      string
	DateFormal string
	Content    string
}

Jump to

Keyboard shortcuts

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