mirror of
https://gitea.com/gitea/gitea-mirror.git
synced 2026-04-23 21:52:13 +00:00
Follow-up to #37078. - Use Unicode Control Pictures](U+2400-U+2421) to render C0 control characters - Make it work in diff view too - Replace escape warning emoji with SVG - Align escape warning button with code lines --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
23 lines
1.0 KiB
Handlebars
23 lines
1.0 KiB
Handlebars
<div class="code-preview-container file-content">
|
|
<div class="code-preview-header">
|
|
<a href="{{.FullURL}}" class="tw-font-semibold" rel="nofollow">{{.RepoName}}/{{.FilePath}}</a>
|
|
{{$link := HTMLFormat `<a href="%s/commit/%s" class="muted tw-font-mono tw-text-text" rel="nofollow">%s</a>` .RepoLink .CommitID (.CommitID | ShortSha) -}}
|
|
{{- if eq .LineStart .LineStop -}}
|
|
{{ctx.Locale.Tr "repo.code_preview_line_in" .LineStart $link}}
|
|
{{- else -}}
|
|
{{ctx.Locale.Tr "repo.code_preview_line_from_to" .LineStart .LineStop $link}}
|
|
{{- end}}
|
|
</div>
|
|
<table class="file-view">
|
|
<tbody>
|
|
{{- range $idx, $line := .HighlightLines -}}
|
|
<tr>
|
|
<td class="lines-num"><span data-line-number="{{$line.Num}}"></span></td>
|
|
{{- ctx.RenderUtils.RenderUnicodeEscapeToggleTd $.EscapeStatus (index $.LineEscapeStatus $idx)}}
|
|
<td class="lines-code chroma"><div class="code-inner">{{$line.FormattedContent}}</div></td>{{/* only div works, span generates incorrect HTML structure */}}
|
|
</tr>
|
|
{{- end -}}
|
|
</tbody>
|
|
</table>
|
|
</div>
|