gitea
Зеркало из https://github.com/go-gitea/gitea
1{{$file := .file}}
2{{$blobExcerptRepoLink := or ctx.RootData.CommitRepoLink ctx.RootData.RepoLink}}
3<colgroup>
4<col width="50">
5<col width="50">
6<col width="10">
7<col width="10">
8<col>
9</colgroup>
10{{range $j, $section := $file.Sections}}
11{{range $k, $line := $section.Lines}}
12<tr class="{{.GetHTMLDiffLineType}}-code nl-{{$k}} ol-{{$k}}" data-line-type="{{.GetHTMLDiffLineType}}">
13{{if eq .GetType 4}}
14{{if $.root.AfterCommitID}}
15{{$expandDirection := $line.GetExpandDirection}}
16<td colspan="2" class="lines-num">
17<div class="code-expander-buttons" data-expand-direction="{{$expandDirection}}">
18{{if or (eq $expandDirection 3) (eq $expandDirection 5)}}
19<button class="code-expander-button" hx-target="closest tr" hx-get="{{$blobExcerptRepoLink}}/blob_excerpt/{{PathEscape $.root.AfterCommitID}}?{{$line.GetBlobExcerptQuery}}&style=unified&direction=down&wiki={{$.root.PageIsWiki}}&anchor=diff-{{$file.NameHash}}K{{$line.SectionInfo.RightIdx}}">
20{{svg "octicon-fold-down"}}
21</button>
22{{end}}
23{{if or (eq $expandDirection 3) (eq $expandDirection 4)}}
24<button class="code-expander-button" hx-target="closest tr" hx-get="{{$blobExcerptRepoLink}}/blob_excerpt/{{PathEscape $.root.AfterCommitID}}?{{$line.GetBlobExcerptQuery}}&style=unified&direction=up&wiki={{$.root.PageIsWiki}}&anchor=diff-{{$file.NameHash}}K{{$line.SectionInfo.RightIdx}}">
25{{svg "octicon-fold-up"}}
26</button>
27{{end}}
28{{if eq $expandDirection 2}}
29<button class="code-expander-button" hx-target="closest tr" hx-get="{{$blobExcerptRepoLink}}/blob_excerpt/{{PathEscape $.root.AfterCommitID}}?{{$line.GetBlobExcerptQuery}}&style=unified&direction=&wiki={{$.root.PageIsWiki}}&anchor=diff-{{$file.NameHash}}K{{$line.SectionInfo.RightIdx}}">
30{{svg "octicon-fold"}}
31</button>
32{{end}}
33</div>
34</td>
35{{else}}
36{{/* for code file preview page or comment diffs on pull comment pages, do not show the expansion arrows */}}
37<td colspan="2" class="lines-num"></td>
38{{end}}
39{{else}}
40<td class="lines-num lines-num-old" data-line-num="{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}"><span rel="{{if $line.LeftIdx}}diff-{{$file.NameHash}}L{{$line.LeftIdx}}{{end}}"></span></td>
41<td class="lines-num lines-num-new" data-line-num="{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}"><span rel="{{if $line.RightIdx}}diff-{{$file.NameHash}}R{{$line.RightIdx}}{{end}}"></span></td>
42{{end}}
43{{$inlineDiff := $section.GetComputedInlineDiffFor $line ctx.Locale -}}
44<td class="lines-escape">
45{{- if $inlineDiff.EscapeStatus.Escaped -}}
46<button class="toggle-escape-button btn interact-bg" title="{{template "repo/diff/escape_title" dict "diff" $inlineDiff}}"></button>
47{{- end -}}
48</td>
49<td class="lines-type-marker"><span class="tw-font-mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span></td>
50{{if eq .GetType 4}}
51<td class="chroma lines-code blob-hunk">{{/*
52*/}}{{template "repo/diff/section_code" dict "diff" $inlineDiff}}{{/*
53*/}}</td>
54{{else}}
55<td class="chroma lines-code{{if (not $line.RightIdx)}} lines-code-old{{end}}">{{/*
56*/}}{{if and $.root.SignedUserID $.root.PageIsPullFiles}}{{/*
57*/}}<button type="button" aria-label="{{ctx.Locale.Tr "repo.diff.comment.add_line_comment"}}" class="ui primary button add-code-comment add-code-comment-{{if $line.RightIdx}}right{{else}}left{{end}}{{if (not $line.CanComment)}} tw-invisible{{end}}" data-side="{{if $line.RightIdx}}right{{else}}left{{end}}" data-idx="{{if $line.RightIdx}}{{$line.RightIdx}}{{else}}{{$line.LeftIdx}}{{end}}">{{/*
58*/}}{{svg "octicon-plus"}}{{/*
59*/}}</button>{{/*
60*/}}{{end}}{{/*
61*/}}{{template "repo/diff/section_code" dict "diff" $inlineDiff}}{{/*
62*/}}</td>
63{{end}}
64</tr>
65{{if $line.Comments}}
66<tr class="add-comment" data-line-type="{{.GetHTMLDiffLineType}}">
67<td class="add-comment-left add-comment-right" colspan="5">
68{{template "repo/diff/conversation" dict "." $.root "comments" $line.Comments}}
69</td>
70</tr>
71{{end}}
72{{end}}
73{{end}}
74