commit.html

 1{{define "content"}}
 2<nav aria-label="breadcrumb">
 3  <ul>
 4    <li><a href="/{{.Repo.Name}}">{{.Repo.Name}}</a></li>
 5    <li aria-current="page">{{.Commit.ID | shortHash}}</li>
 6  </ul>
 7</nav>
 8
 9<header>
10  <hgroup>
11    <h2 id="commit-heading">{{.Commit.Message | commitSubject}}</h2>
12    <p>
13      {{ $names := .Commit | attributionNames }}
14      {{ $nlen := len $names }}
15      {{ range $i, $n := $names }}
16        {{ if gt $i 0 }}
17          {{ if eq $nlen 2 }} and {{ else if eq $i (sub $nlen 1) }}, and {{ else }}, {{ end }}
18        {{ end }}
19        <strong>{{$n}}</strong>
20      {{ end }}
21      created <time datetime="{{.Commit.Author.When | rfc3339}}" data-tooltip="{{.Commit.Author.When | formatDate}}">{{.Commit.Author.When | relativeTime}}</time>
22    </p>
23  </hgroup>
24  {{$body := .Commit.Message | commitBody}}
25  {{if $body}}
26  <pre><code>{{$body}}</code></pre>
27  {{end}}
28  
29  <nav aria-label="Commit actions">
30    <ul>
31      <li><a href="/{{.Repo.Name}}/tree/{{.Commit.ID}}">Browse file tree</a></li>
32    </ul>
33  </nav>
34</header>
35
36<section aria-labelledby="changes-heading">
37  <h3 id="changes-heading">Change summary</h3>
38  <pre aria-label="Diff statistics"><code>{{.Diff.Stats}}</code></pre>
39</section>
40
41<section aria-labelledby="diff-heading">
42  <h3 id="diff-heading">Detailed changes</h3>
43  {{range .Diff.Files}}
44  <article aria-labelledby="file-{{.Name}}">
45    <h4 id="file-{{.Name}}">
46      {{if ne .OldName .Name}}
47        {{.OldName}} → <a href="/{{$.Repo.Name}}/blob/{{$.Commit.ID}}/{{.Name}}">{{.Name}}</a>
48      {{else}}
49        <a href="/{{$.Repo.Name}}/blob/{{$.Commit.ID}}/{{.Name}}">{{.Name}}</a>
50      {{end}}
51      <small><a href="#file-{{.Name}}" class="secondary" title="Link to heading for {{.Name}}">🔗</a></small>
52    </h4>
53    <pre aria-label="Diff for {{.Name}}"><code>{{range .Sections}}{{range .Lines}}{{if eq .Type 2}}<ins>{{.Content}}</ins>{{else if eq .Type 3}}<del>{{.Content}}</del>{{else}}{{.Content}}{{end}}
54{{end}}{{end}}</code></pre>
55  </article>
56  {{end}}
57</section>
58{{end}}