all repos — searchix @ f608afdaebe0fdbf49b8363ef5adf6f9f0e918cb

Search engine for NixOS, nix-darwin, home-manager and NUR users

fix: first sentence of some descriptions cut off

Alan Pearce
commit

f608afdaebe0fdbf49b8363ef5adf6f9f0e918cb

parent

a48a47aa717de8b8213d0187e9b1dba9cfb3ed76

1 file changed, 3 insertions(+), 3 deletions(-)

changed files
M internal/components/markdown.gointernal/components/markdown.go
@@ -4,11 +4,11 @@ import (
"regexp" ) -var firstSentenceRegexp = regexp.MustCompile(`^.+?(\.[[:space:]]|:\n)`) +var firstSentenceRegexp = regexp.MustCompile(`^((?s).+?)(?:\.[[:space:]]*[[:upper:]])`) func firstSentence[T ~string](text T) T { - if fs := firstSentenceRegexp.FindString(string(text)); fs != "" { - return T(fs) + if fs := firstSentenceRegexp.FindStringSubmatch(string(text)); len(fs) > 0 && fs[1] != "" { + return T(fs[1]) } return text