aboutsummaryrefslogtreecommitdiff
path: root/v2/src/bin/makemake
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2023-04-05 16:14:00 -0300
committerEuAndreh <eu@euandre.org>2023-04-05 16:14:00 -0300
commit24e24b49fb6375189cfa527a113eb965087a293a (patch)
treefc75f8267a22f6473432ee6b07c4013561c303dc /v2/src/bin/makemake
parentv2: Recove h[2-6] anchor link and icon (diff)
downloadeuandre.org-24e24b49fb6375189cfa527a113eb965087a293a.tar.gz
euandre.org-24e24b49fb6375189cfa527a113eb965087a293a.tar.xz
v2: Support Atom feeds and collection translations
Diffstat (limited to '')
-rwxr-xr-xv2/src/bin/makemake142
1 files changed, 84 insertions, 58 deletions
diff --git a/v2/src/bin/makemake b/v2/src/bin/makemake
index e95a040..fdd0e68 100755
--- a/v2/src/bin/makemake
+++ b/v2/src/bin/makemake
@@ -64,84 +64,110 @@ varlist() {
printf '\n'
}
-html_deps() {
- "$@" | sed 's/^\(.*\)\.md$/\1.conf \1.content: \1.md/'
- "$@" | sed 's/^\(.*\)\.md$/\1.snippets \1.html: \1.conf \1.content/'
- printf '\n'
-}
-
-
-content_mds() {
- {
- if [ "$r" = 'pages' ]; then
- echo src/content/*.md
- else
- echo src/content/"$r"/*.md
- fi
- } | tr ' ' '\n'
-}
-
-RESOURCES='
-pages
-pastebins
-tils
-'
EXTENSIONS='
-.md
.conf
.content
.html
.snippets
+.htmlbody
'
-for r in $RESOURCES; do
- content_mds "$r" | varlist "$r".md
- for e in $EXTENSIONS; do
- if [ "$e" = '.md' ]; then
- continue
+COLL_EXTENSIONS='
+.sortref
+.xmlentry
+'
+
+page_ext_filter="^($(echo "$COLL_EXTENSIONS" |
+ tr ' ' '\n' |
+ grep . |
+ paste -sd'|'
+))\$"
+
+
+extensions() {
+ echo "$EXTENSIONS" "$COLL_EXTENSIONS" "$@" |
+ tr ' ' '\n' |
+ grep .
+}
+
+
+printf '.POSIX:\n\n\n'
+for lang in $(langs); do
+ for c in pages $(collections); do
+ if [ "$c" = 'pages' ]; then
+ filter="$page_ext_filter"
+ dir="$CONTENT_PREFIX/$lang"
+ else
+ filter='^$'
+ dir="$CONTENT_PREFIX/$lang/$c"
fi
- # shellcheck disable=2016
- printf '%s%s = $(%s.md:.md=%s)\n' "$r" "$e" "$r" "$e"
- done
- printf '%s =' "$r"
- for e in $EXTENSIONS; do
- if [ "$e" = '.md' ]; then
+
+ mds() {
+ # find "$dir"/*.md # FIXME
+ find "$dir"/*.md 2>/dev/null
+ }
+
+ exts() {
+ extensions | grep -Ev "$filter"
+ }
+
+ mds | varlist "$c.$lang.md"
+ exts | sed "s|^\(.*\)\$|$c.$lang\1 = \$($c.$lang.md:.md=\1)|"
+ exts | sed "s|^\(.*\)\$|\$($c.$lang\1)|" | varlist "$c.$lang"
+
+ mds | sed 's/^\(.*\)\.md$/\1.conf \1.content: \1.md/'
+ mds | sed 's/^\(.*\)\.md$/\1.snippets \1.htmlbody \1.html: \1.conf \1.content/'
+ if [ "$c" = 'pages' ]; then
continue
fi
- # shellcheck disable=2016
- printf ' $(%s%s)' "$r" "$e"
+
+ mds | sed 's/^\(.*\)\.md$/\1.sortref: \1.md/'
+ mds | sed 's/^\(.*\)\.md$/\1.xmlentry: \1.html/'
+
+ echo "$CONTENT_PREFIX/$lang/feeds/$c.xml: \$($c.$lang.xmlentry)"
+
+ printf '\n\n'
done
- printf '\n'
- html_deps content_mds "$r"
- printf '\n'
-done
+ for e in $(extensions); do
+ {
+ if ! printf '%s\n' "$e" | grep -qE "$page_ext_filter"; then
+ echo pages
+ fi
+ collections
+ } |
+ sed "s|^\(.*\)\$|\$(\1.$lang$e)|" |
+ varlist "all-generated.$lang$e"
+ done
-all_resources() {
- echo "$RESOURCES" | tr ' ' '\n' | grep .
-}
+ collections |
+ sed "s|^\(.*\)\$|$CONTENT_PREFIX/$lang/feeds/\1.xml|" |
+ varlist "all-generated.$lang.xml"
-all_vars() {
- EXT="$1"
- # shellcheck disable=2016
- all_resources |
- sed 's|^|$(|' |
- sed "s|$|$EXT)|" |
- varlist all-generated"$EXT"
-}
+ extensions '.xml' |
+ sed "s|^\(.*\)\$|\$(all-generated.$lang\1)|" |
+ varlist "all-generated.$lang"
-for e in $EXTENSIONS; do
- all_vars "$e"
+ printf '\n'
+done
+
+for e in $(extensions .xml); do
+ langs |
+ sed "s|^\(.*\)\$|\$(all-generated.\1$e)|" |
+ varlist "all-generated$e"
done
-all_vars ''
+
+# shellcheck disable=2016
+langs |
+ sed 's|^\(.*\)$|$(all-generated.\1)|' |
+ varlist 'all-generated'
-git ls-files |
- grep -v '^src/content/' |
+git ls-files src/ |
+ grep -v ^"$CONTENT_PREFIX"/ |
varlist 'non-content'
-git ls-files src/content/ |
+git ls-files "$CONTENT_PREFIX"/ |
grep -v '\.md$' |
- grep -Ev "src/content/($(all_resources | paste -sd'|'))/" |
varlist 'static-content'