diff options
author | Case Duckworth | 2022-07-18 13:47:46 -0500 |
---|---|---|
committer | Case Duckworth | 2022-07-18 13:47:46 -0500 |
commit | 581f23ee70fb7c101e2a291effcc12fe92bd2207 (patch) | |
tree | 939021ebcf4ffa6525df2a8d538eb94e966828bf | |
parent | Add HN/lobste.rs (diff) | |
download | sfeed-581f23ee70fb7c101e2a291effcc12fe92bd2207.tar.gz sfeed-581f23ee70fb7c101e2a291effcc12fe92bd2207.zip |
Change LIMIT to mean max number of items from each feed
-rwxr-xr-x | sfeed_html.sh | 4 |
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 @@ | |||
3 | echo() { printf '%s\n' "$*"; } | 3 | echo() { printf '%s\n' "$*"; } |
4 | 4 | ||
5 | html() { | 5 | html() { |
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; |