hswg: avoid self-referential links

This commit is contained in:
Přemysl Eric Janouch 2020-08-18 06:35:11 +02:00
parent 91b1120c4a
commit 084a0a94b0
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 1 additions and 1 deletions

View File

@ -134,7 +134,7 @@ var linkWordRE = regexp.MustCompile(`\b\p{Lu}\p{L}*\b`)
func expand(m *map[string]*entry, name string, chunk []byte) []byte {
return linkWordRE.ReplaceAllFunc(chunk, func(match []byte) []byte {
if link, ok := (*m)[string(match)]; ok {
if link, ok := (*m)[string(match)]; ok && string(match) != name {
link.backlinks = append(link.backlinks, name)
return []byte(makeLink(m, string(match)))
}