use templates.sprintf helper
This commit is contained in:
parent
4a9851c09c
commit
7e4defffd9
19
web.go
19
web.go
|
@ -19,7 +19,6 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"fmt"
|
"fmt"
|
||||||
"html"
|
|
||||||
"html/template"
|
"html/template"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
|
@ -195,12 +194,12 @@ func showrss(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if p := honk.Place; p != nil {
|
if p := honk.Place; p != nil {
|
||||||
desc += fmt.Sprintf(`<p>Location: <a href="%s">%s</a> %f %f`,
|
desc += string(templates.Sprintf(`<p>Location: <a href="%s">%s</a> %f %f`,
|
||||||
html.EscapeString(p.Url), html.EscapeString(p.Name), p.Latitude, p.Longitude)
|
p.Url, p.Name, p.Latitude, p.Longitude))
|
||||||
}
|
}
|
||||||
for _, d := range honk.Donks {
|
for _, d := range honk.Donks {
|
||||||
desc += fmt.Sprintf(`<p><a href="%s">Attachment: %s</a>`,
|
desc += string(templates.Sprintf(`<p><a href="%s">Attachment: %s</a>`,
|
||||||
d.URL, html.EscapeString(d.Name))
|
d.URL, d.Name))
|
||||||
}
|
}
|
||||||
|
|
||||||
feed.Items = append(feed.Items, &rss.Item{
|
feed.Items = append(feed.Items, &rss.Item{
|
||||||
|
@ -593,12 +592,11 @@ func showhonker(w http.ResponseWriter, r *http.Request) {
|
||||||
} else {
|
} else {
|
||||||
honks = gethonksbyhonker(u.UserID, name)
|
honks = gethonksbyhonker(u.UserID, name)
|
||||||
}
|
}
|
||||||
name = html.EscapeString(name)
|
msg := templates.Sprintf(`honks by honker: <a href="%s" ref="noreferrer">%s</a>`, name, name)
|
||||||
msg := fmt.Sprintf(`honks by honker: <a href="%s" ref="noreferrer">%s</a>`, name, name)
|
|
||||||
templinfo := getInfo(r)
|
templinfo := getInfo(r)
|
||||||
templinfo["PageName"] = "honker"
|
templinfo["PageName"] = "honker"
|
||||||
templinfo["PageArg"] = name
|
templinfo["PageArg"] = name
|
||||||
templinfo["ServerMessage"] = template.HTML(msg)
|
templinfo["ServerMessage"] = msg
|
||||||
templinfo["HonkCSRF"] = login.GetCSRF("honkhonk", r)
|
templinfo["HonkCSRF"] = login.GetCSRF("honkhonk", r)
|
||||||
honkpage(w, u, honks, templinfo)
|
honkpage(w, u, honks, templinfo)
|
||||||
}
|
}
|
||||||
|
@ -1667,9 +1665,8 @@ func webhydra(w http.ResponseWriter, r *http.Request) {
|
||||||
xid = gofish(xid)
|
xid = gofish(xid)
|
||||||
}
|
}
|
||||||
honks = gethonksbyxonker(userid, xid)
|
honks = gethonksbyxonker(userid, xid)
|
||||||
xid = html.EscapeString(xid)
|
msg := templates.Sprintf(`honks by honker: <a href="%s" ref="noreferrer">%s</a>`, xid, xid)
|
||||||
msg := fmt.Sprintf(`honks by honker: <a href="%s" ref="noreferrer">%s</a>`, xid, xid)
|
templinfo["ServerMessage"] = msg
|
||||||
templinfo["ServerMessage"] = template.HTML(msg)
|
|
||||||
default:
|
default:
|
||||||
http.NotFound(w, r)
|
http.NotFound(w, r)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue