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 '<input type="checkbox"><a target="blank" href="%s">by %s: %s</a>' \
- "$line" "${lineo}" "$(present_filter "$linef")"
+ printf %s "$output" |while read line norm; do
+ printf '<input type="checkbox"><a target="blank" href="%s">%s</a>' \
+ "$line" "${norm}"
done
}