sbs

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

commit 244c11495e02dcb0c315bd235a610cecdc5175f6
parent 38b235203f8ad2e8b45fed907bedc36cfc6983c1
Author: Jake Bauer <jbauer@paritybit.ca>
Date:   Tue, 22 Feb 2022 13:38:58 -0500

Fix use of variables in printf format strings

Diffstat:
Msbs | 26+++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/sbs b/sbs @@ -35,7 +35,7 @@ if [ "$1" = "new" ]; then touch "$3/static/style.css" # Create template config.ini file printf "siteURL = https://example.com/\n" > "$3/config.ini" - printf "siteName = $3\n" >> "$3/config.ini" + printf "siteName = %s\n" "$3" >> "$3/config.ini" printf "blogDir = blog/\n" >> "$3/config.ini" printf "languageCode = en\n" >> "$3/config.ini" printf "buildOptions = -Thtml --html-no-skiphtml --html-no-escapehtml\n" >> "$3/config.ini" @@ -87,12 +87,12 @@ fi if [ "$1" = "genfeed" ]; then printf '<?xml version="1.0" encoding="utf-8"?>\n' > static/feed.xml printf '<feed xmlns="http://www.w3.org/2005/Atom">\n' >> static/feed.xml - printf "\t<title>$siteName</title>\n" >> static/feed.xml - printf "\t<link href=\"$siteURL\" />\n" >> static/feed.xml - printf "\t<link rel=\"self\" href=\"${siteURL}feed.xml\" />\n" >> static/feed.xml + printf "\t<title>%s</title>\n" "$siteName" >> static/feed.xml + printf "\t<link href=\"%s\" />\n" "$siteURL" >> static/feed.xml + printf "\t<link rel=\"self\" href=\"%sfeed.xml\" />\n" "${siteURL}" >> static/feed.xml printf "\t<icon>/favicon.png</icon>\n" >> static/feed.xml - printf "\t<updated>$(date +"%Y-%m-%dT%H:%M:%S%:z")</updated>\n" >> static/feed.xml - printf "\t<id>$siteURL</id>\n" >> static/feed.xml + printf "\t<updated>%s</updated>\n" "$(date +"%Y-%m-%dT%H:%M:%S%:z")" >> static/feed.xml + printf "\t<id>%s</id>\n" "$siteURL" >> static/feed.xml printf "\t<generator>sbs</generator>\n\n" >> static/feed.xml numEntries=0 @@ -113,11 +113,11 @@ if [ "$1" = "genfeed" ]; then date=$(lowdown -X date "$file") printf "\t<entry>\n" >> static/feed.xml - printf "\t\t<title>$title</title>\n" >> static/feed.xml - printf "\t\t<author><name>$author</name></author>\n" >> static/feed.xml - printf "\t\t<link href=\"$siteURL$subDir/$fileName\" />\n" >> static/feed.xml - printf "\t\t<id>$siteURL$subDir/$fileName</id>\n" >> static/feed.xml - printf "\t\t<updated>$(date -d "$date" +"%Y-%m-%dT%H:%M:%S%:z")</updated>\n" >> static/feed.xml + printf "\t\t<title>%s</title>\n" "$title">> static/feed.xml + printf "\t\t<author><name>%s</name></author>\n" "$author">> static/feed.xml + printf "\t\t<link href=\"%s%s/%s\" />\n" "$siteURL" "$subDir" "$fileName" >> static/feed.xml + printf "\t\t<id>%s%s/%s</id>\n" "$siteURL" "$subDir" "$fileName" >> static/feed.xml + printf "\t\t<updated>%s</updated>\n" "$(date -d "$date" +"%Y-%m-%dT%H:%M:%S%:z")" >> static/feed.xml printf "\t\t<content type=\"text\"><![CDATA[\n%s\n\t\t]]></content>\n" "$(lowdown $buildOptions "$file")" >> static/feed.xml printf "\t</entry>\n\n" >> static/feed.xml @@ -144,7 +144,7 @@ for file in "$@"; do subDir=$(dirname "$file" | sed "s/^content//") mkdir -p "static/$subDir" - printf "Creating: static$subDir/$fileName.html...\n" + printf "Creating: static%s/%s.html...\n" "$subDir" "$fileName" # Extract metadata from the markdown document title=$(lowdown -X title "$file") @@ -158,7 +158,7 @@ for file in "$@"; do -e "s/content=\"\"/content=\"$meta\"/" \ > "static/$subDir/$fileName".html - printf "Created: static$subDir/$fileName.html\n" + printf "Created: static%s/%s.html\n" "$subDir" "$fileName" done exit 0