all repos — honk @ 42e9160678eabe629c2bb8f595d600e6d8548970

my fork of honk

combine a common fmt string
Ted Unangst tedu@tedunangst.com
Wed, 22 Apr 2020 18:31:33 -0400
commit

42e9160678eabe629c2bb8f595d600e6d8548970

parent

53169acbcf15679677521b98867005f99a4c2f83

1 files changed, 3 insertions(+), 4 deletions(-)

jump to
M fun.gofun.go

@@ -454,18 +454,17 @@ return ""

} func mentionize(s string) string { + fill := `<span class="h-card"><a class="u-url mention" href="%s">%s</a></span>` s = re_mentions.ReplaceAllStringFunc(s, func(m string) string { where := gofish(m) if where == "" { return m } who := m[0 : 1+strings.IndexByte(m[1:], '@')] - return fmt.Sprintf(`<span class="h-card"><a class="u-url mention" href="%s">%s</a></span>`, - html.EscapeString(where), html.EscapeString(who)) + return fmt.Sprintf(fill, html.EscapeString(where), html.EscapeString(who)) }) s = re_urltions.ReplaceAllStringFunc(s, func(m string) string { - return fmt.Sprintf(`<span class="h-card"><a class="u-url mention" href="%s">%s</a></span>`, - html.EscapeString(m[1:]), html.EscapeString(m)) + return fmt.Sprintf(fill, html.EscapeString(m[1:]), html.EscapeString(m)) }) return s }