diff options
author | slene <vslene@gmail.com> | 2014-03-20 13:31:24 +0800 |
---|---|---|
committer | slene <vslene@gmail.com> | 2014-03-20 13:31:24 +0800 |
commit | 24678d73f59abd46141ef6fece7966e1f9c5c8f3 (patch) | |
tree | 703b9cf24bcd7af41be88ef4134c8d21e94bd1fc /modules/base/markdown.go | |
parent | 805732fdc76c55659a3ee4b9d1a655ba3c9a0abc (diff) | |
download | gitea-24678d73f59abd46141ef6fece7966e1f9c5c8f3.tar.gz gitea-24678d73f59abd46141ef6fece7966e1f9c5c8f3.zip |
read single file
Diffstat (limited to 'modules/base/markdown.go')
-rw-r--r-- | modules/base/markdown.go | 22 |
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 |