From d5a3021a7d86a6dbf42df97c5c25e22b0b3f9505 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Sat, 20 Feb 2016 17:10:05 -0500 Subject: Make markdown as an independent module --- models/repo.go | 6 +++--- models/user.go | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'models') diff --git a/models/repo.go b/models/repo.go index 98bb1107b3..089a5998e7 100644 --- a/models/repo.go +++ b/models/repo.go @@ -30,9 +30,9 @@ import ( "github.com/gogits/git-module" api "github.com/gogits/go-gogs-client" - "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/bindata" "github.com/gogits/gogs/modules/log" + "github.com/gogits/gogs/modules/markdown" "github.com/gogits/gogs/modules/process" "github.com/gogits/gogs/modules/setting" ) @@ -342,7 +342,7 @@ func (repo *Repository) CanEnablePulls() bool { // AllowPulls returns true if repository meets the requirements of accepting pulls and has them enabled. func (repo *Repository) AllowsPulls() bool { - return repo.CanEnablePulls() && repo.EnablePulls; + return repo.CanEnablePulls() && repo.EnablePulls } func (repo *Repository) NextIssueIndex() int64 { @@ -358,7 +358,7 @@ func (repo *Repository) DescriptionHtml() template.HTML { sanitize := func(s string) string { return fmt.Sprintf(`%[1]s`, s) } - return template.HTML(DescPattern.ReplaceAllStringFunc(base.Sanitizer.Sanitize(repo.Description), sanitize)) + return template.HTML(DescPattern.ReplaceAllStringFunc(markdown.Sanitizer.Sanitize(repo.Description), sanitize)) } func (repo *Repository) LocalCopyPath() string { diff --git a/models/user.go b/models/user.go index 7a8817591c..3264c0634b 100644 --- a/models/user.go +++ b/models/user.go @@ -29,6 +29,7 @@ import ( "github.com/gogits/gogs/modules/avatar" "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/log" + "github.com/gogits/gogs/modules/markdown" "github.com/gogits/gogs/modules/setting" ) @@ -111,7 +112,7 @@ func (u *User) BeforeUpdate() { func (u *User) AfterSet(colName string, _ xorm.Cell) { switch colName { case "full_name": - u.FullName = base.Sanitizer.Sanitize(u.FullName) + u.FullName = markdown.Sanitizer.Sanitize(u.FullName) case "created": u.Created = regulateTimeZone(u.Created) } @@ -641,7 +642,7 @@ func updateUser(e Engine, u *User) error { u.Description = u.Description[:255] } - u.FullName = base.Sanitizer.Sanitize(u.FullName) + u.FullName = markdown.Sanitizer.Sanitize(u.FullName) _, err := e.Id(u.Id).AllCols().Update(u) return err } -- cgit v1.2.3