From 1cd8b8f7e99e3d18987ed17d084091e28773779f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Fri, 12 Mar 2021 11:23:59 +0100 Subject: [PATCH] alliw text search (and exclusion) in advfilter --- advsearch.sh | 4 +++- list.sh | 12 ++++++++---- widgets.sh | 4 +++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/advsearch.sh b/advsearch.sh index 3a2f333..1054618 100644 --- a/advsearch.sh +++ b/advsearch.sh @@ -11,9 +11,11 @@ for n in 1 2 3 4 5 6 7 8 9; do tag="$(POST tag_$n $m)" [ ! "${tag##${cat}:*}" ] || [ ! "${tag##-${cat}:*}" ] || [ "$cat" = '*' -a "${tag##*:*}" ] \ && f="${f}${tag}|" + [ "$cat" = \$ ] && f="${f}\$:${tag}|" done f="${f%[|^]}^" done -f="${f%^}" +f="$(printf '%s' "$f" |sed -E 's;[~|^]+$;;')" +#f="${f%^}" REDIRECT "$(URL "${ITEM}")?o=${order}&f=${f}" diff --git a/list.sh b/list.sh index 6c09a43..60609b6 100644 --- a/list.sh +++ b/list.sh @@ -51,10 +51,14 @@ list_item() { STRING "$FILTER^" \ | sed -E 's;\^;\n;g; s;[]\/\(\)\\\^\$\?\.\+\*\;\[\{\}];\\&;g' \ | while read -r f; do - [ "${f#\~}" ] || continue - [ "${f#\~}" = "$f" ] \ - && fex="/(\ttags=([^\t]*,)?)(${f})((,[^\t]*)?\t)/{${fex}}" \ - || fex="/(\ttags=([^\t]*,)?)(${f#\~})((,[^\t]*)?\t)/d; ${fex}" + [ "${f##*[A-Z]*}" ] && tl="y;ABCDEFGHIJKLMNOPQRSTUVWXYZ;abcdefghijklmnopqrstuvwxyz;;" + case $f in + ''|~) continue;; + ~\\\$:*) fex="h; ${tl} /${f#~\\\$:}/d; g;${fex}";; + \\\$:*) fex="h; ${tl} /${f#\\\$:}/{g;${fex}}";; + ~*) fex="/(\ttags=([^\t]*,)?)(${f#\~})((,[^\t]*)?\t)/d; ${fex}";; + *) fex="/(\ttags=([^\t]*,)?)(${f})((,[^\t]*)?\t)/{${fex}}";; + esac printf '%s\n' "${fex}" done \ | tail -n1 diff --git a/widgets.sh b/widgets.sh index cd9dda3..5cd371b 100644 --- a/widgets.sh +++ b/widgets.sh @@ -188,7 +188,7 @@ w_advsearch(){ $n "${t:+checked}" $n $n f="|${f#\~}|" - printf '*\n%s\n' "$w_tagcategories" \ + printf '*\n%s\n$\n' "$w_tagcategories" \ | while read -r category; do lbid="cat_${n}_${category}" @@ -217,6 +217,8 @@ w_advsearch(){ # printf '[option %s value="%s"\n%s]' "$t" "$tag" "$d" printf '[label [checkbox "tag_%s" "%s" %s] %s]' "$n" "$tag" "$t" "$d" done + d="${f##*\$:}" d="${d%%\|*}" + [ "$category" = \$ ] && printf '[input name="tag_%i" value="%s"]' "$n" "$d" printf '\n]' done printf ']' -- 2.39.2