diff options
-rwxr-xr-x | build.sh | 56 |
1 files changed, 35 insertions, 21 deletions
@@ -84,6 +84,9 @@ for i in *.md; do if [ "$filename" == "index" ]; then echo "[build] skipping index file for later..." + + cp "$i" ../../web/articles/ + else mkdir -p ../../web/articles/"$filename"/ @@ -95,26 +98,37 @@ for i in *.md; do cp "$i" ../../web/articles/"$filename"/index.md - fi - - cp "$i" ../../web/articles/ - - # sort this by date - - if [ -e "$filename".meta ]; then - source ./"$filename".meta - # `.meta` is a simple shell script that uses `export` to - # set some variables, notably: - # WEBMETA_TITLE (title string) - # WEBMETA_DATE (date string YYYY-MM-DD) - # WEBMETA_AUTH (author string) - # WEBMETA_SUMMARY (summary string) - # please note that you have to actually check if this data is correct - # and you should not just import random `.meta` files as they can arbitrarily - # execute code on your system and are directly injected into the HTML. - export WEBMETA_BASELINK="https://hitler.rip/articles/" - # you will also have to manually change this link to the final destination - # of your articles so that the RSS feed can successfully link there. + export WEBMETA_TITLE="" + export WEBMETA_DATE="" + export WEBMETA_AUTH="" + export WEBMETA_SUMMARY="" + + if [ -e "$filename".meta ]; then + echo "[build] running script: $filename.meta" + source ./"$filename".meta + # `.meta` is a simple shell script that uses `export` to + # set some variables, notably: + # WEBMETA_TITLE (title string) + # WEBMETA_DATE (date string YYYY-MM-DD) + # WEBMETA_AUTH (author string) + # WEBMETA_SUMMARY (summary string) + # please note that you have to actually check if this data is correct + # and you should not just import random `.meta` files as they can arbitrarily + # execute code on your system and are directly injected into the HTML. + fi + + if [ "$WEBMETA_DATE" == "" ]; then + export WEBMETA_DATE="2001-09-11*REDACTED!*" + fi + if [ "$WEBMETA_AUTH" == "" ]; then + export WEBMETA_AUTH="Anonymous" + fi + if [ "$WEBMETA_SUMMARY" == "" ]; then + export WEBMETA_SUMMARY="redacted" + fi + if [ "$WEBMETA_TITLE" == "" ]; then + export WEBMETA_TITLE="$filename" + fi touch ../../tmp/articles/gen-articles-tmp-list.html tee -a ../../tmp/articles/gen-articles-tmp-list.html > /dev/null << EOF @@ -129,7 +143,7 @@ EOF tee -a ../../tmp/articles/gen-articles-tmp-rss.xml > /dev/null << EOF <item> <title>$WEBMETA_TITLE</title> - <pubDate>$(date -d "$WEBMETA_DATE" +"%a, %d %b %Y %H:%M:%S +0000" )</pubDate> + <pubDate>$(date -d "${WEBMETA_DATE:0:10}" +"%a, %d %b %Y %H:%M:%S +0000" )</pubDate> <author>$WEBMETA_AUTHOR</author> <description>$WEBMETA_SUMMARY</description> <link>/$filename</link> |