object

package
v0.0.0-...-f1f97c7 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SourceOpPost means source item is a post
	SourceOpPost = 1
	// SourceOpPage means source item is a page
	SourceOpPage = 3
	// SourceOpFile means source item is a common file
	SourceOpFile = 5
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Analytics

type Analytics struct {
	Baidu   string `toml:"baidu" ini:"baidu"`
	Google  string `toml:"google" ini:"google"`
	Tencent string `toml:"tencent" ini:"tencent"`
	Cnzz    string `toml:"cnzz" ini:"cnzz"`
}

Analytics is third-party analytics settings for site

type Archive

type Archive struct {
	Year  int // each list by year
	Posts []*Post
}

Archive is archive set for posts

type Author

type Author struct {
	Name  string `toml:"name" ini:"name"`
	Nick  string `toml:"nick" ini:"nick"`
	Email string `toml:"email" ini:"email"`
	URL   string `toml:"url" ini:"url"`
}

Author is author info

type AuthorGroup

type AuthorGroup []*Author

AuthorGroup are authors for site

type Comment

type Comment struct {
	Disqus string `toml:"disqus" ini:"disqus"`
}

Comment is comment settings for site

type Config

type Config struct {
	Meta      *Meta       `toml:"meta" ini:"meta"`
	Navs      NavGroup    `toml:"nav" ini:"nav"`
	Authors   AuthorGroup `toml:"author" ini:"author"`
	Comment   *Comment    `toml:"comment" ini:"comment"`
	Analytics *Analytics  `toml:"analytics" ini:"analytics"`
	SrcFile   string      `toml:"-" ini:"-"`
}

Config is all config from config file

type ContentIndex

type ContentIndex struct {
	Level    int
	Title    string
	Archor   string
	Children []*ContentIndex
	Link     string
	Parent   *ContentIndex
}

ContentIndex is index of content

func NewContentIndex

func NewContentIndex(r io.Reader) []*ContentIndex

NewContentIndex parse reader byte to index

func (*ContentIndex) Print

func (p *ContentIndex) Print()

Print prints post indexs friendly

type Meta

type Meta struct {
	Title    string `toml:"title" ini:"title"`
	Subtitle string `toml:"subtitle" ini:"subtitle"`
	Keyword  string `toml:"keyword" ini:"keyword"`
	Desc     string `toml:"desc" ini:"desc"`
	Domain   string `toml:"domain" ini:"domain"`
	Root     string `toml:"root" ini:"root"`
	Lang     string `toml:"lang" ini:"lang"`
}

Meta is metadata info for site

type Nav struct {
	Link    string `toml:"link" ini:"link"`
	Title   string `toml:"title" ini:"title"`
	I18n    string `toml:"i18n" ini:"i18n"`
	Hover   string `toml:"hover" ini:"hover"`
	IsBlank bool   `toml:"is_blank" ini:"is_blank"`
	Icon    string `toml:"icon" ini:"icon"`
}

Nav is one item in navigator

type NavGroup []*Nav

NavGroup is navigator for site

type Page

type Page struct {
	Title        string                 `toml:"title" ini:"title"`
	Slug         string                 `toml:"slug" ini:"slug"`
	Desc         string                 `toml:"desc" ini:"desc"`
	CreateString string                 `toml:"date" ini:"date"`
	UpdateString string                 `toml:"update_date" ini:"update_date"`
	AuthorName   string                 `toml:"author" ini:"author"`
	NavHover     string                 `toml:"hover" ini:"hover"`
	Template     string                 `toml:"template" ini:"template"`
	Lang         string                 `toml:"lang" ini:"lang"`
	Meta         map[string]interface{} `toml:"meta" ini:"-"`
	Sort         int                    `toml:"sort" ini:"sort"`
	Author       *Author                `toml:"-" ini:"-"`
	Draft        bool                   `toml:"draft" ini:"draft"`
	Index        []*ContentIndex        `toml:"-" ini:"-"`

	MetaFormat    string `toml:"-" ini:"-"`
	SourceFile    string `toml:"-" ini:"-"`
	SourceRelpath string `toml:"-" ini:"-"`
	OutputFile    string `toml:"-" ini:"-"`
	URL           string `toml:"-" ini:"-"`

	CreateTime time.Time `toml:"-" ini:"-"`
	UpdateTime time.Time `toml:"-" ini:"-"`

	RawBytes     []byte `toml:"-" ini:"-"`
	ContentBytes []byte `toml:"-" ini:"-"`
}

Page is a page

func (*Page) ContentHTML

func (p *Page) ContentHTML() template.HTML

ContentHTML return page content as HTML type

func (*Page) Created

func (p *Page) Created() time.Time

Created return page created time

func (*Page) Updated

func (p *Page) Updated() time.Time

Updated return page updated time

type Pager

type Pager struct {
	Begin   int
	End     int
	Prev    int
	Next    int
	Current int
	Pages   int
	All     int
	// contains filtered or unexported fields
}

Pager contains pagination data when on a page number

func (*Pager) NextURL

func (pg *Pager) NextURL() string

NextURL returns next url

func (*Pager) PageItems

func (pg *Pager) PageItems() []*PagerItem

PageItems returns each page item in this pager

func (*Pager) PrevURL

func (pg *Pager) PrevURL() string

PrevURL returns prev url

func (*Pager) SetLayout

func (pg *Pager) SetLayout(layout string)

SetLayout sets pager layout string, use to print url

func (*Pager) URL

func (pg *Pager) URL() string

URL returns page current url

type PagerCursor

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

PagerCursor creates Pager with each page number

func NewPagerCursor

func NewPagerCursor(size, all int) *PagerCursor

NewPagerCursor with size and all count

func (*PagerCursor) Page

func (pg *PagerCursor) Page(i int) *Pager

Page creates Pager on a page number

type PagerItem

type PagerItem struct {
	Page int
	Link string
}

PagerItem is one item in pager

type Post

type Post struct {
	Title        string   `toml:"title" ini:"title"`
	Slug         string   `toml:"slug" ini:"slug"`
	Desc         string   `toml:"desc" ini:"desc"`
	CreateString string   `toml:"date" ini:"date"`
	UpdateString string   `toml:"update_date" ini:"update_date"`
	AuthorName   string   `toml:"author" ini:"author"`
	Thumb        string   `toml:"thumb" ini:"thumb"`
	Draft        bool     `toml:"draft" ini:"draft"`
	TagStrings   []string `toml:"tags" ini:"-"`

	MetaFormat    string `toml:"-" ini:"-"`
	SourceFile    string `toml:"-" ini:"-"`
	SourceRelpath string `toml:"-" ini:"-"`
	OutputFile    string `toml:"-" ini:"-"`
	URL           string `toml:"-" ini:"-"`

	Tags   []*PostTag      `toml:"-" ini:"-"`
	Author *Author         `toml:"-" ini:"-"`
	Index  []*ContentIndex `toml:"-" ini:"-"`

	CreateTime time.Time `toml:"-" ini:"-"`
	UpdateTime time.Time `toml:"-" ini:"-"`

	RawBytes     []byte `toml:"-" ini:"-"`
	ContentBytes []byte `toml:"-" ini:"-"`
	BriefBytes   []byte `toml:"-" ini:"-"`
}

Post is a post

func (*Post) BriefHTML

func (p *Post) BriefHTML() template.HTML

BriefHTML return brief content as HTML

func (*Post) ContentHTML

func (p *Post) ContentHTML() template.HTML

ContentHTML return content as HTML

func (*Post) Created

func (p *Post) Created() time.Time

Created return post create time

func (*Post) TagString

func (p *Post) TagString() string

TagString return a string of post tags, joined with comma

func (*Post) Updated

func (p *Post) Updated() time.Time

Updated return post updated time

type PostList

type PostList struct {
	Pager *Pager
	Posts []*Post
}

PostList is list of posts with pager

type PostTag

type PostTag struct {
	Name string
	URL  string
}

PostTag is tag in post

type Source

type Source struct {
	PostDir string
	PageDir string

	PostFiles []SourceItem
	PageFiles []SourceItem

	CopyFiles     []SourceItem
	RenderedFiles []string

	Posts     []*Post
	Lists     []PostList
	ListSize  int
	TagsLists map[string]*TagList
	Archives  []*Archive

	Pages []*Page
	I18ns map[string]*i18n.File
}

Source is all source data object

type SourceItem

type SourceItem struct {
	SrcFile string
	File    string
	Info    os.FileInfo
	OpType  int
}

SourceItem is an item reading from source directry

type TagList

type TagList struct {
	Tag      *PostTag
	Archives []*Archive
	Posts    []*Post
}

TagList is list of posts with Tag

Jump to

Keyboard shortcuts

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