orchard
mirrorEvery site I host, in one repo, along with the Cloudflare Tunnel and Caddy that front them. It's all Go, Vite, and SQLite, and it runs on a desktop at home with nothing listening on an inbound port.
blogbuncaddycloudflare-tunneldockergogolanghomelabhtml-templatemonorepoself-hostedseosqlitestatic-sitetypstuptime-monitoringviteweb-analytics
1package main
2
3import "testing"
4
5func TestTidyCitations(t *testing.T) {
6 cases := []struct{ in, want string }{
7 {
8 "- Assemble by placing cheese [14] on the tortillas [14], adding bacon [14] and eggs [14] [14].",
9 "- Assemble by placing cheese on the tortillas, adding bacon and eggs [14].",
10 },
11 { // two different passages on one line are real evidence and stay put
12 "The bridge opened in 1937 [2] and carries six lanes [5].",
13 "The bridge opened in 1937 [2] and carries six lanes [5].",
14 },
15 { // one citation is already right
16 "Beat the eggs with a pinch of salt [3].",
17 "Beat the eggs with a pinch of salt [3].",
18 },
19 { // a repeat plus a distinct one keeps both, once each
20 "Cook the sausage [7] and season it [7], then rest it [9].",
21 "Cook the sausage and season it, then rest it [7][9].",
22 },
23 }
24 for _, c := range cases {
25 if got := tidyCitations(c.in); got != c.want {
26 t.Errorf("\n in %s\n got %s\n want %s", c.in, got, c.want)
27 }
28 }
29}