mirror of
https://github.com/rystaf/mlmym.git
synced 2024-11-05 06:43:21 +00:00
fix community bangs. fixes #44
This commit is contained in:
parent
dd4f76a393
commit
1858f1aec0
|
@ -134,7 +134,7 @@ var funcMap = template.FuncMap{
|
||||||
re := regexp.MustCompile(`\s---\s`)
|
re := regexp.MustCompile(`\s---\s`)
|
||||||
body = re.ReplaceAllString(body, "\n***\n")
|
body = re.ReplaceAllString(body, "\n***\n")
|
||||||
// community bangs
|
// community bangs
|
||||||
body = RegReplace(body, `!([a-zA-Z0-9_]+)@([a-zA-Z0-9\.\-]+)`, `[!$1@$2](/c/$1@$2)`)
|
body = RegReplace(body, `([^\[])!([a-zA-Z0-9_]+)@([a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)+)`, `$1[!$2@$3](/c/$2@$3)`)
|
||||||
if err := md.Convert([]byte(body), &buf); err != nil {
|
if err := md.Convert([]byte(body), &buf); err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
return template.HTML(body)
|
return template.HTML(body)
|
||||||
|
|
Loading…
Reference in a new issue