Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegsiterSource ¶
func RegsiterSource(name string, handle func(config SourceConfig) Source)
A source handler return an instance of Source interface according the SourceConfig. The sync process find a handler by name firstly, then iterate the `Post` in the `Source`, output post to a specified location.
func Sync ¶
func Sync()
Read Sync Config from file `./mirror.yaml`, Then run sync process to get content from the config source
func SyncWithConfig ¶
func SyncWithConfig(configfile string)
Read Sync Config from `configfile`, Then run sync process to get content from the config source
Types ¶
type Post ¶
type Post interface { Title() string Tags() []string CreatedAt() time.Time UpdatedAt() time.Time Content() string }
An abstract blog article
抽象的一篇文章(博文)
type Source ¶
type Source interface { // return next post, or nil if no more // // 返回下一篇文章,如果没有更多内容返回 nil Next() Post // full filename (with path) to save the content // // 包含路径的文件名,用于保存博文 FileName(post Post) string }
An abstract interface for A collection of `Post`. Iterator Design
博文集合的抽象接口, 迭代器模式
type SourceConfig ¶
type SourceConfig struct { // 类型 Type string `yaml:"type"` // 具体的配置 Config map[string]interface{} `yaml:"config"` }
The post source config, parsed from config file. Contains source type and config for the source
文章内容的来源配置,从配置文件中解析得到内容。 包括来源类型和每一种来源的自定义配置。