1
0
mirror of https://github.com/thebaer/tildes.git synced 2018-07-20 07:15:21 +00:00

Graphical host names, e.g. tilde -> ~

This commit is contained in:
Matt Baer 2015-01-25 23:28:05 -05:00
parent 9817f4053d
commit 93b265c2e1

View File

@ -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()