source

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: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TimeLayoutShort use date to print time
	TimeLayoutShort = "2006-01-02"
	// TimeLayoutCommon use date and daytime to print time
	TimeLayoutCommon = "2006-01-02 15:04"
	// TimeLayoutLong use date and daytime with seconds to print time
	TimeLayoutLong = "2006-01-02 15:04:05"
)

Variables

View Source
var (
	// ErrorPageSectionsInvalid means post cant not seperate to current sections for parsing
	ErrorPageSectionsInvalid = errors.New("page sections are invalid")
	// ErrorPageMetaUnknownType means post metadata cant be unmarshaled with proper type
	ErrorPageMetaUnknownType = errors.New("page metadata is unknown type")
)
View Source
var (
	// ErrorPostSectionsInvalid means post cant not seperate to current sections for parsing
	ErrorPostSectionsInvalid = errors.New("post sections are invalid")
	// ErrorPostMetaUnknownType means post metadata cant be unmarshaled with proper type
	ErrorPostMetaUnknownType = errors.New("post metadata is unknown type")
)
View Source
var (
	// ErrorTimeParseEmpty means parsing empty string
	ErrorTimeParseEmpty = errors.New("parse empty time string")
	// ErrorTimeUnknownLayout means time string layout is not supported
	ErrorTimeUnknownLayout = errors.New("parse time but unknown layout")
	// ErrorTimeCreatedOverUpdated means create time is newer than updated time
	ErrorTimeCreatedOverUpdated = errors.New("created time is over updated time")
)

Functions

func CheckPostSlugConflict

func CheckPostSlugConflict(posts []*object.Post, slug string, ct int64) bool

CheckPostSlugConflict check post-slug is conflict with other post

func Cleanup

func Cleanup(s *object.Source, outputDir string) (int, error)

Cleanup clean not rendered file

func Compile

func Compile(s *object.Source, cfg *object.Config, th *theme.Theme, outputDir string) error

Compile compile source to html files

func Copy

func Copy(s *object.Source, outputDir string) (int, int, error)

Copy run copied files to output dir

func Parse

func Parse(s *object.Source, withDraft bool) error

Parse parse source contents to data

func QueryPage

func QueryPage(pages []*object.Page, slug string, ct int64) *object.Page

QueryPage query page with slug and created time

func QueryPost

func QueryPost(posts []*object.Post, slug string, ct int64) *object.Post

QueryPost query post with slug and created time

func Read

func Read(postDir, pageDir, langDir string) (*object.Source, error)

Read read sources contents and maintains basic info in source object

func WritePage

func WritePage(p *object.Page) error

WritePage write page to p.SourceFile

func WritePost

func WritePost(p *object.Post) error

WritePost write post to p.SourceFile

Types

This section is empty.

Jump to

Keyboard shortcuts

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