blogs

package
v0.0.0-...-8fa4d24 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2013 License: BSD-3-Clause Imports: 8 Imported by: 0

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

func MakeBlogName(names ...string) (string, error)

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

func GetBlogFiles(dir string) ([]*BlogEntry, error)

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

func (be *BlogEntry) CDate() string

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

func (be *BlogEntry) Parse() (string, error)

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路径信息,读取文件的内容。

func (*BlogEntry) PubDate

func (be *BlogEntry) PubDate() string

PubDate is a helper function for the templating system that returns the Created date as an RFC822 string or "" if there is no value.

func (*BlogEntry) UDate

func (be *BlogEntry) UDate() string

UDate is a helper function for the templating system that returns the Updated date as a string or "" if there is no value or if it's identical to the Created date.

Jump to

Keyboard shortcuts

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