aboutsummaryrefslogtreecommitdiff
path: root/hswg/main.go
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2020-08-18 06:35:11 +0200
committerPřemysl Eric Janouch <p@janouch.name>2020-08-18 06:35:32 +0200
commit084a0a94b00e140327868bd67e0e14f3c745e4de (patch)
tree9f76b111061325c81be86e4c197c89bdffaed8f7 /hswg/main.go
parent91b1120c4a4a50cd3a561711583468657a192ffb (diff)
downloadhaven-084a0a94b00e140327868bd67e0e14f3c745e4de.tar.gz
haven-084a0a94b00e140327868bd67e0e14f3c745e4de.tar.xz
haven-084a0a94b00e140327868bd67e0e14f3c745e4de.zip
hswg: avoid self-referential links
Diffstat (limited to 'hswg/main.go')
-rw-r--r--hswg/main.go2
1 files changed, 1 insertions, 1 deletions
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)))
}