all repos — honk @ cf308cb62a501e99906693c55137ba31ab9a3197

my fork of honk

auto fixup twitter citations
Ted Unangst tedu@tedunangst.com
Sun, 24 Nov 2019 22:54:55 -0500
commit

cf308cb62a501e99906693c55137ba31ab9a3197

parent

a84000a2b15d7d578b5ba64b162408beb738bd06

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

jump to
M markitzero.gomarkitzero.go

@@ -28,7 +28,8 @@ var re_bolder = regexp.MustCompile(`(^|\W)\*\*((?s:.*?))\*\*($|\W)`)

var re_italicer = regexp.MustCompile(`(^|\W)\*((?s:.*?))\*($|\W)`) var re_bigcoder = regexp.MustCompile("```(.*)\n?((?s:.*?))\n?```\n?") var re_coder = regexp.MustCompile("`([^`]*)`") -var re_quoter = regexp.MustCompile(`(?m:^&gt; (.*)(\n-(.*))?\n?)`) +var re_quoter = regexp.MustCompile(`(?m:^&gt; (.*)(\n- ?(.*))?\n?)`) +var re_reciter = regexp.MustCompile(`(<cite><a href=".*?">)https://twitter.com/([^/]+)/.*?(</a></cite>)`) var re_link = regexp.MustCompile(`.?.?https?://[^\s"]+[\w/)!]`) var re_zerolink = regexp.MustCompile(`\[([^]]*)\]\(([^)]*\)?)\)`) var re_imgfix = regexp.MustCompile(`<img ([^>]*)>`)

@@ -78,6 +79,7 @@ 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") 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) s = re_lister.ReplaceAllStringFunc(s, func(m string) string {