Documentation
¶
Index ¶
- Constants
- func AddUrlPre(dir string) string
- func I18n(val string) string
- type Article
- func (a *Article) ParseFile(path string) (string, error)
- func (a *Article) SetData(name string, chunk []byte) int
- func (a *Article) SetDirUrl(dir, url string) *Link
- func (a *Article) SetDummyAuthor(id string) *User
- func (a *Article) SetFormat(ext string)
- func (a *Article) SplitContent(data []byte) error
- func (a *Article) SplitSource(data []byte, times int) error
- type Catelog
- type Footer
- type Link
- type MetaData
- type Setting
- type Table
- type Theme
- func (t Theme) CopyAssets(dir string) (err error)
- func (t Theme) CreateSidebar(path string, archDirs map[string][]string) (err error)
- func (t Theme) GetDir() string
- func (t *Theme) GetOrCreate(name, path string, incl bool) *template.Template
- func (t *Theme) HasTemplate(name string) bool
- func (t *Theme) Render(name, path string, cxt Table) (err error)
- type User
- type Website
- func (w *Website) AddArticle(blog *Article, dir string) error
- func (w *Website) BuildFiles() error
- func (w Website) CreateDirs() error
- func (w *Website) CreateIndex(pageSize int) (err error)
- func (w Website) CreatePages(thDir string, thPrelen int) (err error)
- func (w Website) CreateTags() (err error)
- func (w *Website) CreateWalkFunc() filepath.WalkFunc
- func (w Website) GetTagArchives(name string) []*Link
- func (w Website) GlobPages(thDir string) ([]string, error)
- func (w *Website) InitTheme() error
- func (w *Website) LoadConfig(path string) error
- func (w Website) Prepare(dir string, cxt Table, createDir bool) (err error)
- func (w *Website) ProcFile(fullpath, path string) (*Article, error)
- func (w *Website) RenderBlog(tpl string, blog *Article) error
- func (w *Website) SortByDate()
Constants ¶
View Source
const ( SEP_META = "---" SEP_MORE = "<!--more-->" SEP_OUTLINE = "<!--outline-->" SEP_SAFE_MODE = "<!-- raw HTML omitted -->" EXT_MARKDOWN = ".md" EXT_RESTRUCTURED_TEXT = ".rst" )
View Source
const ( DefaultDirMode = 0755 DefaultFileMode = 0666 DefaultTheme = "default" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Article ¶
type Article struct {
Meta *MetaData
Author *User
Archive *Link
Format string
Source string
Content string
Outline string
}
func NewArticle ¶
func NewArticle() *Article
func (*Article) SetDummyAuthor ¶
func (*Article) SplitContent ¶
type MetaData ¶
type MetaData struct {
Title string `yaml:"title"`
Slug string `yaml:"slug,omitempty"`
Date string `yaml:"date,omitempty"`
Update string `yaml:"update,omitempty"`
Author string `yaml:"author,omitempty"`
Tags []string `yaml:"tags,omitempty"`
Draft bool `yaml:"draft,omitempty"`
Weight int `yaml:"weight,omitempty"`
}
type Setting ¶
type Setting struct {
Title string
Logo string
Lang string
Source string
Public string
Theme string
Port uint
Limit int
Sort string
Show_toc bool
Github string
Authors map[string]*User
Layout *Table
}
func NewSetting ¶
func NewSetting() *Setting
type Theme ¶
type Theme struct {
PubDir string // 结尾有斜杠
FunDict template.FuncMap
TplDict map[string]*template.Template
WithSide bool
// contains filtered or unexported fields
}
func (Theme) CopyAssets ¶
func (Theme) CreateSidebar ¶
func (*Theme) GetOrCreate ¶
func (*Theme) HasTemplate ¶
type Website ¶
type Website struct {
Root string
DirList []string
DirLinks map[string][]string
TagIndexes map[string][]int
Articles []*Article
Conf *Setting
Skin *Theme
Convert func(source []byte, format string) []byte
Debug func(data ...any)
}
func NewWebsite ¶
func (*Website) BuildFiles ¶
func (Website) CreateDirs ¶
func (*Website) CreateIndex ¶
func (Website) CreateTags ¶
func (*Website) CreateWalkFunc ¶
func (Website) GetTagArchives ¶
func (*Website) LoadConfig ¶
func (*Website) SortByDate ¶
func (w *Website) SortByDate()
Click to show internal directories.
Click to hide internal directories.