jump links for tags
Ted Unangst tedu@tedunangst.com
Sat, 02 Mar 2024 20:20:14 -0500
2 files changed,
11 insertions(+),
1 deletions(-)
M
views/onts.html
→
views/onts.html
@@ -2,6 +2,7 @@ {{ template "header.html" . }}
<main> <div class="info"> <p>ontologies of interest +<p>{{ range .Letters }}<a href="#{{.}}">{{.}}</a> {{ end }} {{ $firstrune := .FirstRune }} <ul> <li><p>@@ -12,7 +13,7 @@ {{ $letter := 0 }}
{{ range .Onts }} {{ if not (eq $letter (call $firstrune .Name)) }} {{ $letter = (call $firstrune .Name) }} -<li><p> +<li><p><a name="{{ printf "%c" $letter}}"></a> {{ end }} <span class="wsnowrap"><a href="/o/{{ .Name }}">#{{ .Name }}</a> ({{ .Count }})</span> {{ end }}
M
web.go
→
web.go
@@ -989,12 +989,21 @@ })
if len(pops) > 40 { pops = pops[:40] } + var letters []string + var lastrune rune = -1 + for _, o := range onts { + if r := firstRune(o.Name); r != lastrune { + letters = append(letters, string(r)) + lastrune = r + } + } if u == nil && !develMode { w.Header().Set("Cache-Control", "max-age=300") } templinfo := getInfo(r) templinfo["Pops"] = pops templinfo["Onts"] = onts + templinfo["Letters"] = letters templinfo["FirstRune"] = firstRune err = readviews.Execute(w, "onts.html", templinfo) if err != nil {