mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 10:56:10 +01:00 
			
		
		
		
	Enable sintax highlighting on diff view. Close #733
This commit is contained in:
		| @@ -26,6 +26,7 @@ import ( | ||||
| 	"github.com/gogits/gogs/modules/base" | ||||
| 	"github.com/gogits/gogs/modules/log" | ||||
| 	"github.com/gogits/gogs/modules/process" | ||||
| 	"github.com/gogits/gogs/modules/template/highlight" | ||||
| ) | ||||
|  | ||||
| type DiffLineType uint8 | ||||
| @@ -160,12 +161,20 @@ type DiffFile struct { | ||||
| 	IsBin              bool | ||||
| 	IsRenamed          bool | ||||
| 	Sections           []*DiffSection | ||||
| 	HighlightClass     string | ||||
| } | ||||
|  | ||||
| func (diffFile *DiffFile) GetType() int { | ||||
| 	return int(diffFile.Type) | ||||
| } | ||||
|  | ||||
| func (diffFile *DiffFile) GetHighlightClass() string { | ||||
| 	if diffFile.HighlightClass == "" { | ||||
| 		diffFile.HighlightClass = highlight.FileNameToHighlightClass(diffFile.Name) | ||||
| 	} | ||||
| 	return diffFile.HighlightClass | ||||
| } | ||||
|  | ||||
| type Diff struct { | ||||
| 	TotalAddition, TotalDeletion int | ||||
| 	Files                        []*DiffFile | ||||
|   | ||||
		Reference in New Issue
	
	Block a user