summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-03-20 01:48:55 -0400
committerUnknown <joe2010xtmf@163.com>2014-03-20 01:48:55 -0400
commitebc3d86e63fb53cfa3f133248a95af9b84e1b26a (patch)
treede8b2d00cdc85e86a067c5f0f1e72e3989fa71da /modules
parentbbd38829eb3b41f8128952404b408d3922c7af81 (diff)
parent24678d73f59abd46141ef6fece7966e1f9c5c8f3 (diff)
downloadgitea-ebc3d86e63fb53cfa3f133248a95af9b84e1b26a.tar.gz
gitea-ebc3d86e63fb53cfa3f133248a95af9b84e1b26a.zip
Merge branch 'master' of github.com:gogits/gogs
Conflicts: routers/repo/single.go
Diffstat (limited to 'modules')
-rw-r--r--modules/base/markdown.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/modules/base/markdown.go b/modules/base/markdown.go
index 049b107548..a9f4cbf0d7 100644
--- a/modules/base/markdown.go
+++ b/modules/base/markdown.go
@@ -7,6 +7,8 @@ package base
import (
"bytes"
"path"
+ "path/filepath"
+ "strings"
"github.com/gogits/gfm"
)
@@ -31,6 +33,26 @@ func isLink(link []byte) bool {
return false
}
+func IsMarkdownFile(name string) bool {
+ name = strings.ToLower(name)
+ switch filepath.Ext(name) {
+ case "md", "markdown":
+ return true
+ }
+ return false
+}
+
+func IsReadmeFile(name string) bool {
+ name = strings.ToLower(name)
+ if len(name) < 6 {
+ return false
+ }
+ if name[:6] == "readme" {
+ return true
+ }
+ return false
+}
+
type CustomRender struct {
gfm.Renderer
urlPrefix string