Split scripts, re-generate feed
This commit is contained in:
parent
9e3bf5de9f
commit
e53b59a94b
4 changed files with 32 additions and 25 deletions
10
feed.xml
10
feed.xml
|
@ -5,7 +5,11 @@
|
|||
<title>askiiart.net</title>
|
||||
<description>The feed for askiiart.net, I guess</description>
|
||||
<link>https://askiiart.net</link>
|
||||
<lastBuildDate>Mon, 25 Sep 2023 19:46:11 +0000</lastBuildDate>
|
||||
<lastBuildDate>Mon, 09 Oct 2023 15:27:37 +0000</lastBuildDate>
|
||||
<item>
|
||||
<title>My Stack</title>
|
||||
<link>https://askiiart.net/stack.html</link>
|
||||
</item>
|
||||
<item>
|
||||
<title>Marlin Boot Animations</title>
|
||||
<link>https://askiiart.net/blog/marlin-boot-animations.html</link>
|
||||
|
@ -14,10 +18,6 @@
|
|||
<title>askiiart's site</title>
|
||||
<link>https://askiiart.net/index.html</link>
|
||||
</item>
|
||||
<item>
|
||||
<title>My Stack</title>
|
||||
<link>https://askiiart.net/stack.html</link>
|
||||
</item>
|
||||
<item>
|
||||
<title>Using JSON with docker compose</title>
|
||||
<link>https://askiiart.net/til/using-json-with-docker-compose.html</link>
|
||||
|
|
19
generate-rss.sh
Executable file
19
generate-rss.sh
Executable file
|
@ -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 "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<rss version=\"2.0\">\n\n<channel>\n <title>askiiart.net</title>\n <description>The feed for askiiart.net, I guess</description>\n <link>https://askiiart.net</link>\n <lastBuildDate>$(TZ='UTC' date --rfc-2822)</lastBuildDate>" >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 <item>\n <title>${TITLE}</title>\n <link>https://askiiart.net/${item}.html</link>\n </item>" >>feed.xml
|
||||
done
|
||||
printf "\n\n</channel>\n</rss>" >>feed.xml
|
||||
|
||||
find . \( ! -regex './md2html.sh' \) -type f | xargs sed -i 's/language-/language-/g'
|
21
md2html.sh
21
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 "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<rss version=\"2.0\">\n\n<channel>\n <title>askiiart.net</title>\n <description>The feed for askiiart.net, I guess</description>\n <link>https://askiiart.net</link>\n <lastBuildDate>$(TZ='UTC' date --rfc-2822)</lastBuildDate>" > 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 <item>\n <title>${TITLE}</title>\n <link>https://askiiart.net/${item}.html</link>\n </item>" >>feed.xml
|
||||
done
|
||||
printf "\n\n</channel>\n</rss>" >> feed.xml
|
||||
|
||||
find . \( ! -regex './md2html.sh' \) -type f | xargs sed -i 's/sourceCode /language-/g'
|
||||
|
|
7
run.sh
Normal file
7
run.sh
Normal file
|
@ -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
|
Loading…
Reference in a new issue