From e53b59a94bc6e13bf0c573571806001540c4970c Mon Sep 17 00:00:00 2001 From: askiiart Date: Mon, 9 Oct 2023 10:31:24 -0500 Subject: [PATCH] Split scripts, re-generate feed --- feed.xml | 10 +++++----- generate-rss.sh | 19 +++++++++++++++++++ md2html.sh | 21 +-------------------- run.sh | 7 +++++++ 4 files changed, 32 insertions(+), 25 deletions(-) create mode 100755 generate-rss.sh create mode 100644 run.sh diff --git a/feed.xml b/feed.xml index 06c5833..12f0149 100644 --- a/feed.xml +++ b/feed.xml @@ -5,7 +5,11 @@ askiiart.net The feed for askiiart.net, I guess https://askiiart.net - Mon, 25 Sep 2023 19:46:11 +0000 + Mon, 09 Oct 2023 15:27:37 +0000 + + My Stack + https://askiiart.net/stack.html + Marlin Boot Animations https://askiiart.net/blog/marlin-boot-animations.html @@ -14,10 +18,6 @@ askiiart's site https://askiiart.net/index.html - - My Stack - https://askiiart.net/stack.html - Using JSON with docker compose https://askiiart.net/til/using-json-with-docker-compose.html diff --git a/generate-rss.sh b/generate-rss.sh new file mode 100755 index 0000000..5aa623b --- /dev/null +++ b/generate-rss.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +# Makes RSS feed (feed.xml) +# Currently missing description and pubDate +# Based off https://en.wikipedia.org/wiki/RSS, particularly the example +printf "\n\n\n\n askiiart.net\n The feed for askiiart.net, I guess\n https://askiiart.net\n $(TZ='UTC' date --rfc-2822)" >feed.xml +find . -name "*.html" | while read -r item; do + # Skip template.html, wishlist.html, resume.html, and portfolio.html + if [[ ${item} == "./template.html" || ${item} == "./wishlist.html" || ${item} == "./resume.html" || ${item} == "./portfolio.html" ]]; then + continue + fi + item="${item%.*}" + item="${item#./}" + TITLE=$(grep -m 1 -oP '(?<=^# ).*' ${item}.md | cat) + printf "\n \n ${TITLE}\n https://askiiart.net/${item}.html\n " >>feed.xml +done +printf "\n\n\n" >>feed.xml + +find . \( ! -regex './md2html.sh' \) -type f | xargs sed -i 's/language-/language-/g' diff --git a/md2html.sh b/md2html.sh index eab3ecb..bffab00 100755 --- a/md2html.sh +++ b/md2html.sh @@ -1,7 +1,6 @@ -#!/bin/bash +#!/usr/bin/env bash set -e - git status --porcelain | awk 'match($1, "(M|A|\?\?)"){print $2}' | while read -r item; do if [[ ${item} == *.md ]]; then item="${item%.*}" @@ -9,21 +8,3 @@ git status --porcelain | awk 'match($1, "(M|A|\?\?)"){print $2}' | while read -r pandoc -f markdown-smart --data-dir . --template ${dir}/template.html -t html -o ${item}.html ${item}.md --metadata title="$(grep -m 1 -oP '(?<=^# ).*' ${item}.md | cat)" fi done - -# Makes RSS feed (feed.xml) -# Currently missing description and pubDate -# Based off https://en.wikipedia.org/wiki/RSS, particularly the example -printf "\n\n\n\n askiiart.net\n The feed for askiiart.net, I guess\n https://askiiart.net\n $(TZ='UTC' date --rfc-2822)" > feed.xml -find . -name "*.html" | while read -r item; do - # Skip template.html, wishlist.html, resume.html, and portfolio.html - if [[ ${item} == "./template.html" || ${item} == "./wishlist.html" || ${item} == "./resume.html" || ${item} == "./portfolio.html" ]]; then - continue - fi - item="${item%.*}" - item="${item#./}" - TITLE=$(grep -m 1 -oP '(?<=^# ).*' ${item}.md | cat) - printf "\n \n ${TITLE}\n https://askiiart.net/${item}.html\n " >>feed.xml -done -printf "\n\n\n" >> feed.xml - -find . \( ! -regex './md2html.sh' \) -type f | xargs sed -i 's/sourceCode /language-/g' diff --git a/run.sh b/run.sh new file mode 100644 index 0000000..698e26a --- /dev/null +++ b/run.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +set -e +SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) + +cd $SCRIPT_DIR +./md2html.sh +./generate-rss.sh