From 93b265c2e15a437cd39d47c91c675c447db59958 Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Sun, 25 Jan 2015 23:28:05 -0500 Subject: [PATCH] Graphical host names, e.g. tilde -> ~ --- code.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/code.go b/code.go index b6be92f..c565deb 100644 --- a/code.go +++ b/code.go @@ -60,6 +60,11 @@ type Page struct { UpdatedForHumans string } +func graphicalName(n string) string { + r := strings.NewReplacer("tilde", "~", "ctrl-c", "^C", "nuclear", "☢") + return r.Replace(n) +} + func generate(users map[string]User) { fmt.Println("Generating page.") @@ -83,7 +88,7 @@ func generate(users map[string]User) { updated := curTime.Format(time.RFC3339) // Generate the page - page := &Page{Host: host, UpdatedForHumans: updatedReadable, Updated: updated, Users: users} + page := &Page{Host: graphicalName(host), UpdatedForHumans: updatedReadable, Updated: updated, Users: users} template.ExecuteTemplate(w, "code", page) w.Flush()