@@ -181,9 +181,9 @@ func getDiffLineSectionInfo(treePath, line string, lastLeftIdx, lastRightIdx int
181181}
182182
183183// escape a line's content or return <br> needed for copy/paste purposes
184- func getLineContent (ctx context. Context , content string , locale translation.Locale ) DiffInline {
184+ func getLineContent (content string , locale translation.Locale ) DiffInline {
185185 if len (content ) > 0 {
186- return DiffInlineWithUnicodeEscape (ctx , template .HTML (html .EscapeString (content )), locale )
186+ return DiffInlineWithUnicodeEscape (template .HTML (html .EscapeString (content )), locale )
187187 }
188188 return DiffInline {EscapeStatus : & charset.EscapeStatus {}, Content : "<br>" }
189189}
@@ -284,22 +284,22 @@ type DiffInline struct {
284284}
285285
286286// DiffInlineWithUnicodeEscape makes a DiffInline with hidden unicode characters escaped
287- func DiffInlineWithUnicodeEscape (ctx context. Context , s template.HTML , locale translation.Locale ) DiffInline {
287+ func DiffInlineWithUnicodeEscape (s template.HTML , locale translation.Locale ) DiffInline {
288288 status , content := charset .EscapeControlHTML (s , locale )
289289 return DiffInline {EscapeStatus : status , Content : content }
290290}
291291
292292// DiffInlineWithHighlightCode makes a DiffInline with code highlight and hidden unicode characters escaped
293- func DiffInlineWithHighlightCode (ctx context. Context , fileName , language , code string , locale translation.Locale ) DiffInline {
293+ func DiffInlineWithHighlightCode (fileName , language , code string , locale translation.Locale ) DiffInline {
294294 highlighted , _ := highlight .Code (fileName , language , code )
295295 status , content := charset .EscapeControlHTML (highlighted , locale )
296296 return DiffInline {EscapeStatus : status , Content : content }
297297}
298298
299299// GetComputedInlineDiffFor computes inline diff for the given line.
300- func (diffSection * DiffSection ) GetComputedInlineDiffFor (ctx context. Context , diffLine * DiffLine , locale translation.Locale ) DiffInline {
300+ func (diffSection * DiffSection ) GetComputedInlineDiffFor (diffLine * DiffLine , locale translation.Locale ) DiffInline {
301301 if setting .Git .DisableDiffHighlight {
302- return getLineContent (ctx , diffLine .Content [1 :], locale )
302+ return getLineContent (diffLine .Content [1 :], locale )
303303 }
304304
305305 var (
@@ -316,34 +316,34 @@ func (diffSection *DiffSection) GetComputedInlineDiffFor(ctx context.Context, di
316316 // try to find equivalent diff line. ignore, otherwise
317317 switch diffLine .Type {
318318 case DiffLineSection :
319- return getLineContent (ctx , diffLine .Content [1 :], locale )
319+ return getLineContent (diffLine .Content [1 :], locale )
320320 case DiffLineAdd :
321321 compareDiffLine = diffSection .GetLine (DiffLineDel , diffLine .RightIdx )
322322 if compareDiffLine == nil {
323- return DiffInlineWithHighlightCode (ctx , diffSection .FileName , language , diffLine .Content [1 :], locale )
323+ return DiffInlineWithHighlightCode (diffSection .FileName , language , diffLine .Content [1 :], locale )
324324 }
325325 diff1 = compareDiffLine .Content
326326 diff2 = diffLine .Content
327327 case DiffLineDel :
328328 compareDiffLine = diffSection .GetLine (DiffLineAdd , diffLine .LeftIdx )
329329 if compareDiffLine == nil {
330- return DiffInlineWithHighlightCode (ctx , diffSection .FileName , language , diffLine .Content [1 :], locale )
330+ return DiffInlineWithHighlightCode (diffSection .FileName , language , diffLine .Content [1 :], locale )
331331 }
332332 diff1 = diffLine .Content
333333 diff2 = compareDiffLine .Content
334334 default :
335335 if strings .IndexByte (" +-" , diffLine .Content [0 ]) > - 1 {
336- return DiffInlineWithHighlightCode (ctx , diffSection .FileName , language , diffLine .Content [1 :], locale )
336+ return DiffInlineWithHighlightCode (diffSection .FileName , language , diffLine .Content [1 :], locale )
337337 }
338- return DiffInlineWithHighlightCode (ctx , diffSection .FileName , language , diffLine .Content , locale )
338+ return DiffInlineWithHighlightCode (diffSection .FileName , language , diffLine .Content , locale )
339339 }
340340
341341 hcd := newHighlightCodeDiff ()
342342 diffRecord := hcd .diffWithHighlight (diffSection .FileName , language , diff1 [1 :], diff2 [1 :])
343343 // it seems that Gitea doesn't need the line wrapper of Chroma, so do not add them back
344344 // if the line wrappers are still needed in the future, it can be added back by "diffToHTML(hcd.lineWrapperTags. ...)"
345345 diffHTML := diffToHTML (nil , diffRecord , diffLine .Type )
346- return DiffInlineWithUnicodeEscape (ctx , template .HTML (diffHTML ), locale )
346+ return DiffInlineWithUnicodeEscape (template .HTML (diffHTML ), locale )
347347}
348348
349349// DiffFile represents a file diff.
0 commit comments