all repos — honk @ adc018a21387b12f9b488144825369a1119e3df1

my fork of honk

microoptimization to avoid the more expensive regex
Ted Unangst tedu@tedunangst.com
Sat, 25 Jan 2020 19:11:58 -0500
commit

adc018a21387b12f9b488144825369a1119e3df1

parent

90a8d123fa2c93691ce37555e566656de998d8db

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

jump to
M markitzero.gomarkitzero.go

@@ -75,10 +75,14 @@ }

s = string(buf) // mark it zero - s = re_link.ReplaceAllStringFunc(s, linkreplacer) + if strings.Contains(s, "http") { + s = re_link.ReplaceAllStringFunc(s, linkreplacer) + } s = re_zerolink.ReplaceAllString(s, `<a href="$2">$1</a>`) - s = re_bolder.ReplaceAllString(s, "$1<b>$2</b>$3") - s = re_italicer.ReplaceAllString(s, "$1<i>$2</i>$3") + if strings.Contains(s, "*") { + s = re_bolder.ReplaceAllString(s, "$1<b>$2</b>$3") + s = re_italicer.ReplaceAllString(s, "$1<i>$2</i>$3") + } s = re_quoter.ReplaceAllString(s, "<blockquote>$1<br><cite>$3</cite></blockquote><p>") s = re_reciter.ReplaceAllString(s, "$1$2$3") s = strings.Replace(s, "\n---\n", "<hr><p>", -1)