summaryrefslogtreecommitdiff
path: root/mkdeps.sh
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-11-18 08:21:58 -0300
committerEuAndreh <eu@euandre.org>2024-11-18 08:44:57 -0300
commit960e4410f76801356ebd42801c914b2910a302a7 (patch)
tree615d379416f72956d0c1666c63ce062859041fbe /mkdeps.sh
parentRemove jekyll infrastructure setup (diff)
downloadeuandre.org-960e4410f76801356ebd42801c914b2910a302a7.tar.gz
euandre.org-960e4410f76801356ebd42801c914b2910a302a7.tar.xz
v0 migration to mkwb
Diffstat (limited to '')
-rwxr-xr-xmkdeps.sh81
1 files changed, 81 insertions, 0 deletions
diff --git a/mkdeps.sh b/mkdeps.sh
new file mode 100755
index 0000000..505ccff
--- /dev/null
+++ b/mkdeps.sh
@@ -0,0 +1,81 @@
+#!/bin/sh
+set -eu
+
+export LANG=POSIX.UTF-8
+
+
+normalize() {
+ xargs realpath |
+ awk -vPWD="$PWD/" '{ print substr($0, length(PWD) + 1) }' |
+ sort
+}
+
+pages() {
+ find src/pages/*/*.adoc -type f | normalize
+}
+
+articles() {
+ find src/collections/*/*/ -type f -name '*.adoc' | normalize
+}
+
+listings() {
+ find src/collections/*/index.adoc | normalize
+}
+
+extras() {
+ find src/content/ -type f \
+ -name '*.flac' -or \
+ -name '*.webm' -or \
+ -name '*.tar.gz'
+}
+
+files() {
+ pages
+ articles
+ listings
+}
+
+
+pages | varlist 'pages.adoc'
+articles | varlist 'articles.adoc'
+listings | varlist 'listings.adoc'
+listings | sed 's|/index\.adoc$|/feed.xml|' | varlist 'feeds.xml'
+find src/content/img/ -name '*.svg' | varlist 'images.svg'
+extras | varlist 'sources.extras'
+
+
+files | sed 's/^\(.*\)\.adoc$/\1.htmlbody\t\1.snippets\t\1.conf:\t\1.adoc/'
+files | sed 's/^\(.*\)\.adoc$/\1.html:\t\1.conf\t\1.htmlbody/'
+printf '\n'
+
+articles | sed 's/^\(.*\)\.adoc$/\1.feedentry:\t\1.conf\t\1.htmlbody/'
+articles | sed 's/^\(.*\)\.adoc$/\1.sortdata:\t\1.conf/'
+printf '\n'
+
+listings | sed 's/^\(.*\)\.adoc$/\1.htmlheader\t\1.htmlfooter:\t\1.conf/'
+listings | sed 's/^\(.*\)\.adoc$/\1.htmllisting:\t\1.htmldeps/'
+listings | sed 's/^\(.*\)\.adoc$/\1.html:\t\1.htmlheader\t\1.htmlfooter/'
+listings | sed 's/^\(.*\)\.adoc$/\1.html:\t\1.htmllisting\t\1.htmlbody/'
+
+for colllink in src/collections/*; do
+ c="$(printf '%s' "$colllink" | normalize)"
+
+ printf '\n\n'
+ name="$(basename "$c")"
+ find "$c"/*/ -type f -name '*.adoc' | varlist "articles.$name.adoc"
+ printf 'articles.%s.%s = $(articles.%s.adoc:.adoc=.%s)\n' \
+ "$name" 'sortdata ' "$name" 'sortdata'
+ printf 'articles.%s.%s = $(articles.%s.adoc:.adoc=.%s)\n' \
+ "$name" 'indexentry' "$name" 'indexentry'
+ printf 'articles.%s.%s = $(articles.%s.adoc:.adoc=.%s)\n' \
+ "$name" 'feedentry ' "$name" 'feedentry'
+
+
+ printf '%s/index.htmldeps: $(articles.%s.indexentry)\n' "$c" "$name"
+ printf '%s/feed.xmldeps: $(articles.%s.feedentry)\n' "$c" "$name"
+
+ printf '%s/index.htmldeps %s/feed.xmldeps: $(articles.%s.sortdata)\n' \
+ "$c" "$c" "$name"
+ printf '\tfind $(articles.%s.sortdata) > $@\n\n' "$name"
+ printf '%s/feed.xml:\t%s/feed.xmldeps\n' "$c" "$c"
+done