{{$file := $.file -}} {{$diffBlobExcerptData := ctx.RootData.DiffBlobExcerptData -}} {{$canAddComment := and ctx.RootData.SignedUserID $diffBlobExcerptData.PullIssueIndex -}} {{range $section := $file.Sections}} {{range $line := $section.Lines}} {{$hasMatch := ne $line.Match -1}} {{if or (not $line.IsDiffLineAdd) (not $hasMatch)}} {{if $line.IsDiffLineSection}} {{$inlineDiff := $section.GetComputedInlineDiffFor $line ctx.Locale}} {{$line.RenderBlobExcerptButtons $file.NameHash $diffBlobExcerptData}} {{ctx.RenderUtils.RenderUnicodeEscapeToggleButton $inlineDiff.EscapeStatus}} {{template "repo/diff/section_code" dict "diff" $inlineDiff}} {{else if and $line.IsDiffLineDel $hasMatch}} {{$match := index $section.Lines $line.Match}} {{- $leftDiff := ""}}{{if $line.LeftIdx}}{{$leftDiff = $section.GetComputedInlineDiffFor $line ctx.Locale}}{{end}} {{- $rightDiff := ""}}{{if $match.RightIdx}}{{$rightDiff = $section.GetComputedInlineDiffFor $match ctx.Locale}}{{end}} {{if $line.LeftIdx}}{{ctx.RenderUtils.RenderUnicodeEscapeToggleButton $leftDiff.EscapeStatus}}{{end}} {{- if $canAddComment -}} {{- end -}} {{- if $line.LeftIdx -}} {{- template "repo/diff/section_code" dict "diff" $leftDiff -}} {{- else -}} {{- end -}} {{if $match.RightIdx}}{{ctx.RenderUtils.RenderUnicodeEscapeToggleButton $rightDiff.EscapeStatus}}{{end}} {{if $match.RightIdx}}{{end}} {{- if $canAddComment -}} {{- end -}} {{- if $match.RightIdx -}} {{- template "repo/diff/section_code" dict "diff" $rightDiff -}} {{- else -}} {{- end -}} {{else}} {{$inlineDiff := $section.GetComputedInlineDiffFor $line ctx.Locale}} {{if $line.LeftIdx}}{{ctx.RenderUtils.RenderUnicodeEscapeToggleButton $inlineDiff.EscapeStatus}}{{end}} {{if $line.LeftIdx}}{{end}} {{- if and $canAddComment (not $line.IsDiffLineAdd) -}} {{- end -}} {{- if $line.LeftIdx -}} {{- template "repo/diff/section_code" dict "diff" $inlineDiff -}} {{- else -}} {{- end -}} {{if $line.RightIdx}}{{ctx.RenderUtils.RenderUnicodeEscapeToggleButton $inlineDiff.EscapeStatus}}{{end}} {{if $line.RightIdx}}{{end}} {{- if and $canAddComment (not $line.IsDiffLineDel) -}} {{- end -}} {{- if $line.RightIdx -}} {{- template "repo/diff/section_code" dict "diff" $inlineDiff -}} {{- else -}} {{- end -}} {{end}} {{if and $line.IsDiffLineDel $hasMatch}} {{$match := index $section.Lines $line.Match}} {{if or $line.Comments $match.Comments}} {{if $line.Comments}} {{if eq $line.GetCommentSide "previous"}} {{template "repo/diff/conversation" dict "comments" $line.Comments}} {{end}} {{end}} {{if $match.Comments}} {{if eq $match.GetCommentSide "previous"}} {{template "repo/diff/conversation" dict "comments" $match.Comments}} {{end}} {{end}} {{if $line.Comments}} {{if eq $line.GetCommentSide "proposed"}} {{template "repo/diff/conversation" dict "comments" $line.Comments}} {{end}} {{end}} {{if $match.Comments}} {{if eq $match.GetCommentSide "proposed"}} {{template "repo/diff/conversation" dict "comments" $match.Comments}} {{end}} {{end}} {{end}} {{else if $line.Comments}} {{if eq $line.GetCommentSide "previous"}} {{template "repo/diff/conversation" dict "comments" $line.Comments}} {{end}} {{if eq $line.GetCommentSide "proposed"}} {{template "repo/diff/conversation" dict "comments" $line.Comments}} {{end}} {{end}} {{end}} {{end}} {{end}}