Show keyword before value in links

This commit is contained in:
Peter Stuifzand 2021-08-08 23:44:02 +02:00
parent d50857c528
commit 86ea8ceaf9

14
util.go
View File

@ -82,6 +82,13 @@ func ParseLinks(blockId string, content string) ([]ParsedLink, error) {
for scanner.Scan() {
line := scanner.Text()
keywords := keywordsRE.FindAllStringSubmatch(line, -1)
for _, matches := range keywords {
link := matches[1]
l := cleanNameURL(link)
result = append(result, ParsedLink{blockId, link, l, line, ""})
}
links := hrefRE.FindAllStringSubmatch(line, -1)
for _, matches := range links {
@ -98,13 +105,6 @@ func ParseLinks(blockId string, content string) ([]ParsedLink, error) {
l := cleanNameURL(link)
result = append(result, ParsedLink{blockId, link, l, line, ""})
}
keywords := keywordsRE.FindAllStringSubmatch(line, -1)
for _, matches := range keywords {
link := matches[1]
l := cleanNameURL(link)
result = append(result, ParsedLink{blockId, link, l, line, ""})
}
}
return result, nil