1
0
Fork 0
forked from forgejo/forgejo

Enable sintax highlighting on diff view. Close #733

This commit is contained in:
Andrey Nering 2016-01-31 14:19:02 -02:00
parent 137a49e834
commit 2bfb8bb5fd
9 changed files with 38 additions and 11 deletions

View file

@ -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