about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2022-07-18 13:47:46 -0500
committerCase Duckworth2022-07-18 13:47:46 -0500
commit581f23ee70fb7c101e2a291effcc12fe92bd2207 (patch)
tree939021ebcf4ffa6525df2a8d538eb94e966828bf
parentAdd HN/lobste.rs (diff)
downloadsfeed-581f23ee70fb7c101e2a291effcc12fe92bd2207.tar.gz
sfeed-581f23ee70fb7c101e2a291effcc12fe92bd2207.zip
Change LIMIT to mean max number of items from each feed
-rwxr-xr-xsfeed_html.sh4
1 files changed, 3 insertions, 1 deletions
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 @@
3echo() { printf '%s\n' "$*"; } 3echo() { printf '%s\n' "$*"; }
4 4
5html() { 5html() {
6 : "${LIMIT:=1}" 6 : "${LIMIT:=25}"
7 aside="$(mktemp /tmp/sfeed_html_aside.XXXXXX)" 7 aside="$(mktemp /tmp/sfeed_html_aside.XXXXXX)"
8 cat <<EOF 8 cat <<EOF
9$(html_head) 9$(html_head)
@@ -83,6 +83,7 @@ html_feed() { # html_feed FEED(file) => HTML
83 entries="$(awk -v NOW="$now" -v FRESH_SECS="$fresh_secs" \ 83 entries="$(awk -v NOW="$now" -v FRESH_SECS="$fresh_secs" \
84 -v NAME="$filename" -v ASIDE="$aside" -v limit="$LIMIT" \ 84 -v NAME="$filename" -v ASIDE="$aside" -v limit="$LIMIT" \
85 'BEGIN { FS="\t"; fresh_feed = 0; FRESH = (NOW - FRESH_SECS); } 85 'BEGIN { FS="\t"; fresh_feed = 0; FRESH = (NOW - FRESH_SECS); }
86 FNR == 1 { nitem = 0; }
86 function unescape(t) { 87 function unescape(t) {
87 t = html_escape(t); 88 t = html_escape(t);
88 gsub(/\\\t/,"\t",t); 89 gsub(/\\\t/,"\t",t);
@@ -97,6 +98,7 @@ html_feed() { # html_feed FEED(file) => HTML
97 return t 98 return t
98 } 99 }
99 { 100 {
101 if (limit && (++nitem > limit)) next;
100 timestamp=$1; 102 timestamp=$1;
101 title=$2; 103 title=$2;
102 link=$3; 104 link=$3;