all repos — honk @ 7dbb69fba17ec1685cb05e1372abcbeb9d06309a

my fork of honk

now with **bold** and *italics*
Ted Unangst tedu@tedunangst.com
Tue, 23 Apr 2019 16:24:48 -0400
commit

7dbb69fba17ec1685cb05e1372abcbeb9d06309a

parent

7982b4d31637478d39d5398e66c2a87cb17f2580

1 files changed, 12 insertions(+), 0 deletions(-)

jump to
M fun.gofun.go

@@ -149,10 +149,20 @@ }

return emus } +var re_bolder = regexp.MustCompile(`(^|\W)\*\*([\w\s,.!?']+)\*\*($|\W)`) +var re_italicer = regexp.MustCompile(`(^|\W)\*([\w\s,.!?']+)\*($|\W)`) +func markitzero(s string) string { + s = re_bolder.ReplaceAllString(s, "$1<b>$2</b>$3") + s = re_italicer.ReplaceAllString(s, "$1<i>$2</i>$3") + return s +} + func obfusbreak(s string) string { s = strings.TrimSpace(s) s = strings.Replace(s, "\r", "", -1) s = html.EscapeString(s) + // dammit go + s = strings.Replace(s, "&#39;", "'", -1) linkfn := func(url string) string { if url[0] == '@' { return url

@@ -177,6 +187,8 @@ }

return url } s = re_link.ReplaceAllStringFunc(s, linkfn) + + s = markitzero(s) s = strings.Replace(s, "\n", "<br>", -1) return s