diff options
-rwxr-xr-x | rs.sh | 8 | ||||
-rwxr-xr-x | seen.sh | 5 |
2 files changed, 0 insertions, 13 deletions
@@ -1,6 +1,5 @@ #!/bin/sh # Seen, a simple static blog generator -# # Copyright (C) 2021 Vitali64 <vitali64pmemail@protonmail.com> # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -12,19 +11,14 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. - die() { echo "-> [$(date +%R)] (!) ERROR: Unexpected error, please report : $1 (!)" exit 1 } - # Articles articles="$(find articles/*.md|sed -e 's@.md@@g' -e 's@articles/@@g')" || die "Unknown error" - echo "-> [$(date +%R)] Generating RSS feed ..." - touch "www/rss.xml" - # Set the defaults rssBlogTitle="blog" rssBlogDescription="It's a blog" @@ -35,7 +29,6 @@ printf '%s\n' '<channel>' >> "www/rss.xml" printf '%s\n' "<title>${rssBlogTitle}</title>" >> "www/rss.xml" printf '%s\n' "<link>BLANK</link>" >> "www/rss.xml" printf '%s\n' "<description>$rssBlogDescription</description>" >> "www/rss.xml" - # Items for line in ${articles} do @@ -46,7 +39,6 @@ do printf '%s\n' "<description>$(cat articles/${line}.md)</description>" >> "www/rss.xml" printf '%s\n' '</item>' >> "www/rss.xml" done - # Footer of the RSS XMLÂ file printf '%s\n' '</channel>' >> "www/rss.xml" printf '%s\n' '</rss>' >> "www/rss.xml" @@ -11,7 +11,6 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. - usage() { echo "Usage : ./seen [OPTIONS]" echo "--help : Print this help message" @@ -19,14 +18,11 @@ usage() { echo "--license : Show license" echo "--rss : Create an RSS feed (runs ./rs.sh)" } - die() { echo "-> [$(date +%R)] (!) ERROR: Unexpected error, please report : $1 (!)" exit 1 } - echo "Seen, a simple static blog generator" - if [ "$1" = "--clear" ]; then echo "-> [$(date +%R)] Deleting generated blog ..." rm -Rf www/* || die "Cannot delete generated blog!" @@ -77,6 +73,5 @@ do -e "s@description-of-article@${desc}@" \ "templates/article.html">> "www/index.html" || die "Cannot add entry to index.html!" done - # Insert the footer into the index.html cat "templates/footer.html" >> "www/index.html" |