1// Code generated by templ - DO NOT EDIT.
2
3// templ: version: v0.3.1020
4// SPDX-License-Identifier: AGPL-3.0-or-later
5
6package web
7
8//lint:file-ignore SA4006 This context is only used if a nested component is present.
9
10import "github.com/a-h/templ"
11import templruntime "github.com/a-h/templ/runtime"
12
13// Commit is a commit: the message and facts, the diff tools, the diff.
14func Commit(l Layout, p CommitPage) templ.Component {
15 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
16 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
17 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
18 return templ_7745c5c3_CtxErr
19 }
20 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
21 if !templ_7745c5c3_IsBuffer {
22 defer func() {
23 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
24 if templ_7745c5c3_Err == nil {
25 templ_7745c5c3_Err = templ_7745c5c3_BufErr
26 }
27 }()
28 }
29 ctx = templ.InitializeContext(ctx)
30 templ_7745c5c3_Var1 := templ.GetChildren(ctx)
31 if templ_7745c5c3_Var1 == nil {
32 templ_7745c5c3_Var1 = templ.NopComponent
33 }
34 ctx = templ.ClearChildren(ctx)
35 templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
36 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
37 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
38 if !templ_7745c5c3_IsBuffer {
39 defer func() {
40 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
41 if templ_7745c5c3_Err == nil {
42 templ_7745c5c3_Err = templ_7745c5c3_BufErr
43 }
44 }()
45 }
46 ctx = templ.InitializeContext(ctx)
47 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<header class=\"show\"><h1>")
48 if templ_7745c5c3_Err != nil {
49 return templ_7745c5c3_Err
50 }
51 var templ_7745c5c3_Var3 string
52 templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(p.Subject)
53 if templ_7745c5c3_Err != nil {
54 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 9, Col: 18}
55 }
56 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
57 if templ_7745c5c3_Err != nil {
58 return templ_7745c5c3_Err
59 }
60 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "</h1>")
61 if templ_7745c5c3_Err != nil {
62 return templ_7745c5c3_Err
63 }
64 if p.Body != "" {
65 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "<pre class=\"msg\">")
66 if templ_7745c5c3_Err != nil {
67 return templ_7745c5c3_Err
68 }
69 var templ_7745c5c3_Var4 string
70 templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(p.Body)
71 if templ_7745c5c3_Err != nil {
72 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 11, Col: 29}
73 }
74 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
75 if templ_7745c5c3_Err != nil {
76 return templ_7745c5c3_Err
77 }
78 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "</pre>")
79 if templ_7745c5c3_Err != nil {
80 return templ_7745c5c3_Err
81 }
82 }
83 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "<dl class=\"kv show-kv\"><dt>commit</dt><dd>")
84 if templ_7745c5c3_Err != nil {
85 return templ_7745c5c3_Err
86 }
87 var templ_7745c5c3_Var5 string
88 templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(p.SHA)
89 if templ_7745c5c3_Err != nil {
90 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 15, Col: 15}
91 }
92 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
93 if templ_7745c5c3_Err != nil {
94 return templ_7745c5c3_Err
95 }
96 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "</dd><dt>author</dt><dd>")
97 if templ_7745c5c3_Err != nil {
98 return templ_7745c5c3_Err
99 }
100 templ_7745c5c3_Err = personView(p.Author).Render(ctx, templ_7745c5c3_Buffer)
101 if templ_7745c5c3_Err != nil {
102 return templ_7745c5c3_Err
103 }
104 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "</dd>")
105 if templ_7745c5c3_Err != nil {
106 return templ_7745c5c3_Err
107 }
108 if p.Committer != nil {
109 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "<dt>committer</dt><dd>")
110 if templ_7745c5c3_Err != nil {
111 return templ_7745c5c3_Err
112 }
113 templ_7745c5c3_Err = personView(*p.Committer).Render(ctx, templ_7745c5c3_Buffer)
114 if templ_7745c5c3_Err != nil {
115 return templ_7745c5c3_Err
116 }
117 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "</dd>")
118 if templ_7745c5c3_Err != nil {
119 return templ_7745c5c3_Err
120 }
121 }
122 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "<dt>")
123 if templ_7745c5c3_Err != nil {
124 return templ_7745c5c3_Err
125 }
126 if p.Merge {
127 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "merge of")
128 if templ_7745c5c3_Err != nil {
129 return templ_7745c5c3_Err
130 }
131 } else {
132 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "parent")
133 if templ_7745c5c3_Err != nil {
134 return templ_7745c5c3_Err
135 }
136 }
137 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "</dt><dd>")
138 if templ_7745c5c3_Err != nil {
139 return templ_7745c5c3_Err
140 }
141 if p.Root {
142 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "none (root commit) ")
143 if templ_7745c5c3_Err != nil {
144 return templ_7745c5c3_Err
145 }
146 }
147 for i, par := range p.Parents {
148 if i > 0 {
149 var templ_7745c5c3_Var6 string
150 templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(" + ")
151 if templ_7745c5c3_Err != nil {
152 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 35, Col: 14}
153 }
154 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
155 if templ_7745c5c3_Err != nil {
156 return templ_7745c5c3_Err
157 }
158 }
159 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, " <a href=\"")
160 if templ_7745c5c3_Err != nil {
161 return templ_7745c5c3_Err
162 }
163 var templ_7745c5c3_Var7 templ.SafeURL
164 templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(par.Href))
165 if templ_7745c5c3_Err != nil {
166 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 37, Col: 39}
167 }
168 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
169 if templ_7745c5c3_Err != nil {
170 return templ_7745c5c3_Err
171 }
172 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "\">")
173 if templ_7745c5c3_Err != nil {
174 return templ_7745c5c3_Err
175 }
176 var templ_7745c5c3_Var8 string
177 templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(par.Label)
178 if templ_7745c5c3_Err != nil {
179 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 37, Col: 53}
180 }
181 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
182 if templ_7745c5c3_Err != nil {
183 return templ_7745c5c3_Err
184 }
185 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "</a> ")
186 if templ_7745c5c3_Err != nil {
187 return templ_7745c5c3_Err
188 }
189 }
190 if p.Merge {
191 var templ_7745c5c3_Var9 string
192 templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(" · diff against the first parent")
193 if templ_7745c5c3_Err != nil {
194 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 40, Col: 43}
195 }
196 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
197 if templ_7745c5c3_Err != nil {
198 return templ_7745c5c3_Err
199 }
200 }
201 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "</dd>")
202 if templ_7745c5c3_Err != nil {
203 return templ_7745c5c3_Err
204 }
205 if p.Checks.Total > 0 {
206 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "<dt>checks</dt><dd>")
207 if templ_7745c5c3_Err != nil {
208 return templ_7745c5c3_Err
209 }
210 templ_7745c5c3_Err = CommitChecks(p.Checks).Render(ctx, templ_7745c5c3_Buffer)
211 if templ_7745c5c3_Err != nil {
212 return templ_7745c5c3_Err
213 }
214 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "</dd>")
215 if templ_7745c5c3_Err != nil {
216 return templ_7745c5c3_Err
217 }
218 }
219 if len(p.Refs) > 0 {
220 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "<dt>refs</dt><dd>")
221 if templ_7745c5c3_Err != nil {
222 return templ_7745c5c3_Err
223 }
224 for _, r := range p.Refs {
225 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "<span class=\"pill\">")
226 if templ_7745c5c3_Err != nil {
227 return templ_7745c5c3_Err
228 }
229 var templ_7745c5c3_Var10 string
230 templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(r)
231 if templ_7745c5c3_Err != nil {
232 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 51, Col: 29}
233 }
234 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
235 if templ_7745c5c3_Err != nil {
236 return templ_7745c5c3_Err
237 }
238 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "</span>")
239 if templ_7745c5c3_Err != nil {
240 return templ_7745c5c3_Err
241 }
242 }
243 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "</dd>")
244 if templ_7745c5c3_Err != nil {
245 return templ_7745c5c3_Err
246 }
247 }
248 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "</dl></header><div class=\"diff-tools\" role=\"toolbar\" aria-label=\"Diff view\"><span class=\"dim\">")
249 if templ_7745c5c3_Err != nil {
250 return templ_7745c5c3_Err
251 }
252 var templ_7745c5c3_Var11 string
253 templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(plural(p.NFiles, "file", "files"))
254 if templ_7745c5c3_Err != nil {
255 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 58, Col: 56}
256 }
257 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
258 if templ_7745c5c3_Err != nil {
259 return templ_7745c5c3_Err
260 }
261 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, " · <span class=\"plus\">+")
262 if templ_7745c5c3_Err != nil {
263 return templ_7745c5c3_Err
264 }
265 var templ_7745c5c3_Var12 string
266 templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(itoa(p.Adds))
267 if templ_7745c5c3_Err != nil {
268 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 58, Col: 96}
269 }
270 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
271 if templ_7745c5c3_Err != nil {
272 return templ_7745c5c3_Err
273 }
274 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "</span> <span class=\"minus\">-")
275 if templ_7745c5c3_Err != nil {
276 return templ_7745c5c3_Err
277 }
278 var templ_7745c5c3_Var13 string
279 templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(itoa(p.Dels))
280 if templ_7745c5c3_Err != nil {
281 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 58, Col: 141}
282 }
283 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
284 if templ_7745c5c3_Err != nil {
285 return templ_7745c5c3_Err
286 }
287 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "</span></span> <span class=\"grow\"></span>")
288 if templ_7745c5c3_Err != nil {
289 return templ_7745c5c3_Err
290 }
291 templ_7745c5c3_Err = viewLink(p.DiffView, "unified", "Unified", "u", p.UnifiedHref).Render(ctx, templ_7745c5c3_Buffer)
292 if templ_7745c5c3_Err != nil {
293 return templ_7745c5c3_Err
294 }
295 templ_7745c5c3_Err = viewLink(p.DiffView, "split", "Split", "d", p.SplitHref).Render(ctx, templ_7745c5c3_Buffer)
296 if templ_7745c5c3_Err != nil {
297 return templ_7745c5c3_Err
298 }
299 templ_7745c5c3_Err = collapseButton().Render(ctx, templ_7745c5c3_Buffer)
300 if templ_7745c5c3_Err != nil {
301 return templ_7745c5c3_Err
302 }
303 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "</div>")
304 if templ_7745c5c3_Err != nil {
305 return templ_7745c5c3_Err
306 }
307 if p.Invisible {
308 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "<p class=\"notice\">this diff holds invisible characters (direction controls, zero-width characters). They are shown as <span class=\"inv\"><U+XXXX></span> markers, never applied.</p>")
309 if templ_7745c5c3_Err != nil {
310 return templ_7745c5c3_Err
311 }
312 }
313 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 31, " ")
314 if templ_7745c5c3_Err != nil {
315 return templ_7745c5c3_Err
316 }
317 if p.Note != "" {
318 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "<p class=\"notice\">")
319 if templ_7745c5c3_Err != nil {
320 return templ_7745c5c3_Err
321 }
322 var templ_7745c5c3_Var14 string
323 templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(p.Note)
324 if templ_7745c5c3_Err != nil {
325 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 71, Col: 29}
326 }
327 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
328 if templ_7745c5c3_Err != nil {
329 return templ_7745c5c3_Err
330 }
331 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "</p>")
332 if templ_7745c5c3_Err != nil {
333 return templ_7745c5c3_Err
334 }
335 }
336 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, " <div id=\"diffs\"")
337 if templ_7745c5c3_Err != nil {
338 return templ_7745c5c3_Err
339 }
340 if p.Both {
341 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, " data-diff=\"")
342 if templ_7745c5c3_Err != nil {
343 return templ_7745c5c3_Err
344 }
345 var templ_7745c5c3_Var15 string
346 templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.ResolveAttributeValue(p.View)
347 if templ_7745c5c3_Err != nil {
348 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 76, Col: 22}
349 }
350 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var15)
351 if templ_7745c5c3_Err != nil {
352 return templ_7745c5c3_Err
353 }
354 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, "\"")
355 if templ_7745c5c3_Err != nil {
356 return templ_7745c5c3_Err
357 }
358 } else {
359 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, " data-view=\"")
360 if templ_7745c5c3_Err != nil {
361 return templ_7745c5c3_Err
362 }
363 var templ_7745c5c3_Var16 string
364 templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.ResolveAttributeValue(p.View)
365 if templ_7745c5c3_Err != nil {
366 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 78, Col: 22}
367 }
368 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var16)
369 if templ_7745c5c3_Err != nil {
370 return templ_7745c5c3_Err
371 }
372 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, "\"")
373 if templ_7745c5c3_Err != nil {
374 return templ_7745c5c3_Err
375 }
376 }
377 if p.Both && !p.Pinned {
378 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, " hx-live=\"this.dataset.diff = sessionStorage.getItem('diff') || this.dataset.diff\"")
379 if templ_7745c5c3_Err != nil {
380 return templ_7745c5c3_Err
381 }
382 }
383 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, ">")
384 if templ_7745c5c3_Err != nil {
385 return templ_7745c5c3_Err
386 }
387 for _, f := range p.Files {
388 templ_7745c5c3_Err = DiffFileView(f, p.DiffView).Render(ctx, templ_7745c5c3_Buffer)
389 if templ_7745c5c3_Err != nil {
390 return templ_7745c5c3_Err
391 }
392 }
393 if len(p.Files) == 0 {
394 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, "<p class=\"note\">no changed files")
395 if templ_7745c5c3_Err != nil {
396 return templ_7745c5c3_Err
397 }
398 var templ_7745c5c3_Var17 string
399 templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(" ")
400 if templ_7745c5c3_Err != nil {
401 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 88, Col: 41}
402 }
403 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
404 if templ_7745c5c3_Err != nil {
405 return templ_7745c5c3_Err
406 }
407 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 42, " ")
408 if templ_7745c5c3_Err != nil {
409 return templ_7745c5c3_Err
410 }
411 if p.Merge {
412 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 43, "against the first parent.")
413 if templ_7745c5c3_Err != nil {
414 return templ_7745c5c3_Err
415 }
416 } else {
417 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 44, "in this commit.")
418 if templ_7745c5c3_Err != nil {
419 return templ_7745c5c3_Err
420 }
421 }
422 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 45, "</p>")
423 if templ_7745c5c3_Err != nil {
424 return templ_7745c5c3_Err
425 }
426 }
427 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 46, "</div>")
428 if templ_7745c5c3_Err != nil {
429 return templ_7745c5c3_Err
430 }
431 return nil
432 })
433 templ_7745c5c3_Err = Shell(l, commitRail(p)).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
434 if templ_7745c5c3_Err != nil {
435 return templ_7745c5c3_Err
436 }
437 return nil
438 })
439}
440
441// viewLink is a button of the diff tools. It is a link, so that the split
442// layout works without JavaScript; with it, and when both layouts are in the
443// page, a click only flips the layout.
444func viewLink(p DiffView, view, label, key, href string) templ.Component {
445 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
446 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
447 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
448 return templ_7745c5c3_CtxErr
449 }
450 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
451 if !templ_7745c5c3_IsBuffer {
452 defer func() {
453 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
454 if templ_7745c5c3_Err == nil {
455 templ_7745c5c3_Err = templ_7745c5c3_BufErr
456 }
457 }()
458 }
459 ctx = templ.InitializeContext(ctx)
460 templ_7745c5c3_Var18 := templ.GetChildren(ctx)
461 if templ_7745c5c3_Var18 == nil {
462 templ_7745c5c3_Var18 = templ.NopComponent
463 }
464 ctx = templ.ClearChildren(ctx)
465 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 47, "<a href=\"")
466 if templ_7745c5c3_Err != nil {
467 return templ_7745c5c3_Err
468 }
469 var templ_7745c5c3_Var19 templ.SafeURL
470 templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(href))
471 if templ_7745c5c3_Err != nil {
472 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 105, Col: 28}
473 }
474 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19))
475 if templ_7745c5c3_Err != nil {
476 return templ_7745c5c3_Err
477 }
478 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 48, "\" class=\"btn vbtn\" data-view=\"")
479 if templ_7745c5c3_Err != nil {
480 return templ_7745c5c3_Err
481 }
482 var templ_7745c5c3_Var20 string
483 templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.ResolveAttributeValue(view)
484 if templ_7745c5c3_Err != nil {
485 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 107, Col: 18}
486 }
487 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var20)
488 if templ_7745c5c3_Err != nil {
489 return templ_7745c5c3_Err
490 }
491 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 49, "\" aria-keyshortcuts=\"")
492 if templ_7745c5c3_Err != nil {
493 return templ_7745c5c3_Err
494 }
495 var templ_7745c5c3_Var21 string
496 templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.ResolveAttributeValue(key)
497 if templ_7745c5c3_Err != nil {
498 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 108, Col: 25}
499 }
500 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var21)
501 if templ_7745c5c3_Err != nil {
502 return templ_7745c5c3_Err
503 }
504 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 50, "\"")
505 if templ_7745c5c3_Err != nil {
506 return templ_7745c5c3_Err
507 }
508 if p.View == view {
509 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 51, " aria-current=\"true\"")
510 if templ_7745c5c3_Err != nil {
511 return templ_7745c5c3_Err
512 }
513 }
514 if p.Both {
515 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 52, " data-fire=\"")
516 if templ_7745c5c3_Err != nil {
517 return templ_7745c5c3_Err
518 }
519 var templ_7745c5c3_Var22 string
520 templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.ResolveAttributeValue(view)
521 if templ_7745c5c3_Err != nil {
522 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 113, Col: 19}
523 }
524 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var22)
525 if templ_7745c5c3_Err != nil {
526 return templ_7745c5c3_Err
527 }
528 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 53, "\" :aria-current=\"q('#diffs').attr['data-diff'] === this.dataset.view ? 'true' : false\"")
529 if templ_7745c5c3_Err != nil {
530 return templ_7745c5c3_Err
531 }
532 }
533 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 54, ">")
534 if templ_7745c5c3_Err != nil {
535 return templ_7745c5c3_Err
536 }
537 var templ_7745c5c3_Var23 string
538 templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(label)
539 if templ_7745c5c3_Err != nil {
540 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 116, Col: 9}
541 }
542 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23))
543 if templ_7745c5c3_Err != nil {
544 return templ_7745c5c3_Err
545 }
546 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 55, "<kbd aria-hidden=\"true\">")
547 if templ_7745c5c3_Err != nil {
548 return templ_7745c5c3_Err
549 }
550 var templ_7745c5c3_Var24 string
551 templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(key)
552 if templ_7745c5c3_Err != nil {
553 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 116, Col: 40}
554 }
555 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24))
556 if templ_7745c5c3_Err != nil {
557 return templ_7745c5c3_Err
558 }
559 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 56, "</kbd></a>")
560 if templ_7745c5c3_Err != nil {
561 return templ_7745c5c3_Err
562 }
563 return nil
564 })
565}
566
567// collapseButton folds every file of the diff, or opens them all again when
568// none is open; its label follows the state.
569func collapseButton() templ.Component {
570 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
571 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
572 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
573 return templ_7745c5c3_CtxErr
574 }
575 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
576 if !templ_7745c5c3_IsBuffer {
577 defer func() {
578 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
579 if templ_7745c5c3_Err == nil {
580 templ_7745c5c3_Err = templ_7745c5c3_BufErr
581 }
582 }()
583 }
584 ctx = templ.InitializeContext(ctx)
585 templ_7745c5c3_Var25 := templ.GetChildren(ctx)
586 if templ_7745c5c3_Var25 == nil {
587 templ_7745c5c3_Var25 = templ.NopComponent
588 }
589 ctx = templ.ClearChildren(ctx)
590 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 57, "<button type=\"button\" aria-keyshortcuts=\"x\" data-js data-fire=\"collapse\" class=\"btn\"><span hx-live=\"this.textContent = q('[data-file][open]').count || !q('[data-file]').count ? 'Collapse all' : 'Expand all'\">Collapse all</span><kbd aria-hidden=\"true\">x</kbd></button>")
591 if templ_7745c5c3_Err != nil {
592 return templ_7745c5c3_Err
593 }
594 return nil
595 })
596}
597
598func personView(pr Person) templ.Component {
599 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
600 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
601 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
602 return templ_7745c5c3_CtxErr
603 }
604 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
605 if !templ_7745c5c3_IsBuffer {
606 defer func() {
607 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
608 if templ_7745c5c3_Err == nil {
609 templ_7745c5c3_Err = templ_7745c5c3_BufErr
610 }
611 }()
612 }
613 ctx = templ.InitializeContext(ctx)
614 templ_7745c5c3_Var26 := templ.GetChildren(ctx)
615 if templ_7745c5c3_Var26 == nil {
616 templ_7745c5c3_Var26 = templ.NopComponent
617 }
618 ctx = templ.ClearChildren(ctx)
619 var templ_7745c5c3_Var27 string
620 templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(pr.Name)
621 if templ_7745c5c3_Err != nil {
622 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 128, Col: 10}
623 }
624 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27))
625 if templ_7745c5c3_Err != nil {
626 return templ_7745c5c3_Err
627 }
628 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 58, " ")
629 if templ_7745c5c3_Err != nil {
630 return templ_7745c5c3_Err
631 }
632 if pr.WhenAt != "" {
633 var templ_7745c5c3_Var28 string
634 templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinStringErrs(" · ")
635 if templ_7745c5c3_Err != nil {
636 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 130, Col: 10}
637 }
638 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var28))
639 if templ_7745c5c3_Err != nil {
640 return templ_7745c5c3_Err
641 }
642 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 59, "<time datetime=\"")
643 if templ_7745c5c3_Err != nil {
644 return templ_7745c5c3_Err
645 }
646 var templ_7745c5c3_Var29 string
647 templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.ResolveAttributeValue(pr.WhenAt)
648 if templ_7745c5c3_Err != nil {
649 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 130, Col: 38}
650 }
651 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var29)
652 if templ_7745c5c3_Err != nil {
653 return templ_7745c5c3_Err
654 }
655 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 60, "\" title=\"")
656 if templ_7745c5c3_Err != nil {
657 return templ_7745c5c3_Err
658 }
659 var templ_7745c5c3_Var30 string
660 templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.ResolveAttributeValue(pr.Abs)
661 if templ_7745c5c3_Err != nil {
662 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 130, Col: 55}
663 }
664 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var30)
665 if templ_7745c5c3_Err != nil {
666 return templ_7745c5c3_Err
667 }
668 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 61, "\">")
669 if templ_7745c5c3_Err != nil {
670 return templ_7745c5c3_Err
671 }
672 var templ_7745c5c3_Var31 string
673 templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(pr.When)
674 if templ_7745c5c3_Err != nil {
675 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 130, Col: 67}
676 }
677 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var31))
678 if templ_7745c5c3_Err != nil {
679 return templ_7745c5c3_Err
680 }
681 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 62, "</time>")
682 if templ_7745c5c3_Err != nil {
683 return templ_7745c5c3_Err
684 }
685 var templ_7745c5c3_Var32 string
686 templ_7745c5c3_Var32, templ_7745c5c3_Err = templ.JoinStringErrs(" · " + pr.Abs)
687 if templ_7745c5c3_Err != nil {
688 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 130, Col: 93}
689 }
690 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var32))
691 if templ_7745c5c3_Err != nil {
692 return templ_7745c5c3_Err
693 }
694 }
695 return nil
696 })
697}
698
699func commitRail(p CommitPage) templ.Component {
700 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
701 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
702 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
703 return templ_7745c5c3_CtxErr
704 }
705 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
706 if !templ_7745c5c3_IsBuffer {
707 defer func() {
708 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
709 if templ_7745c5c3_Err == nil {
710 templ_7745c5c3_Err = templ_7745c5c3_BufErr
711 }
712 }()
713 }
714 ctx = templ.InitializeContext(ctx)
715 templ_7745c5c3_Var33 := templ.GetChildren(ctx)
716 if templ_7745c5c3_Var33 == nil {
717 templ_7745c5c3_Var33 = templ.NopComponent
718 }
719 ctx = templ.ClearChildren(ctx)
720 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 63, "<section aria-labelledby=\"r-files\"><h2 id=\"r-files\">Files <span class=\"count\">")
721 if templ_7745c5c3_Err != nil {
722 return templ_7745c5c3_Err
723 }
724 var templ_7745c5c3_Var34 string
725 templ_7745c5c3_Var34, templ_7745c5c3_Err = templ.JoinStringErrs(itoa(len(p.Files)))
726 if templ_7745c5c3_Err != nil {
727 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 136, Col: 65}
728 }
729 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var34))
730 if templ_7745c5c3_Err != nil {
731 return templ_7745c5c3_Err
732 }
733 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 64, "</span></h2>")
734 if templ_7745c5c3_Err != nil {
735 return templ_7745c5c3_Err
736 }
737 templ_7745c5c3_Err = FileList(p.Files).Render(ctx, templ_7745c5c3_Buffer)
738 if templ_7745c5c3_Err != nil {
739 return templ_7745c5c3_Err
740 }
741 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 65, "</section>")
742 if templ_7745c5c3_Err != nil {
743 return templ_7745c5c3_Err
744 }
745 return nil
746 })
747}
748
749// FileList is the table of contents of a diff: status letter, path, +n -m
750// and an ASCII bar. The row of the file in view is marked.
751func FileList(files []DiffFile) templ.Component {
752 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
753 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
754 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
755 return templ_7745c5c3_CtxErr
756 }
757 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
758 if !templ_7745c5c3_IsBuffer {
759 defer func() {
760 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
761 if templ_7745c5c3_Err == nil {
762 templ_7745c5c3_Err = templ_7745c5c3_BufErr
763 }
764 }()
765 }
766 ctx = templ.InitializeContext(ctx)
767 templ_7745c5c3_Var35 := templ.GetChildren(ctx)
768 if templ_7745c5c3_Var35 == nil {
769 templ_7745c5c3_Var35 = templ.NopComponent
770 }
771 ctx = templ.ClearChildren(ctx)
772 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 66, "<ol class=\"files\" aria-label=\"Changed files\">")
773 if templ_7745c5c3_Err != nil {
774 return templ_7745c5c3_Err
775 }
776 for _, f := range files {
777 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 67, "<li><a href=\"")
778 if templ_7745c5c3_Err != nil {
779 return templ_7745c5c3_Err
780 }
781 var templ_7745c5c3_Var36 templ.SafeURL
782 templ_7745c5c3_Var36, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL("#" + f.ID))
783 if templ_7745c5c3_Err != nil {
784 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 148, Col: 37}
785 }
786 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var36))
787 if templ_7745c5c3_Err != nil {
788 return templ_7745c5c3_Err
789 }
790 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 68, "\" hx-on:click=\"document.getElementById(this.hash.slice(1)).open = true\"><span class=\"st\" title=\"")
791 if templ_7745c5c3_Err != nil {
792 return templ_7745c5c3_Err
793 }
794 var templ_7745c5c3_Var37 string
795 templ_7745c5c3_Var37, templ_7745c5c3_Err = templ.ResolveAttributeValue(f.Status)
796 if templ_7745c5c3_Err != nil {
797 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 151, Col: 38}
798 }
799 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var37)
800 if templ_7745c5c3_Err != nil {
801 return templ_7745c5c3_Err
802 }
803 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 69, "\">")
804 if templ_7745c5c3_Err != nil {
805 return templ_7745c5c3_Err
806 }
807 var templ_7745c5c3_Var38 string
808 templ_7745c5c3_Var38, templ_7745c5c3_Err = templ.JoinStringErrs(f.Status)
809 if templ_7745c5c3_Err != nil {
810 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 151, Col: 51}
811 }
812 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var38))
813 if templ_7745c5c3_Err != nil {
814 return templ_7745c5c3_Err
815 }
816 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 70, "</span> <span class=\"p\" title=\"")
817 if templ_7745c5c3_Err != nil {
818 return templ_7745c5c3_Err
819 }
820 var templ_7745c5c3_Var39 string
821 templ_7745c5c3_Var39, templ_7745c5c3_Err = templ.ResolveAttributeValue(f.Path)
822 if templ_7745c5c3_Err != nil {
823 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 152, Col: 35}
824 }
825 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var39)
826 if templ_7745c5c3_Err != nil {
827 return templ_7745c5c3_Err
828 }
829 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 71, "\">")
830 if templ_7745c5c3_Err != nil {
831 return templ_7745c5c3_Err
832 }
833 var templ_7745c5c3_Var40 string
834 templ_7745c5c3_Var40, templ_7745c5c3_Err = templ.JoinStringErrs(f.Path)
835 if templ_7745c5c3_Err != nil {
836 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 152, Col: 46}
837 }
838 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var40))
839 if templ_7745c5c3_Err != nil {
840 return templ_7745c5c3_Err
841 }
842 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 72, "</span> <span class=\"n\"><span class=\"plus\">+")
843 if templ_7745c5c3_Err != nil {
844 return templ_7745c5c3_Err
845 }
846 var templ_7745c5c3_Var41 string
847 templ_7745c5c3_Var41, templ_7745c5c3_Err = templ.JoinStringErrs(itoa(f.Add))
848 if templ_7745c5c3_Err != nil {
849 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 153, Col: 54}
850 }
851 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var41))
852 if templ_7745c5c3_Err != nil {
853 return templ_7745c5c3_Err
854 }
855 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 73, "</span> <span class=\"minus\">-")
856 if templ_7745c5c3_Err != nil {
857 return templ_7745c5c3_Err
858 }
859 var templ_7745c5c3_Var42 string
860 templ_7745c5c3_Var42, templ_7745c5c3_Err = templ.JoinStringErrs(itoa(f.Del))
861 if templ_7745c5c3_Err != nil {
862 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 153, Col: 98}
863 }
864 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var42))
865 if templ_7745c5c3_Err != nil {
866 return templ_7745c5c3_Err
867 }
868 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 74, "</span></span> <span class=\"b\" aria-hidden=\"true\"><span class=\"plus\">")
869 if templ_7745c5c3_Err != nil {
870 return templ_7745c5c3_Err
871 }
872 var templ_7745c5c3_Var43 string
873 templ_7745c5c3_Var43, templ_7745c5c3_Err = templ.JoinStringErrs(f.Bar.Add)
874 if templ_7745c5c3_Err != nil {
875 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 154, Col: 70}
876 }
877 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var43))
878 if templ_7745c5c3_Err != nil {
879 return templ_7745c5c3_Err
880 }
881 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 75, "</span><span class=\"minus\">")
882 if templ_7745c5c3_Err != nil {
883 return templ_7745c5c3_Err
884 }
885 var templ_7745c5c3_Var44 string
886 templ_7745c5c3_Var44, templ_7745c5c3_Err = templ.JoinStringErrs(f.Bar.Del)
887 if templ_7745c5c3_Err != nil {
888 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 154, Col: 110}
889 }
890 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var44))
891 if templ_7745c5c3_Err != nil {
892 return templ_7745c5c3_Err
893 }
894 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 76, "</span>")
895 if templ_7745c5c3_Err != nil {
896 return templ_7745c5c3_Err
897 }
898 var templ_7745c5c3_Var45 string
899 templ_7745c5c3_Var45, templ_7745c5c3_Err = templ.JoinStringErrs(f.Bar.Rest)
900 if templ_7745c5c3_Err != nil {
901 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 154, Col: 131}
902 }
903 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var45))
904 if templ_7745c5c3_Err != nil {
905 return templ_7745c5c3_Err
906 }
907 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 77, "</span></a></li>")
908 if templ_7745c5c3_Err != nil {
909 return templ_7745c5c3_Err
910 }
911 }
912 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 78, "</ol>")
913 if templ_7745c5c3_Err != nil {
914 return templ_7745c5c3_Err
915 }
916 return nil
917 })
918}
919
920// DiffFileView is one file of the diff: a <details> (per-file collapse). The
921// unified and the split tables are both in it; #diffs[data-diff] shows one.
922// Every changed line keeps its +/- marker, so a change is never conveyed by
923// colour alone.
924func DiffFileView(f DiffFile, p DiffView) templ.Component {
925 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
926 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
927 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
928 return templ_7745c5c3_CtxErr
929 }
930 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
931 if !templ_7745c5c3_IsBuffer {
932 defer func() {
933 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
934 if templ_7745c5c3_Err == nil {
935 templ_7745c5c3_Err = templ_7745c5c3_BufErr
936 }
937 }()
938 }
939 ctx = templ.InitializeContext(ctx)
940 templ_7745c5c3_Var46 := templ.GetChildren(ctx)
941 if templ_7745c5c3_Var46 == nil {
942 templ_7745c5c3_Var46 = templ.NopComponent
943 }
944 ctx = templ.ClearChildren(ctx)
945 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 79, "<details class=\"dfile\" id=\"")
946 if templ_7745c5c3_Err != nil {
947 return templ_7745c5c3_Err
948 }
949 var templ_7745c5c3_Var47 string
950 templ_7745c5c3_Var47, templ_7745c5c3_Err = templ.ResolveAttributeValue(f.ID)
951 if templ_7745c5c3_Err != nil {
952 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 168, Col: 11}
953 }
954 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var47)
955 if templ_7745c5c3_Err != nil {
956 return templ_7745c5c3_Err
957 }
958 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 80, "\" data-file")
959 if templ_7745c5c3_Err != nil {
960 return templ_7745c5c3_Err
961 }
962 if f.Open {
963 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 81, " open")
964 if templ_7745c5c3_Err != nil {
965 return templ_7745c5c3_Err
966 }
967 }
968 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 82, "><summary><span class=\"st\">")
969 if templ_7745c5c3_Err != nil {
970 return templ_7745c5c3_Err
971 }
972 var templ_7745c5c3_Var48 string
973 templ_7745c5c3_Var48, templ_7745c5c3_Err = templ.JoinStringErrs(f.Status)
974 if templ_7745c5c3_Err != nil {
975 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 175, Col: 30}
976 }
977 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var48))
978 if templ_7745c5c3_Err != nil {
979 return templ_7745c5c3_Err
980 }
981 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 83, "</span>")
982 if templ_7745c5c3_Err != nil {
983 return templ_7745c5c3_Err
984 }
985 var templ_7745c5c3_Var49 string
986 templ_7745c5c3_Var49, templ_7745c5c3_Err = templ.JoinStringErrs(" ")
987 if templ_7745c5c3_Err != nil {
988 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 175, Col: 44}
989 }
990 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var49))
991 if templ_7745c5c3_Err != nil {
992 return templ_7745c5c3_Err
993 }
994 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 84, "<span class=\"p\">")
995 if templ_7745c5c3_Err != nil {
996 return templ_7745c5c3_Err
997 }
998 var templ_7745c5c3_Var50 string
999 templ_7745c5c3_Var50, templ_7745c5c3_Err = templ.JoinStringErrs(f.Path)
1000 if templ_7745c5c3_Err != nil {
1001 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 175, Col: 70}
1002 }
1003 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var50))
1004 if templ_7745c5c3_Err != nil {
1005 return templ_7745c5c3_Err
1006 }
1007 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 85, "</span>")
1008 if templ_7745c5c3_Err != nil {
1009 return templ_7745c5c3_Err
1010 }
1011 var templ_7745c5c3_Var51 string
1012 templ_7745c5c3_Var51, templ_7745c5c3_Err = templ.JoinStringErrs(" ")
1013 if templ_7745c5c3_Err != nil {
1014 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 175, Col: 84}
1015 }
1016 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var51))
1017 if templ_7745c5c3_Err != nil {
1018 return templ_7745c5c3_Err
1019 }
1020 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 86, "<span class=\"plus\">+")
1021 if templ_7745c5c3_Err != nil {
1022 return templ_7745c5c3_Err
1023 }
1024 var templ_7745c5c3_Var52 string
1025 templ_7745c5c3_Var52, templ_7745c5c3_Err = templ.JoinStringErrs(itoa(f.Add))
1026 if templ_7745c5c3_Err != nil {
1027 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 175, Col: 119}
1028 }
1029 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var52))
1030 if templ_7745c5c3_Err != nil {
1031 return templ_7745c5c3_Err
1032 }
1033 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 87, "</span>")
1034 if templ_7745c5c3_Err != nil {
1035 return templ_7745c5c3_Err
1036 }
1037 var templ_7745c5c3_Var53 string
1038 templ_7745c5c3_Var53, templ_7745c5c3_Err = templ.JoinStringErrs(" ")
1039 if templ_7745c5c3_Err != nil {
1040 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 175, Col: 133}
1041 }
1042 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var53))
1043 if templ_7745c5c3_Err != nil {
1044 return templ_7745c5c3_Err
1045 }
1046 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 88, "<span class=\"minus\">-")
1047 if templ_7745c5c3_Err != nil {
1048 return templ_7745c5c3_Err
1049 }
1050 var templ_7745c5c3_Var54 string
1051 templ_7745c5c3_Var54, templ_7745c5c3_Err = templ.JoinStringErrs(itoa(f.Del))
1052 if templ_7745c5c3_Err != nil {
1053 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 175, Col: 169}
1054 }
1055 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var54))
1056 if templ_7745c5c3_Err != nil {
1057 return templ_7745c5c3_Err
1058 }
1059 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 89, "</span> ")
1060 if templ_7745c5c3_Err != nil {
1061 return templ_7745c5c3_Err
1062 }
1063 if f.Note != "" {
1064 var templ_7745c5c3_Var55 string
1065 templ_7745c5c3_Var55, templ_7745c5c3_Err = templ.JoinStringErrs(" ")
1066 if templ_7745c5c3_Err != nil {
1067 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 177, Col: 9}
1068 }
1069 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var55))
1070 if templ_7745c5c3_Err != nil {
1071 return templ_7745c5c3_Err
1072 }
1073 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 90, "<span class=\"note\">")
1074 if templ_7745c5c3_Err != nil {
1075 return templ_7745c5c3_Err
1076 }
1077 var templ_7745c5c3_Var56 string
1078 templ_7745c5c3_Var56, templ_7745c5c3_Err = templ.JoinStringErrs(f.Note)
1079 if templ_7745c5c3_Err != nil {
1080 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 177, Col: 38}
1081 }
1082 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var56))
1083 if templ_7745c5c3_Err != nil {
1084 return templ_7745c5c3_Err
1085 }
1086 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 91, "</span>")
1087 if templ_7745c5c3_Err != nil {
1088 return templ_7745c5c3_Err
1089 }
1090 }
1091 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 92, "</summary> ")
1092 if templ_7745c5c3_Err != nil {
1093 return templ_7745c5c3_Err
1094 }
1095 if len(f.Hunks) > 0 {
1096 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 93, "<div class=\"dscroll\">")
1097 if templ_7745c5c3_Err != nil {
1098 return templ_7745c5c3_Err
1099 }
1100 if p.ShowUnified {
1101 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 94, "<table class=\"dt uni\" aria-label=\"")
1102 if templ_7745c5c3_Err != nil {
1103 return templ_7745c5c3_Err
1104 }
1105 var templ_7745c5c3_Var57 string
1106 templ_7745c5c3_Var57, templ_7745c5c3_Err = templ.ResolveAttributeValue(f.Path + ", unified")
1107 if templ_7745c5c3_Err != nil {
1108 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 183, Col: 60}
1109 }
1110 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var57)
1111 if templ_7745c5c3_Err != nil {
1112 return templ_7745c5c3_Err
1113 }
1114 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 95, "\">")
1115 if templ_7745c5c3_Err != nil {
1116 return templ_7745c5c3_Err
1117 }
1118 for _, h := range f.Hunks {
1119 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 96, "<tbody><tr class=\"hunk\"><td colspan=\"4\">")
1120 if templ_7745c5c3_Err != nil {
1121 return templ_7745c5c3_Err
1122 }
1123 var templ_7745c5c3_Var58 string
1124 templ_7745c5c3_Var58, templ_7745c5c3_Err = templ.JoinStringErrs(h.Header)
1125 if templ_7745c5c3_Err != nil {
1126 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 186, Col: 51}
1127 }
1128 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var58))
1129 if templ_7745c5c3_Err != nil {
1130 return templ_7745c5c3_Err
1131 }
1132 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 97, "</td></tr>")
1133 if templ_7745c5c3_Err != nil {
1134 return templ_7745c5c3_Err
1135 }
1136 for _, ln := range h.Lines {
1137 var templ_7745c5c3_Var59 = []any{ln.Kind}
1138 templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var59...)
1139 if templ_7745c5c3_Err != nil {
1140 return templ_7745c5c3_Err
1141 }
1142 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 98, "<tr class=\"")
1143 if templ_7745c5c3_Err != nil {
1144 return templ_7745c5c3_Err
1145 }
1146 var templ_7745c5c3_Var60 string
1147 templ_7745c5c3_Var60, templ_7745c5c3_Err = templ.ResolveAttributeValue(templ.CSSClasses(templ_7745c5c3_Var59).String())
1148 if templ_7745c5c3_Err != nil {
1149 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 1, Col: 0}
1150 }
1151 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var60)
1152 if templ_7745c5c3_Err != nil {
1153 return templ_7745c5c3_Err
1154 }
1155 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 99, "\"><td class=\"ln\">")
1156 if templ_7745c5c3_Err != nil {
1157 return templ_7745c5c3_Err
1158 }
1159 templ_7745c5c3_Err = gutter(ln.Old, ln.OldHref).Render(ctx, templ_7745c5c3_Buffer)
1160 if templ_7745c5c3_Err != nil {
1161 return templ_7745c5c3_Err
1162 }
1163 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 100, "</td><td class=\"ln\">")
1164 if templ_7745c5c3_Err != nil {
1165 return templ_7745c5c3_Err
1166 }
1167 templ_7745c5c3_Err = gutter(ln.New, ln.NewHref).Render(ctx, templ_7745c5c3_Buffer)
1168 if templ_7745c5c3_Err != nil {
1169 return templ_7745c5c3_Err
1170 }
1171 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 101, "</td><td class=\"m\">")
1172 if templ_7745c5c3_Err != nil {
1173 return templ_7745c5c3_Err
1174 }
1175 var templ_7745c5c3_Var61 string
1176 templ_7745c5c3_Var61, templ_7745c5c3_Err = templ.JoinStringErrs(ln.Mark)
1177 if templ_7745c5c3_Err != nil {
1178 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 191, Col: 33}
1179 }
1180 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var61))
1181 if templ_7745c5c3_Err != nil {
1182 return templ_7745c5c3_Err
1183 }
1184 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 102, "</td><td class=\"tx\">")
1185 if templ_7745c5c3_Err != nil {
1186 return templ_7745c5c3_Err
1187 }
1188 templ_7745c5c3_Err = codeLine(ln).Render(ctx, templ_7745c5c3_Buffer)
1189 if templ_7745c5c3_Err != nil {
1190 return templ_7745c5c3_Err
1191 }
1192 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 103, "</td></tr>")
1193 if templ_7745c5c3_Err != nil {
1194 return templ_7745c5c3_Err
1195 }
1196 if len(ln.Notes) > 0 || ln.Form != nil {
1197 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 104, "<tr class=\"fnote\"><td colspan=\"3\"></td><td>")
1198 if templ_7745c5c3_Err != nil {
1199 return templ_7745c5c3_Err
1200 }
1201 templ_7745c5c3_Err = lineNotes(ln.Notes, ln.Form, "").Render(ctx, templ_7745c5c3_Buffer)
1202 if templ_7745c5c3_Err != nil {
1203 return templ_7745c5c3_Err
1204 }
1205 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 105, "</td></tr>")
1206 if templ_7745c5c3_Err != nil {
1207 return templ_7745c5c3_Err
1208 }
1209 }
1210 }
1211 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 106, "</tbody>")
1212 if templ_7745c5c3_Err != nil {
1213 return templ_7745c5c3_Err
1214 }
1215 }
1216 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 107, "</table>")
1217 if templ_7745c5c3_Err != nil {
1218 return templ_7745c5c3_Err
1219 }
1220 }
1221 if p.ShowSplit {
1222 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 108, "<table class=\"dt spl\" aria-label=\"")
1223 if templ_7745c5c3_Err != nil {
1224 return templ_7745c5c3_Err
1225 }
1226 var templ_7745c5c3_Var62 string
1227 templ_7745c5c3_Var62, templ_7745c5c3_Err = templ.ResolveAttributeValue(f.Path + ", split")
1228 if templ_7745c5c3_Err != nil {
1229 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 206, Col: 58}
1230 }
1231 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var62)
1232 if templ_7745c5c3_Err != nil {
1233 return templ_7745c5c3_Err
1234 }
1235 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 109, "\"><colgroup><col class=\"c-ln\"><col class=\"c-m\"><col><col class=\"c-ln\"><col class=\"c-m\"><col></colgroup> ")
1236 if templ_7745c5c3_Err != nil {
1237 return templ_7745c5c3_Err
1238 }
1239 for _, h := range f.Hunks {
1240 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 110, "<tbody><tr class=\"hunk\"><td colspan=\"6\">")
1241 if templ_7745c5c3_Err != nil {
1242 return templ_7745c5c3_Err
1243 }
1244 var templ_7745c5c3_Var63 string
1245 templ_7745c5c3_Var63, templ_7745c5c3_Err = templ.JoinStringErrs(h.Header)
1246 if templ_7745c5c3_Err != nil {
1247 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 210, Col: 51}
1248 }
1249 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var63))
1250 if templ_7745c5c3_Err != nil {
1251 return templ_7745c5c3_Err
1252 }
1253 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 111, "</td></tr>")
1254 if templ_7745c5c3_Err != nil {
1255 return templ_7745c5c3_Err
1256 }
1257 for _, row := range h.Split {
1258 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 112, "<tr>")
1259 if templ_7745c5c3_Err != nil {
1260 return templ_7745c5c3_Err
1261 }
1262 templ_7745c5c3_Err = splitSide(row.L, true).Render(ctx, templ_7745c5c3_Buffer)
1263 if templ_7745c5c3_Err != nil {
1264 return templ_7745c5c3_Err
1265 }
1266 templ_7745c5c3_Err = splitSide(row.R, false).Render(ctx, templ_7745c5c3_Buffer)
1267 if templ_7745c5c3_Err != nil {
1268 return templ_7745c5c3_Err
1269 }
1270 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 113, "</tr>")
1271 if templ_7745c5c3_Err != nil {
1272 return templ_7745c5c3_Err
1273 }
1274 if notes, form := row.Notes(), row.Form(); len(notes) > 0 || form != nil {
1275 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 114, "<tr class=\"fnote\"><td colspan=\"6\">")
1276 if templ_7745c5c3_Err != nil {
1277 return templ_7745c5c3_Err
1278 }
1279 templ_7745c5c3_Err = lineNotes(notes, form, "-s").Render(ctx, templ_7745c5c3_Buffer)
1280 if templ_7745c5c3_Err != nil {
1281 return templ_7745c5c3_Err
1282 }
1283 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 115, "</td></tr>")
1284 if templ_7745c5c3_Err != nil {
1285 return templ_7745c5c3_Err
1286 }
1287 }
1288 }
1289 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 116, "</tbody>")
1290 if templ_7745c5c3_Err != nil {
1291 return templ_7745c5c3_Err
1292 }
1293 }
1294 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 117, "</table>")
1295 if templ_7745c5c3_Err != nil {
1296 return templ_7745c5c3_Err
1297 }
1298 }
1299 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 118, "</div>")
1300 if templ_7745c5c3_Err != nil {
1301 return templ_7745c5c3_Err
1302 }
1303 } else {
1304 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 119, "<p class=\"note pad\">")
1305 if templ_7745c5c3_Err != nil {
1306 return templ_7745c5c3_Err
1307 }
1308 if f.Note != "" {
1309 var templ_7745c5c3_Var64 string
1310 templ_7745c5c3_Var64, templ_7745c5c3_Err = templ.JoinStringErrs(f.Note)
1311 if templ_7745c5c3_Err != nil {
1312 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 230, Col: 13}
1313 }
1314 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var64))
1315 if templ_7745c5c3_Err != nil {
1316 return templ_7745c5c3_Err
1317 }
1318 } else {
1319 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 120, "no textual change.")
1320 if templ_7745c5c3_Err != nil {
1321 return templ_7745c5c3_Err
1322 }
1323 }
1324 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 121, "</p>")
1325 if templ_7745c5c3_Err != nil {
1326 return templ_7745c5c3_Err
1327 }
1328 }
1329 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 122, "</details>")
1330 if templ_7745c5c3_Err != nil {
1331 return templ_7745c5c3_Err
1332 }
1333 return nil
1334 })
1335}
1336
1337// splitSide is one half of a row of the split view; a side without a line is
1338// an empty cell.
1339func splitSide(ln *DiffLine, old bool) templ.Component {
1340 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
1341 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
1342 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
1343 return templ_7745c5c3_CtxErr
1344 }
1345 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
1346 if !templ_7745c5c3_IsBuffer {
1347 defer func() {
1348 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
1349 if templ_7745c5c3_Err == nil {
1350 templ_7745c5c3_Err = templ_7745c5c3_BufErr
1351 }
1352 }()
1353 }
1354 ctx = templ.InitializeContext(ctx)
1355 templ_7745c5c3_Var65 := templ.GetChildren(ctx)
1356 if templ_7745c5c3_Var65 == nil {
1357 templ_7745c5c3_Var65 = templ.NopComponent
1358 }
1359 ctx = templ.ClearChildren(ctx)
1360 if ln == nil {
1361 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 123, "<td class=\"ln none\"></td><td class=\"m none\"></td><td class=\"tx none\"></td>")
1362 if templ_7745c5c3_Err != nil {
1363 return templ_7745c5c3_Err
1364 }
1365 } else {
1366 var templ_7745c5c3_Var66 = []any{"ln", ln.Kind}
1367 templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var66...)
1368 if templ_7745c5c3_Err != nil {
1369 return templ_7745c5c3_Err
1370 }
1371 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 124, "<td class=\"")
1372 if templ_7745c5c3_Err != nil {
1373 return templ_7745c5c3_Err
1374 }
1375 var templ_7745c5c3_Var67 string
1376 templ_7745c5c3_Var67, templ_7745c5c3_Err = templ.ResolveAttributeValue(templ.CSSClasses(templ_7745c5c3_Var66).String())
1377 if templ_7745c5c3_Err != nil {
1378 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 1, Col: 0}
1379 }
1380 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var67)
1381 if templ_7745c5c3_Err != nil {
1382 return templ_7745c5c3_Err
1383 }
1384 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 125, "\">")
1385 if templ_7745c5c3_Err != nil {
1386 return templ_7745c5c3_Err
1387 }
1388 if old {
1389 templ_7745c5c3_Err = gutter(ln.Old, ln.OldHref).Render(ctx, templ_7745c5c3_Buffer)
1390 if templ_7745c5c3_Err != nil {
1391 return templ_7745c5c3_Err
1392 }
1393 } else {
1394 templ_7745c5c3_Err = gutter(ln.New, ln.NewHref).Render(ctx, templ_7745c5c3_Buffer)
1395 if templ_7745c5c3_Err != nil {
1396 return templ_7745c5c3_Err
1397 }
1398 }
1399 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 126, "</td>")
1400 if templ_7745c5c3_Err != nil {
1401 return templ_7745c5c3_Err
1402 }
1403 var templ_7745c5c3_Var68 = []any{"m", ln.Kind}
1404 templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var68...)
1405 if templ_7745c5c3_Err != nil {
1406 return templ_7745c5c3_Err
1407 }
1408 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 127, "<td class=\"")
1409 if templ_7745c5c3_Err != nil {
1410 return templ_7745c5c3_Err
1411 }
1412 var templ_7745c5c3_Var69 string
1413 templ_7745c5c3_Var69, templ_7745c5c3_Err = templ.ResolveAttributeValue(templ.CSSClasses(templ_7745c5c3_Var68).String())
1414 if templ_7745c5c3_Err != nil {
1415 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 1, Col: 0}
1416 }
1417 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var69)
1418 if templ_7745c5c3_Err != nil {
1419 return templ_7745c5c3_Err
1420 }
1421 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 128, "\">")
1422 if templ_7745c5c3_Err != nil {
1423 return templ_7745c5c3_Err
1424 }
1425 var templ_7745c5c3_Var70 string
1426 templ_7745c5c3_Var70, templ_7745c5c3_Err = templ.JoinStringErrs(ln.Mark)
1427 if templ_7745c5c3_Err != nil {
1428 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 254, Col: 38}
1429 }
1430 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var70))
1431 if templ_7745c5c3_Err != nil {
1432 return templ_7745c5c3_Err
1433 }
1434 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 129, "</td>")
1435 if templ_7745c5c3_Err != nil {
1436 return templ_7745c5c3_Err
1437 }
1438 var templ_7745c5c3_Var71 = []any{"tx", ln.Kind}
1439 templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var71...)
1440 if templ_7745c5c3_Err != nil {
1441 return templ_7745c5c3_Err
1442 }
1443 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 130, "<td class=\"")
1444 if templ_7745c5c3_Err != nil {
1445 return templ_7745c5c3_Err
1446 }
1447 var templ_7745c5c3_Var72 string
1448 templ_7745c5c3_Var72, templ_7745c5c3_Err = templ.ResolveAttributeValue(templ.CSSClasses(templ_7745c5c3_Var71).String())
1449 if templ_7745c5c3_Err != nil {
1450 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 1, Col: 0}
1451 }
1452 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var72)
1453 if templ_7745c5c3_Err != nil {
1454 return templ_7745c5c3_Err
1455 }
1456 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 131, "\">")
1457 if templ_7745c5c3_Err != nil {
1458 return templ_7745c5c3_Err
1459 }
1460 templ_7745c5c3_Err = codeLine(*ln).Render(ctx, templ_7745c5c3_Buffer)
1461 if templ_7745c5c3_Err != nil {
1462 return templ_7745c5c3_Err
1463 }
1464 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 132, "</td>")
1465 if templ_7745c5c3_Err != nil {
1466 return templ_7745c5c3_Err
1467 }
1468 }
1469 return nil
1470 })
1471}
1472
1473// gutter is a line number of the gutter. On a merge request that can be
1474// commented on, it links to the form that comments on that line.
1475func gutter(n, href string) templ.Component {
1476 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
1477 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
1478 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
1479 return templ_7745c5c3_CtxErr
1480 }
1481 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
1482 if !templ_7745c5c3_IsBuffer {
1483 defer func() {
1484 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
1485 if templ_7745c5c3_Err == nil {
1486 templ_7745c5c3_Err = templ_7745c5c3_BufErr
1487 }
1488 }()
1489 }
1490 ctx = templ.InitializeContext(ctx)
1491 templ_7745c5c3_Var73 := templ.GetChildren(ctx)
1492 if templ_7745c5c3_Var73 == nil {
1493 templ_7745c5c3_Var73 = templ.NopComponent
1494 }
1495 ctx = templ.ClearChildren(ctx)
1496 if href != "" {
1497 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 133, "<a href=\"")
1498 if templ_7745c5c3_Err != nil {
1499 return templ_7745c5c3_Err
1500 }
1501 var templ_7745c5c3_Var74 templ.SafeURL
1502 templ_7745c5c3_Var74, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(href))
1503 if templ_7745c5c3_Err != nil {
1504 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 263, Col: 31}
1505 }
1506 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var74))
1507 if templ_7745c5c3_Err != nil {
1508 return templ_7745c5c3_Err
1509 }
1510 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 134, "\" title=\"comment on this line\">")
1511 if templ_7745c5c3_Err != nil {
1512 return templ_7745c5c3_Err
1513 }
1514 var templ_7745c5c3_Var75 string
1515 templ_7745c5c3_Var75, templ_7745c5c3_Err = templ.JoinStringErrs(n)
1516 if templ_7745c5c3_Err != nil {
1517 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 263, Col: 66}
1518 }
1519 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var75))
1520 if templ_7745c5c3_Err != nil {
1521 return templ_7745c5c3_Err
1522 }
1523 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 135, "</a>")
1524 if templ_7745c5c3_Err != nil {
1525 return templ_7745c5c3_Err
1526 }
1527 } else {
1528 var templ_7745c5c3_Var76 string
1529 templ_7745c5c3_Var76, templ_7745c5c3_Err = templ.JoinStringErrs(n)
1530 if templ_7745c5c3_Err != nil {
1531 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/diff.templ`, Line: 265, Col: 5}
1532 }
1533 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var76))
1534 if templ_7745c5c3_Err != nil {
1535 return templ_7745c5c3_Err
1536 }
1537 }
1538 return nil
1539 })
1540}
1541
1542var _ = templruntime.GeneratedTemplate