diff --git a/modules/templates/helper.go b/modules/templates/helper.go index 4abd94d46e..7460f99fea 100644 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -179,7 +179,6 @@ func NewFuncMap() template.FuncMap { // ----------------------------------------------------------------- // misc - "DiffLineTypeToStr": DiffLineTypeToStr, "ShortSha": base.ShortSha, "ActionContent2Commits": ActionContent2Commits, "IsMultilineCommitMessage": IsMultilineCommitMessage, diff --git a/modules/templates/util_misc.go b/modules/templates/util_misc.go index 599a0942ce..d11251fcdf 100644 --- a/modules/templates/util_misc.go +++ b/modules/templates/util_misc.go @@ -122,19 +122,6 @@ func ActionContent2Commits(act Actioner) *repository.PushCommits { return push } -// DiffLineTypeToStr returns diff line type name -func DiffLineTypeToStr(diffType int) string { - switch diffType { - case 2: - return "add" - case 3: - return "del" - case 4: - return "tag" - } - return "same" -} - // MigrationIcon returns a SVG name matching the service an issue/comment was migrated from func MigrationIcon(hostname string) string { switch hostname { diff --git a/services/gitdiff/gitdiff.go b/services/gitdiff/gitdiff.go index c50e8137ab..73474cf248 100644 --- a/services/gitdiff/gitdiff.go +++ b/services/gitdiff/gitdiff.go @@ -104,6 +104,19 @@ func (d *DiffLine) GetType() int { return int(d.Type) } +// GetHTMLDiffLineType returns the diff line type name for HTML +func (d *DiffLine) GetHTMLDiffLineType() string { + switch d.Type { + case DiffLineAdd: + return "add" + case DiffLineDel: + return "del" + case DiffLineSection: + return "tag" + } + return "same" +} + // CanComment returns whether a line can get commented func (d *DiffLine) CanComment() bool { return len(d.Comments) == 0 && d.Type != DiffLineSection diff --git a/templates/repo/diff/blob_excerpt.tmpl b/templates/repo/diff/blob_excerpt.tmpl index caa428dc28..7e11b33ba6 100644 --- a/templates/repo/diff/blob_excerpt.tmpl +++ b/templates/repo/diff/blob_excerpt.tmpl @@ -1,6 +1,6 @@ {{if $.IsSplitStyle}} {{range $k, $line := $.section.Lines}} -