consistently process precis as html.

only do the markdown conversion once and early.
This commit is contained in:
Ted Unangst 2023-02-23 18:19:37 -05:00
parent ed13b68989
commit 65face4f35
3 changed files with 12 additions and 5 deletions

View File

@ -1290,7 +1290,7 @@ func jonkjonk(user *WhatAbout, h *Honk) (junk.Junk, junk.Junk) {
if len(atts) > 0 {
jo["attachment"] = atts
}
jo["summary"] = html.EscapeString(h.Precis)
jo["summary"] = h.Precis
jo["content"] = h.Noise
j["object"] = jo
case "bonk":

13
fun.go
View File

@ -289,10 +289,7 @@ func imaginate(honk *Honk) {
var re_dangerous = regexp.MustCompile("^[a-zA-Z]{2}:")
func translate(honk *Honk) {
if honk.Format == "html" {
return
}
func precipitate(honk *Honk) {
noise := honk.Noise
if re_dangerous.MatchString(noise) {
idx := strings.Index(noise, "\n")
@ -305,6 +302,14 @@ func translate(honk *Honk) {
}
}
honk.Precis = markitzero(strings.TrimSpace(honk.Precis))
honk.Noise = noise
}
func translate(honk *Honk) {
if honk.Format == "html" {
return
}
noise := honk.Noise
var marker mz.Marker
marker.HashLinker = ontoreplacer

2
web.go
View File

@ -1620,6 +1620,8 @@ func submithonk(w http.ResponseWriter, r *http.Request) *Honk {
noise = quickrename(noise, userinfo.UserID)
noise = hooterize(noise)
honk.Noise = noise
precipitate(honk)
noise = honk.Noise
translate(honk)
var convoy string