try more aggresive bold matching and hope it doesn't break

This commit is contained in:
Ted Unangst 2019-10-25 00:27:00 -04:00
parent c7ffa6ddda
commit b69665f6a5
2 changed files with 8 additions and 3 deletions

View File

@ -24,8 +24,8 @@ import (
"humungus.tedunangst.com/r/webs/synlight" "humungus.tedunangst.com/r/webs/synlight"
) )
var re_bolder = regexp.MustCompile(`(^|\W)\*\*([\w\s,.!?':_-]+)\*\*($|\W)`) var re_bolder = regexp.MustCompile(`(^|\W)\*\*((?s:.*?))\*\*($|\W)`)
var re_italicer = regexp.MustCompile(`(^|\W)\*([\w\s,.!?':_-]+)\*($|\W)`) var re_italicer = regexp.MustCompile(`(^|\W)\*((?s:.*?))\*($|\W)`)
var re_bigcoder = regexp.MustCompile("```(.*)\n?((?s:.*?))\n?```\n?") var re_bigcoder = regexp.MustCompile("```(.*)\n?((?s:.*?))\n?```\n?")
var re_coder = regexp.MustCompile("`([^`]*)`") var re_coder = regexp.MustCompile("`([^`]*)`")
var re_quoter = regexp.MustCompile(`(?m:^> (.*)\n?)`) var re_quoter = regexp.MustCompile(`(?m:^> (.*)\n?)`)

View File

@ -17,6 +17,12 @@ func TestBasictest(t *testing.T) {
doonezerotest(t, input, output) doonezerotest(t, input, output)
} }
func TestMultibold(t *testing.T) {
input := `**in** out **in**`
output := `<b>in</b> out <b>in</b>`
doonezerotest(t, input, output)
}
func TestLinebreak1(t *testing.T) { func TestLinebreak1(t *testing.T) {
input := "hello\n> a quote\na comment" input := "hello\n> a quote\na comment"
output := "hello<blockquote>a quote</blockquote><p>a comment" output := "hello<blockquote>a quote</blockquote><p>a comment"
@ -72,7 +78,6 @@ func TestLinkinQuote(t *testing.T) {
} }
func TestBoldLink(t *testing.T) { func TestBoldLink(t *testing.T) {
t.SkipNow()
input := `**b https://example.com/link b**` input := `**b https://example.com/link b**`
output := `<b>b <a class="mention u-url" href="https://example.com/link">https://example.com/link</a> b</b>` output := `<b>b <a class="mention u-url" href="https://example.com/link">https://example.com/link</a> b</b>`
doonezerotest(t, input, output) doonezerotest(t, input, output)