Skip to content

Commit 60898a6

Browse files
committed
adding language var back
1 parent 0452d27 commit 60898a6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

services/gitdiff/gitdiff.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,10 @@ func (diffSection *DiffSection) GetComputedInlineDiffFor(diffLine *DiffLine, loc
301301
diff2 string
302302
)
303303

304+
language := ""
305+
if diffSection.file != nil {
306+
language = diffSection.file.Language
307+
}
304308
// try to find equivalent diff line. ignore, otherwise
305309
switch diffLine.Type {
306310
case DiffLineSection:
@@ -331,7 +335,7 @@ func (diffSection *DiffSection) GetComputedInlineDiffFor(diffLine *DiffLine, loc
331335
}
332336

333337
hcd := newHighlightCodeDiff()
334-
diffRecord := hcd.diffWithHighlight(diffSection.FileName, diffSection.file.Language, diff1, diff2)
338+
diffRecord := hcd.diffWithHighlight(diffSection.FileName, language, diff1, diff2)
335339
// it seems that Gitea doesn't need the line wrapper of Chroma, so do not add them back
336340
// if the line wrappers are still needed in the future, it can be added back by "diffToHTML(hcd.lineWrapperTags. ...)"
337341
diffHTML := html.UnescapeString(diffToHTML(nil, diffRecord, diffLine.Type))

0 commit comments

Comments
 (0)