1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-22 12:54:53 -05:00
This commit is contained in:
slene 2014-03-20 21:11:48 +08:00
parent de956c4776
commit 47234f1031
2 changed files with 6 additions and 2 deletions

View file

@ -36,7 +36,7 @@ func isLink(link []byte) bool {
func IsMarkdownFile(name string) bool { func IsMarkdownFile(name string) bool {
name = strings.ToLower(name) name = strings.ToLower(name)
switch filepath.Ext(name) { switch filepath.Ext(name) {
case "md", "markdown", "mdown": case ".md", ".markdown", ".mdown":
return true return true
} }
return false return false

View file

@ -96,7 +96,11 @@ func Single(ctx *middleware.Context, params martini.Params) {
} else { } else {
ctx.Data["IsFile"] = true ctx.Data["IsFile"] = true
ctx.Data["FileName"] = repoFile.Name ctx.Data["FileName"] = repoFile.Name
ctx.Data["FileExt"] = path.Ext(repoFile.Name) ext := path.Ext(repoFile.Name)
if len(ext) > 0 {
ext = ext[1:]
}
ctx.Data["FileExt"] = ext
readmeExist := base.IsMarkdownFile(repoFile.Name) || base.IsReadmeFile(repoFile.Name) readmeExist := base.IsMarkdownFile(repoFile.Name) || base.IsReadmeFile(repoFile.Name)
ctx.Data["ReadmeExist"] = readmeExist ctx.Data["ReadmeExist"] = readmeExist