diff --git a/db.go b/db.go index 5d72f79..7bca7c7 100644 --- a/db.go +++ b/db.go @@ -221,8 +221,8 @@ func generateTopic() { Author: setting.Conf.Account.Username, Title: "友情链接", Slug: "blogroll", - UpdateTime: time.Now(), - CreateTime: time.Time{}, + CreateTime: time.Now(), + UpdateTime: time.Time{}, } err := db.Insert(DB, COLLECTION_ARTICLE, blogroll) if err != nil { diff --git a/helper.go b/helper.go index 1b38da3..394e0f9 100644 --- a/helper.go +++ b/helper.go @@ -70,12 +70,12 @@ func ReadDir(dir string, filter func(name string) bool) (files []string) { } func IgnoreHtmlTag(src string) string { - //去除所有尖括号内的HTML代码 - re, _ := regexp.Compile("\\<[\\S\\s]+?\\>") + // 去除所有尖括号内的HTML代码 + re, _ := regexp.Compile(`<[\S\s]+?>`) src = re.ReplaceAllString(src, "") - //去除换行符 - re, _ = regexp.Compile("\\s{2,}") + // 去除换行符 + re, _ = regexp.Compile(`\s+`) return re.ReplaceAllString(src, "") }