Documentation
¶
Overview ¶
Package blog contains structures, methods and functions for manipulating blog entries.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeBlogName ¶
MakeBlogName concatenates all of the given names with a dash and replaces illegal blog name characters with a dash. 将不合法的名字替换成 "-",并且如果这个使用"-"作为文件夹与子文件的连接符
Types ¶
type BlogEntry ¶
type BlogEntry struct { // Name is the name of the entry gleaned from the filename. Name string // Path is the path to the markdown file from the cwd. Path string // Aurhor is the name of the person who wrote the page. Author string // Title is the title of the Entry. Title string // Description is the description of the Entry. Description string // Url is the HTML file name of this entry (Name + ".html"). Url string // Tags is a list of tags this blog entry contains. It is generated // when when the Parse method is called. Tags []string // Languages is a list of languages this blog entry contains. It is // generated when when the Parse method is called. Languages []string // Created is the date the blog entry was created. It is generated // when the Parse metod is called. Created time.Time // Updated is the date the blog entry was last updated. It is // generated when the Parse metod is called. Updated time.Time }
BlogEntry is a representation of a blog entry. It contains the information necessary to generate the blogs contents and store information about the blog.
func GetBlogFiles ¶
GetBlogFiles looks in the given directory for blog entries and returns a list of them. Blog entries must have the '.md' extension. Entries are searched in the directory recursively. If a files is in a directory, the directory name is used as a prefix to the blog entries name concatenated with a '-'. The blog is not parsed or read. You should do that yourself elsewhere. 返回 dir 文件夹下的 BlogEntry 的list,这些 Blog的文件必须是以 .md结尾. 如果Blog文件在一个子文件夹内, 那么这个子文件夹的名字会作为Blog的前缀,并且以 "-" 来作为文件夹和BLOG文件的连接. BLOG 不会被解析和读取
func (*BlogEntry) CDate ¶
CDate is a helper function for the templating system that returns the Created date as a string or "" if there is no value.
func (*BlogEntry) Parse ¶
Parse reads the contents of the path for this BlogEntry. It gleans information from the file and saves it to this BlogEntry. It then formats the markdown to HTML and returns that. 根据 BlogEntry的文件path路径信息,读取文件的内容。