From 084a0a94b00e140327868bd67e0e14f3c745e4de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Eric=20Janouch?=
Date: Tue, 18 Aug 2020 06:35:11 +0200 Subject: [PATCH] hswg: avoid self-referential links --- hswg/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hswg/main.go b/hswg/main.go index cb7f053..74cbad7 100644 --- a/hswg/main.go +++ b/hswg/main.go @@ -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))) }