{{template "base/head" .}}
<div role="main" aria-label="{{.Title}}" class="page-content repository wiki">
	{{template "repo/header" .}}
	<div class="ui container">
		<div class="repo-button-row tw-flex tw-items-center tw-gap-2 tw-mb-4">
			<div class="tw-flex-1">
				<a href="{{.RepoLink}}/wiki/{{.PageURL}}">{{svg "octicon-arrow-left" 14}} {{.title}}</a>
				&middot;
				<a href="{{.RepoLink}}/wiki/{{.PageURL}}?action=_revision">Revision history</a>
			</div>
		</div>

		<div class="ui segment">
			<h3>{{svg "octicon-diff" 20}} Changes in <code>{{.CommitID}}</code></h3>
			<p>
				<strong>{{.CommitAuthor}}</strong> &mdash; {{.CommitMessage}}
				<br>
				<small class="text grey">{{DateUtils.TimeSince .CommitWhen}}</small>
			</p>

			{{if .IsNewPage}}
				<div class="ui info message">New page created</div>
			{{else if .IsDeletedPage}}
				<div class="ui warning message">Page deleted</div>
			{{else if not .HasDiff}}
				<div class="ui info message">No content changes in this revision</div>
			{{end}}

			{{if .HasDiff}}
			<div class="diff-file-box" style="overflow-x: auto;">
				<table class="chroma" style="width: 100%; border-collapse: collapse; font-family: monospace; font-size: 13px;">
					{{range .DiffLines}}
					<tr class="{{if eq .Type "add"}}diff-line-add{{else if eq .Type "del"}}diff-line-del{{else}}diff-line-context{{end}}">
						<td style="width: 40px; text-align: right; padding: 0 8px; color: #999; user-select: none; {{if eq .Type "add"}}background: #e6ffec;{{else if eq .Type "del"}}background: #ffebe9;{{else}}background: #f6f8fa;{{end}}">
							{{if .OldNum}}{{.OldNum}}{{end}}
						</td>
						<td style="width: 40px; text-align: right; padding: 0 8px; color: #999; user-select: none; {{if eq .Type "add"}}background: #e6ffec;{{else if eq .Type "del"}}background: #ffebe9;{{else}}background: #f6f8fa;{{end}}">
							{{if .NewNum}}{{.NewNum}}{{end}}
						</td>
						<td style="padding: 0 8px; white-space: pre-wrap; word-break: break-all; {{if eq .Type "add"}}background: #e6ffec;{{else if eq .Type "del"}}background: #ffebe9;{{else}}background: #fff;{{end}}">
							{{if eq .Type "add"}}+{{else if eq .Type "del"}}-{{else}} {{end}} {{.Content}}
						</td>
					</tr>
					{{end}}
				</table>
			</div>
			{{end}}
		</div>
	</div>
</div>
{{template "base/footer" .}}
