forked from tangled.org/core
this repo has no description

appview: fix line number alignment

Changed files
+15 -15
appview
pages
templates
repo
+15 -15
appview/pages/templates/repo/blob.html
···
{{ $lines := split .Contents }}
{{ $tot_lines := len $lines }}
{{ $tot_chars := len (printf "%d" $tot_lines) }}
-
{{ $code_number_style := "text-gray-400 left-0 bg-white text-right mr-6 select-none" }}
+
{{ $code_number_style := "text-gray-400 left-0 bg-white text-right mr-6 select-none inline-block w-12" }}
{{ $linkstyle := "no-underline hover:underline" }}
<div class="pb-2 text-base">
<div class="flex justify-between">
···
This is a binary file and will not be displayed.
</p>
{{ else }}
-
<div class="overflow-auto relative text-ellipsis">
-
{{ range $idx, $line := $lines }}
-
{{ $linenr := add $idx 1 }}
-
<div class="flex">
-
<a href="#L{{ $linenr }}" id="L{{ $linenr }}" class="no-underline peer">
-
<span class="{{ $code_number_style }}"
-
style="min-width: {{ $tot_chars }}ch;" >
-
{{ $linenr }}
-
</span>
-
</a>
-
<div class="whitespace-pre peer-target:bg-yellow-200">{{ $line | escapeHtml }}</div>
-
</div>
-
{{ end }}
-
</div>
+
<div class="overflow-auto relative text-ellipsis">
+
{{ range $idx, $line := $lines }}
+
{{ $linenr := add $idx 1 }}
+
<div class="flex">
+
<a href="#L{{ $linenr }}" id="L{{ $linenr }}" class="no-underline peer">
+
<span class="{{ $code_number_style }}"
+
style="min-width: {{ $tot_chars }}ch;">
+
{{ $linenr }}
+
</span>
+
</a>
+
<div class="whitespace-pre peer-target:bg-yellow-200">{{ $line | escapeHtml }}</div>
+
</div>
+
{{ end }}
+
</div>
{{ end }}
{{ end }}