Mirror of @tangled.org/core. Running on a Raspberry Pi Zero 2 (Please be gentle).
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

appview/pages : fix handle parsing false-positives

Signed-off-by: estym <evann.regnault@pm.me>

authored by

estym and committed by tangled.org ec832d14 2642ed24

+14
+14
appview/pages/markup/extension/atlink.go
··· 36 36 } 37 37 38 38 var atRegexp = regexp.MustCompile(`(^|\s|\()(@)([a-zA-Z0-9.-]+)(\b)`) 39 + var markdownLinkRegexp = regexp.MustCompile(`(?ms)\[.*\]\(.*\)`) 39 40 40 41 type atParser struct{} 41 42 ··· 56 55 if m == nil { 57 56 return nil 58 57 } 58 + 59 + if !util.IsSpaceRune(block.PrecendingCharacter()) { 60 + return nil 61 + } 62 + 63 + // Check for all links in the markdown to see if the handle found is inside one 64 + linksIndexes := markdownLinkRegexp.FindAllIndex(block.Source(), -1) 65 + for _, linkMatch := range linksIndexes { 66 + if linkMatch[0] < segment.Start && segment.Start < linkMatch[1] { 67 + return nil 68 + } 69 + } 70 + 59 71 atSegment := text.NewSegment(segment.Start, segment.Start+m[1]) 60 72 block.Advance(m[1]) 61 73 node := &AtNode{}