sbs

A Simple Blogging System.
git clone https://git.sr.ht/~jbauer/sbs
Log | Files | Refs | README | LICENSE

commit e74f8b9164e0903f60729c720933dd952a648313
parent ef5a8226bfbbb190425b351b454feeaf40693c35
Author: Jake Bauer <jbauer@paritybit.ca>
Date:   Sun, 12 Mar 2023 11:43:10 -0400

Fix non-portable use of date command

Date is apparently extremely non-portable so limit its use to very
simple printing of current date/time plus timezone instead of trying to
use it to generate date strings.

Diffstat:
Msbs | 7+++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/sbs b/sbs @@ -132,7 +132,7 @@ genfeed() printf "\t<link href=\"%s\" />\n" "$siteURL" printf "\t<link rel=\"self\" href=\"%sfeed.xml\" />\n" "${siteURL}" printf "\t<icon>/favicon.png</icon>\n" - printf "\t<updated>%s</updated>\n" "$(date +"%Y-%m-%dT%H:%M:%S%:z")" + printf "\t<updated>%s</updated>\n" "$(date +"%Y-%m-%dT%H:%M:%S%z")" printf "\t<id>%s</id>\n" "$siteURL" printf "\t<generator>sbs</generator>\n\n" } > static/feed.xml @@ -142,8 +142,7 @@ genfeed() if [ -n "$(lowdown -X draft "$file" 2>/dev/null)" ]; then continue fi - printf "%s %s\n" "$(date -d "$(lowdown -X date "$file")" +"%s")" \ - "$file" >> "$tmp" + printf "%s %s\n" "$(lowdown -X date "$file")" "$file" >> "$tmp" done sort -rn "$tmp" | cut -d' ' -f2 | while read -r file; do fileName=$(basename "$file" .md).html @@ -158,7 +157,7 @@ genfeed() printf "\t\t<author><name>%s</name></author>\n" "$author" printf "\t\t<link href=\"%s%s/%s\" />\n" "$siteURL" "$subDir" "$fileName" printf "\t\t<id>%s%s/%s</id>\n" "$siteURL" "$subDir" "$fileName" - printf "\t\t<updated>%s</updated>\n" "$(date -d "$date" +"%Y-%m-%dT%H:%M:%S%:z")" + printf "\t\t<updated>%s</updated>\n" "${date}T00:00:00$(date +%z)" printf "\t\t<content type=\"html\"><![CDATA[\n%s\n\t\t]]></content>\n" "$(lowdown $buildOptions "$file")" printf "\t</entry>\n\n" } >> static/feed.xml