X-Git-Url: http://git.plutz.net/?a=blobdiff_plain;f=pages%2Fquicklinks.sh;h=f22a412129ee7a7d5adafe7d6b45a70084039957;hb=d716f2ce1fe64cf87f777490315bc51906001c72;hp=21729197590428c16eea49c65fd105d06537595b;hpb=0205c3f02124d62c980ba0656babd544f2cb7d19;p=serve0
diff --git a/pages/quicklinks.sh b/pages/quicklinks.sh
index 2172919..f22a412 100755
--- a/pages/quicklinks.sh
+++ b/pages/quicklinks.sh
@@ -25,23 +25,25 @@ filters="${_GET[f]}"
debug "FILTERS: $filters"
present_filter(){
- printf %s\\n "$*" \
+ printf %s "$*" |sed -nr '1s;^.*(\?|&)o=([^&]+)&?.*$;by \2: ;p'
+
+ printf %s "$*" \
+ | sed -nr '1s;^.*(\?|&)f=([^&]+)&?.*$;\2;p' \
| sed -r 's;(^|!|\^|\|)([^!\^\|:]+:);\1;g;s;\^;\n;g' \
| sort -r \
- | sed -r '$q;s;$; \&\; ;g'
+ | sed -r ':X;N;$!bX;s;\n; \&\; ;g'
}
quicklinks(){
output=''
tac ${_DATA}/meta/recent \
| while [ "$(printf %s "$output" |wc -l)" -lt 30 ] && read line; do
- printf %s "$output" |grep -qF "$line" || output="$output$line$LF"
+ norm="$(present_filter "$line")"
+ printf %s "$output" |grep -qF "$norm" || output="$output$line $norm$LF"
done
- printf %s "$output" |while read line; do
- linef=$(printf %s "$line" |sed -r 's;^.*(\?|&)f=([^&]+)&?.*$;\2;g')
- lineo=$(printf %s "$line" |sed -r 's;^.*(\?|&)o=([^&]+)&?.*$;\2;g')
- printf 'by %s: %s' \
- "$line" "${lineo}" "$(present_filter "$linef")"
+ printf %s "$output" |while read line norm; do
+ printf '%s' \
+ "$line" "${norm}"
done
}
@@ -50,7 +52,7 @@ category_selected(){
filter="$2"
[ "$cat" = "none:" ] && cat=''
- printf %s "$taglist" \
+ printf %s "$taglist_filter" \
| sed -r 's;^('"$filter"')$;1 &;;t;s;^;0 ;' \
| sed -rn 's;^(0|1) '"$cat"'([^:]+)$;\1 \2;p' \
| sed 's;^0 ;;'