remove mailto links from title

This commit is contained in:
Ryan Stafford 2023-07-28 13:04:41 -04:00
parent c5a53c79da
commit f5a423f2d5

View file

@ -152,7 +152,7 @@ var funcMap = template.FuncMap{
return body return body
} }
text := html2text.HTML2TextWithOptions(buf.String(), html2text.WithLinksInnerText()) text := html2text.HTML2TextWithOptions(buf.String(), html2text.WithLinksInnerText())
re := regexp.MustCompile(`\<https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)\>`) re := regexp.MustCompile(`\<(https?:\/\/|mailto)(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)\>`)
return re.ReplaceAllString(text, "") return re.ReplaceAllString(text, "")
}, },
"contains": strings.Contains, "contains": strings.Contains,