translate chat to html

master
Ted Unangst 4 years ago
parent 3b792bbcea
commit b7ec6b50d8

@ -1287,7 +1287,7 @@ func sendchonk(user *WhatAbout, ch *Chonk) {
jo["published"] = dt
jo["attributedTo"] = user.URL
jo["to"] = aud
jo["content"] = ch.Noise
jo["content"] = ch.HTML
j := junk.New()
j["@context"] = itiswhatitis

@ -182,7 +182,11 @@ func filterchonk(ch *Chonk) {
var htf htfilter.Filter
htf.SpanClasses = allowedclasses
htf.BaseURL, _ = url.Parse(ch.XID)
ch.HTML, _ = htf.String(ch.Noise)
noise := ch.Noise
if ch.Format == "markdown" {
noise = markitzero(noise)
}
ch.HTML, _ = htf.String(noise)
n := string(ch.HTML)
if strings.HasPrefix(n, "<p>") {
ch.HTML = template.HTML(n[3:])

@ -1814,6 +1814,7 @@ func submitchonk(w http.ResponseWriter, r *http.Request) {
Noise: noise,
Format: format,
}
filterchonk(&ch)
savechonk(&ch)
go sendchonk(user, &ch)

Loading…
Cancel
Save