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

better commit messages, fix html escaping in code

Changed files
+19 -2
appview
pages
templates
+6
appview/pages/pages.go
···
"length": func(v []string) int {
return len(v)
},
}
}
···
"length": func(v []string) int {
return len(v)
},
+
"splitN": func(s, sep string, n int) []string {
+
return strings.SplitN(s, sep, n)
+
},
+
"unescapeHtml": func(s string) template.HTML {
+
return template.HTML(s)
+
},
}
}
+1 -1
appview/pages/templates/repo/blob.html
···
{{ if .IsBinary }}<p class="text-center text-gray-400">This is a binary file and will not be displayed.</p>{{ else }}
<pre class="font-mono text-sm overflow-auto relative text-ellipsis"><code>{{ range $idx, $line := $lines }}<span class="flex">
<span class="{{ $code_number_style }}" style="min-width: {{$tot_chars}}ch;">{{ add $idx 1 }}</span>
-
<span class="whitespace-pre">{{ $line }}</span></span>{{ else }}<em class="text-gray-400">this file is empty</em>{{ end }}</code></pre>{{ end}}
{{ end }}
···
{{ if .IsBinary }}<p class="text-center text-gray-400">This is a binary file and will not be displayed.</p>{{ else }}
<pre class="font-mono text-sm overflow-auto relative text-ellipsis"><code>{{ range $idx, $line := $lines }}<span class="flex">
<span class="{{ $code_number_style }}" style="min-width: {{$tot_chars}}ch;">{{ add $idx 1 }}</span>
+
<span class="whitespace-pre">{{ unescapeHtml $line }}</span></span>{{ else }}<em class="text-gray-400">this file is empty</em>{{ end }}</code></pre>{{ end}}
{{ end }}
+12 -1
appview/pages/templates/repo/index.html
···
before:top-1/2
before:-translate-y-1/2
">
-
<div class="text-base">{{ .Message }}</div>
<div class="text-xs text-gray-500">
<span class="font-mono">
···
before:top-1/2
before:-translate-y-1/2
">
+
+
<div id="commit-message">
+
{{ $messageParts := splitN .Message "\n\n" 2 }}
+
<div class="text-base cursor-pointer">
+
{{ index $messageParts 0 }}
+
{{ if gt (len $messageParts) 1 }}
+
<div class="text-sm inline rounded-sm bg-gray-300 text-gray-700 px-1"
+
hx-on:click="this.nextElementSibling.classList.toggle('hidden')">...</div>
+
<div class="hidden mt-1 text-sm">{{ index $messageParts 1 }}</div>
+
{{ end }}
+
</div>
+
</div>
<div class="text-xs text-gray-500">
<span class="font-mono">