mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	read single file
This commit is contained in:
		@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user