From 581f23ee70fb7c101e2a291effcc12fe92bd2207 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Mon, 18 Jul 2022 13:47:46 -0500 Subject: Change LIMIT to mean max number of items from each feed --- sfeed_html.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sfeed_html.sh b/sfeed_html.sh index a618ff9..2dd830c 100755 --- a/sfeed_html.sh +++ b/sfeed_html.sh @@ -3,7 +3,7 @@ echo() { printf '%s\n' "$*"; } html() { - : "${LIMIT:=1}" + : "${LIMIT:=25}" aside="$(mktemp /tmp/sfeed_html_aside.XXXXXX)" cat < HTML entries="$(awk -v NOW="$now" -v FRESH_SECS="$fresh_secs" \ -v NAME="$filename" -v ASIDE="$aside" -v limit="$LIMIT" \ 'BEGIN { FS="\t"; fresh_feed = 0; FRESH = (NOW - FRESH_SECS); } + FNR == 1 { nitem = 0; } function unescape(t) { t = html_escape(t); gsub(/\\\t/,"\t",t); @@ -97,6 +98,7 @@ html_feed() { # html_feed FEED(file) => HTML return t } { + if (limit && (++nitem > limit)) next; timestamp=$1; title=$2; link=$3; -- cgit 1.4.1-21-gabe81