From 2d69d91ccf6218c1c80fe3ee02a87b601e945282 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Sun, 7 Apr 2024 16:54:02 +0200 Subject: [PATCH] bugfix: find tags containing "_" --- macros/search | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/macros/search b/macros/search index b603050..f72fd0b 100755 --- a/macros/search +++ b/macros/search @@ -95,9 +95,9 @@ if [ "${show_hits}" = true ]; then $(printf %s\\n "${query}" | awk ' BEGIN { # Field separator FS should include punctuation, including Unicode Block U+2000 - U+206F if ( length("¡") == 1 ) # Utf-8 aware AWK - FS = "([] \\t\\n\\r\"'\''()*+,./:;<=>?\\\\^_`{|}~[-]|%[0-9A-Fa-f]{2}|'"$(printf '[\342\200\200-\342\201\257]')"')+"; + FS = "([] \\t\\n\\r\"'\''()*+,./:;<=>?\\\\^`{|}~[-]|%[0-9A-Fa-f]{2}|'"$(printf '[\342\200\200-\342\201\257]')"')+"; else # UTF-8 Hack - FS = "([] \\t\\n\\r\"'\''()*+,./:;<=>?\\\\^_`{|}~[-]|%[0-9A-Fa-f]{2}|'"$(printf '\342\200[\200-\277]|\342\201[\201-\257]')"')+"; + FS = "([] \\t\\n\\r\"'\''()*+,./:;<=>?\\\\^`{|}~[-]|%[0-9A-Fa-f]{2}|'"$(printf '\342\200[\200-\277]|\342\201[\201-\257]')"')+"; fi } { t=0; for (n = 1; n <= NF; n++) if ($n ~ /#[[:alnum:]_]+/) tags[t++] = toupper($n); @@ -105,7 +105,7 @@ if [ "${show_hits}" = true ]; then t=0; for (n = 1; n <= NF; n++) if ($n !~ /![[:alnum:]_]+/) words[t++] = tolower($n); for (t in tags) { sub(/^#/, "", tags[t]); printf "%s ", tags[t]; } print ""; for (t in ntags) { sub(/^!/, "", ntags[t]); printf "%s ", ntags[t]; } print ""; - for (t in words) { sub(/^[!#]/, "", words[t]); printf "%s ", words[t]; } print ""; + for (t in words) { gsub(/[!#_ ]+/, " ", words[t]); printf "%s ", words[t]; } print ""; } ') EOF -- 2.39.2