X-Git-Url: http://git.plutz.net/?a=blobdiff_plain;f=pages%2Fquicklinks.sh;fp=pages%2Fquicklinks.sh;h=0000000000000000000000000000000000000000;hb=dfdfcfb7ac57a823e639a19d268436753385cbed;hp=f22a412129ee7a7d5adafe7d6b45a70084039957;hpb=d716f2ce1fe64cf87f777490315bc51906001c72;p=serve0 diff --git a/pages/quicklinks.sh b/pages/quicklinks.sh deleted file mode 100755 index f22a412..0000000 --- a/pages/quicklinks.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/zsh - -# Copyright 2014 - 2016 Paul Hänsch -# -# This file is part of Serve0. -# -# Serve0 is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Serve0 is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with Serve0. If not, see . - -. $_EXEC/pages/common.sh - -LF=' -' -filters="${_GET[f]}" -debug "FILTERS: $filters" - -present_filter(){ - 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 ':X;N;$!bX;s;\n; \&\; ;g' -} - -quicklinks(){ - output='' - tac ${_DATA}/meta/recent \ - | while [ "$(printf %s "$output" |wc -l)" -lt 30 ] && read line; do - norm="$(present_filter "$line")" - printf %s "$output" |grep -qF "$norm" || output="$output$line $norm$LF" - done - printf %s "$output" |while read line norm; do - printf '%s' \ - "$line" "${norm}" - done -} - -category_selected(){ - cat="${1}:" - filter="$2" - [ "$cat" = "none:" ] && cat='' - - printf %s "$taglist_filter" \ - | sed -r 's;^('"$filter"')$;1 &;;t;s;^;0 ;' \ - | sed -rn 's;^(0|1) '"$cat"'([^:]+)$;\1 \2;p' \ - | sed 's;^0 ;;' -} -