Monorepo for Tangled tangled.org

better commit messages, fix html escaping in code

Changed files
+19 -2
appview
pages
templates
+6
appview/pages/pages.go
··· 73 73 "length": func(v []string) int { 74 74 return len(v) 75 75 }, 76 + "splitN": func(s, sep string, n int) []string { 77 + return strings.SplitN(s, sep, n) 78 + }, 79 + "unescapeHtml": func(s string) template.HTML { 80 + return template.HTML(s) 81 + }, 76 82 } 77 83 } 78 84
+1 -1
appview/pages/templates/repo/blob.html
··· 18 18 {{ if .IsBinary }}<p class="text-center text-gray-400">This is a binary file and will not be displayed.</p>{{ else }} 19 19 <pre class="font-mono text-sm overflow-auto relative text-ellipsis"><code>{{ range $idx, $line := $lines }}<span class="flex"> 20 20 <span class="{{ $code_number_style }}" style="min-width: {{$tot_chars}}ch;">{{ add $idx 1 }}</span> 21 - <span class="whitespace-pre">{{ $line }}</span></span>{{ else }}<em class="text-gray-400">this file is empty</em>{{ end }}</code></pre>{{ end}} 21 + <span class="whitespace-pre">{{ unescapeHtml $line }}</span></span>{{ else }}<em class="text-gray-400">this file is empty</em>{{ end }}</code></pre>{{ end}} 22 22 {{ end }}
+12 -1
appview/pages/templates/repo/index.html
··· 51 51 before:top-1/2 52 52 before:-translate-y-1/2 53 53 "> 54 - <div class="text-base">{{ .Message }}</div> 54 + 55 + <div id="commit-message"> 56 + {{ $messageParts := splitN .Message "\n\n" 2 }} 57 + <div class="text-base cursor-pointer"> 58 + {{ index $messageParts 0 }} 59 + {{ if gt (len $messageParts) 1 }} 60 + <div class="text-sm inline rounded-sm bg-gray-300 text-gray-700 px-1" 61 + hx-on:click="this.nextElementSibling.classList.toggle('hidden')">...</div> 62 + <div class="hidden mt-1 text-sm">{{ index $messageParts 1 }}</div> 63 + {{ end }} 64 + </div> 65 + </div> 55 66 56 67 <div class="text-xs text-gray-500"> 57 68 <span class="font-mono">