Little refactoring of diff highlight.
Moving cache variable to template instead of in the struct.
This commit is contained in:
parent
8ac04a3f29
commit
d160c7e565
2 changed files with 5 additions and 8 deletions
|
@ -161,7 +161,6 @@ type DiffFile struct {
|
|||
IsBin bool
|
||||
IsRenamed bool
|
||||
Sections []*DiffSection
|
||||
HighlightClass string
|
||||
}
|
||||
|
||||
func (diffFile *DiffFile) GetType() int {
|
||||
|
@ -169,10 +168,7 @@ func (diffFile *DiffFile) GetType() int {
|
|||
}
|
||||
|
||||
func (diffFile *DiffFile) GetHighlightClass() string {
|
||||
if diffFile.HighlightClass == "" {
|
||||
diffFile.HighlightClass = highlight.FileNameToHighlightClass(diffFile.Name)
|
||||
}
|
||||
return diffFile.HighlightClass
|
||||
return highlight.FileNameToHighlightClass(diffFile.Name)
|
||||
}
|
||||
|
||||
type Diff struct {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue