summaryrefslogtreecommitdiff
path: root/seen.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xseen.sh15
1 files changed, 0 insertions, 15 deletions
diff --git a/seen.sh b/seen.sh
index 16bc980..1683bc4 100755
--- a/seen.sh
+++ b/seen.sh
@@ -69,42 +69,30 @@ else
usage
exit 1
fi
-
echo "Copyright (C) 2021 Vitali64 <vitali64pmemail@protonmail.com>"
echo "This program comes with ABSOLUTELY NO WARRANTY."
echo "This is free software, and you are welcome to modify it,"
echo "use it where you see fit, and redistribute it"
echo "under certain conditions; type './seen.sh --license' for details."
-
# Create the www/ folder if removed
mkdir -p "www" || die "Cannot create www/ directory: mkdir -p returns an error!"
-
# Erase www/index.html and insert the header
-echo "-> [$(date +%R)] Inserting the header ..."
cat "templates/header.html" > www/index.html || die "Cannot insert header into index.html!"
-
# Detect articles
-echo "-> [$(date +%R)] Detecting articles' markdown file ..."
articles="$(find articles/*.md|sed -e 's@.md@@g' -e 's@articles/@@g')" || die "Unknown error"
-
# Set the defaults
name="(!) no name (!)"
desc="(!) no description (!)"
date="1st January 1970"
-
# In the 'for' loop
for line in ${articles}
do
. "articles/${line}.cfg" || die "Cannot read ${line}.cfg file!" # Override the defaults
mkdir "www/articles" -p
- echo "-> [$(date +%R)] Inserting header to ${line}.html ..."
cat "templates/header.html" > "www/articles/${line}.html" || die "Cannot insert header into ${line}.html!" # Erase <article>.html and insert the header
- echo "-> [$(date +%R)] Converting ${line}.md to html ..."
markdown "articles/${line}.md" >> "www/articles/${line}.html" || hoedown "articles/${line}.md" >> "www/articles/${line}.html" || die "Cannot convert ${line}.md to html!" # Convert the markdown text to html
- echo "-> [$(date +%R)] Inserting footer to ${line}.html ..."
cat "templates/footer.html" >> "www/articles/${line}.html" || die "Cannot insert footer into ${line}.html!" # Insert the footer into the article page
cp -r templates/*.css www/. # Add css files if present
-
# Add an entry in index.html
echo "-> [$(date +%R)] Adding ${line} entry to index.html ..."
sed \
@@ -116,7 +104,4 @@ do
done
# Insert the footer into the index.html
-echo "-> [$(date +%R)] Inserting the footer ..."
cat "templates/footer.html" >> "www/index.html"
-echo "-> [$(date +%R)] Generation made successfully!"
-echo "Enjoy your blog. Exiting ..."