handle unicode hashtags better
This commit is contained in:
parent
ca30929bfe
commit
f8fc2c6ef7
|
@ -2,11 +2,12 @@
|
||||||
<main>
|
<main>
|
||||||
<div class="info">
|
<div class="info">
|
||||||
<p>ontologies of interest
|
<p>ontologies of interest
|
||||||
|
{{ $firstrune := .FirstRune }}
|
||||||
{{ $letter := 0 }}
|
{{ $letter := 0 }}
|
||||||
<ul>
|
<ul>
|
||||||
{{ range .Onts }}
|
{{ range .Onts }}
|
||||||
{{ if not (eq $letter (index .Name 0)) }}
|
{{ if not (eq $letter (call $firstrune .Name)) }}
|
||||||
{{ $letter = (index .Name 0) }}
|
{{ $letter = (call $firstrune .Name) }}
|
||||||
<li><p>
|
<li><p>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<span style="white-space: nowrap;"><a href="/o/{{ .Name }}">#{{ .Name }}</a> ({{ .Count }})</span>
|
<span style="white-space: nowrap;"><a href="/o/{{ .Name }}">#{{ .Name }}</a> ({{ .Count }})</span>
|
||||||
|
|
4
web.go
4
web.go
|
@ -32,6 +32,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
"unicode/utf8"
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
"humungus.tedunangst.com/r/webs/cache"
|
"humungus.tedunangst.com/r/webs/cache"
|
||||||
|
@ -855,7 +856,7 @@ func thelistingoftheontologies(w http.ResponseWriter, r *http.Request) {
|
||||||
elog.Printf("error scanning ont: %s", err)
|
elog.Printf("error scanning ont: %s", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if len(o.Name) > 24 {
|
if utf8.RuneCountInString(o.Name) > 24 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
o.Name = o.Name[1:]
|
o.Name = o.Name[1:]
|
||||||
|
@ -869,6 +870,7 @@ func thelistingoftheontologies(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
templinfo := getInfo(r)
|
templinfo := getInfo(r)
|
||||||
templinfo["Onts"] = onts
|
templinfo["Onts"] = onts
|
||||||
|
templinfo["FirstRune"] = func(s string) rune { r, _ := utf8.DecodeRuneInString(s); return r }
|
||||||
err = readviews.Execute(w, "onts.html", templinfo)
|
err = readviews.Execute(w, "onts.html", templinfo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
elog.Print(err)
|
elog.Print(err)
|
||||||
|
|
Loading…
Reference in New Issue