all repos — honk @ a6e299aa8342c31214f2d1ab3b71a22854ba1c53

my fork of honk

handle unicode hashtags better
Ted Unangst tedu@tedunangst.com
Fri, 20 May 2022 12:30:01 -0400
commit

a6e299aa8342c31214f2d1ab3b71a22854ba1c53

parent

65f175d7add19e465731ca834796695ecbd9b65d

2 files changed, 6 insertions(+), 3 deletions(-)

jump to
M views/onts.htmlviews/onts.html

@@ -2,11 +2,12 @@ {{ template "header.html" . }}

<main> <div class="info"> <p>ontologies of interest +{{ $firstrune := .FirstRune }} {{ $letter := 0 }} <ul> {{ range .Onts }} -{{ if not (eq $letter (index .Name 0)) }} -{{ $letter = (index .Name 0) }} +{{ if not (eq $letter (call $firstrune .Name)) }} +{{ $letter = (call $firstrune .Name) }} <li><p> {{ end }} <span style="white-space: nowrap;"><a href="/o/{{ .Name }}">#{{ .Name }}</a> ({{ .Count }})</span>
M web.goweb.go

@@ -32,6 +32,7 @@ "strconv"

"strings" "syscall" "time" + "unicode/utf8" "github.com/gorilla/mux" "humungus.tedunangst.com/r/webs/cache"

@@ -855,7 +856,7 @@ if err != nil {

elog.Printf("error scanning ont: %s", err) continue } - if len(o.Name) > 24 { + if utf8.RuneCountInString(o.Name) > 24 { continue } o.Name = o.Name[1:]

@@ -869,6 +870,7 @@ w.Header().Set("Cache-Control", "max-age=300")

} templinfo := getInfo(r) templinfo["Onts"] = onts + templinfo["FirstRune"] = func(s string) rune { r, _ := utf8.DecodeRuneInString(s); return r } err = readviews.Execute(w, "onts.html", templinfo) if err != nil { elog.Print(err)