From ee71be14a05d0d7da38352f8ff5c19798f96d4eb Mon Sep 17 00:00:00 2001
From: EuAndreh
Date: Sat, 8 Apr 2023 13:22:48 -0300
Subject: v2: Generate collections index.html pages and their "by-category"
equivalents
---
v2/src/bin/absolute | 30 ++++-
v2/src/bin/categories | 80 +++++++++++++
v2/src/bin/category | 80 +++++++++++++
v2/src/bin/collection-for | 83 +++++++++++++
v2/src/bin/conf | 69 ++++++-----
v2/src/bin/feed | 44 +++++--
v2/src/bin/index | 128 +++++++++++++++++++++
v2/src/bin/indexentry | 73 ++++++++++++
v2/src/bin/makemake | 37 ++++--
.../en/pastebins/raku-tuple-type-annotation.md | 2 +
v2/src/content/en/pastebins/sicp-exercise-3-19.md | 2 +
.../content/en/tils/lisp-three-way-conditional.md | 2 +
v2/src/content/favicon.svg | 62 ----------
v2/src/content/img/alt/atom.en.txt | 1 +
v2/src/content/img/alt/atom.pt.txt | 1 +
v2/src/content/img/alt/envelope.en.txt | 1 +
v2/src/content/img/alt/envelope.pt.txt | 1 +
v2/src/content/img/alt/favicon.en.txt | 1 +
v2/src/content/img/alt/favicon.pt.txt | 1 +
v2/src/content/img/alt/link.en.txt | 1 +
v2/src/content/img/alt/link.pt.txt | 1 +
v2/src/content/img/alt/linkto.en.txt | 1 +
v2/src/content/img/alt/linkto.pt.txt | 2 +
v2/src/content/img/alt/lock.en.txt | 1 +
v2/src/content/img/alt/lock.pt.txt | 1 +
v2/src/content/img/atom.svg | 5 +
v2/src/content/img/favicon.svg | 62 ++++++++++
v2/src/content/img/linkto.svg | 7 ++
.../content/pt/pastebins/exercicios-sicp-e-19.md | 2 +
v2/src/content/security.txt | 1 -
v2/src/lib/base.conf | 1 -
v2/src/lib/base.en.conf | 26 +++++
v2/src/lib/base.pt.conf | 26 +++++
v2/src/lib/category-header.html | 6 +
v2/src/lib/category.html | 3 +
v2/src/lib/entry.html | 5 +
v2/src/lib/entry.xml | 4 +-
v2/src/lib/feed.xml | 8 +-
v2/src/lib/index-postamble.html | 8 ++
v2/src/lib/index-preamble.html | 7 ++
v2/src/lib/postamble.html | 10 +-
v2/src/lib/preamble.html | 6 +-
v2/src/redirect.mappings | 2 +
43 files changed, 768 insertions(+), 126 deletions(-)
create mode 100755 v2/src/bin/categories
create mode 100755 v2/src/bin/category
create mode 100755 v2/src/bin/collection-for
create mode 100755 v2/src/bin/index
create mode 100755 v2/src/bin/indexentry
delete mode 100644 v2/src/content/favicon.svg
create mode 100644 v2/src/content/img/alt/atom.en.txt
create mode 100644 v2/src/content/img/alt/atom.pt.txt
create mode 100644 v2/src/content/img/alt/envelope.en.txt
create mode 100644 v2/src/content/img/alt/envelope.pt.txt
create mode 100644 v2/src/content/img/alt/favicon.en.txt
create mode 100644 v2/src/content/img/alt/favicon.pt.txt
create mode 100644 v2/src/content/img/alt/link.en.txt
create mode 100644 v2/src/content/img/alt/link.pt.txt
create mode 100644 v2/src/content/img/alt/linkto.en.txt
create mode 100644 v2/src/content/img/alt/linkto.pt.txt
create mode 100644 v2/src/content/img/alt/lock.en.txt
create mode 100644 v2/src/content/img/alt/lock.pt.txt
create mode 100644 v2/src/content/img/atom.svg
create mode 100644 v2/src/content/img/favicon.svg
create mode 100644 v2/src/content/img/linkto.svg
delete mode 120000 v2/src/content/security.txt
create mode 100755 v2/src/lib/category-header.html
create mode 100644 v2/src/lib/category.html
create mode 100644 v2/src/lib/entry.html
create mode 100755 v2/src/lib/index-postamble.html
create mode 100755 v2/src/lib/index-preamble.html
(limited to 'v2/src')
diff --git a/v2/src/bin/absolute b/v2/src/bin/absolute
index ecf5a64..f475901 100755
--- a/v2/src/bin/absolute
+++ b/v2/src/bin/absolute
@@ -5,7 +5,7 @@ set -eu
usage() {
cat <<-'EOF'
Usage:
- absolute < STDIN
+ absolute [CONTENT...]
absolute -h
EOF
}
@@ -16,9 +16,13 @@ help() {
Options:
-h, --help show this message
+ CONTENT a literal string to be prefixed
- Read URL from STDIN and adds the FQDN prefix. Meant to be used
- in conjunction with `url-for`.
+
+ Add domain prefix to build a full URL. If CONTENT is not given,
+ get data from STDIN.
+
+ Usually used in conjunction with url-for(1).
Examples:
@@ -27,6 +31,12 @@ help() {
$ url-for 'static/style.css' | absolute
https://euandre.org/static/style.css
+
+
+ Get the absolute variant of a relative URL:
+
+ $ absolute "$homepage_url"
+ https://euandre.org/pt/
EOF
}
@@ -64,4 +74,16 @@ shift $((OPTIND - 1))
. src/lib/base.conf
-printf 'https://%s%s' "$domain" "$(cat)"
+
+prefix() {
+ sed "s|^/\?|https://$domain/|"
+}
+
+
+if [ $# = 0 ]; then
+ prefix
+else
+ for s in "$@"; do
+ printf '%s\n' "$s" | prefix
+ done
+fi
diff --git a/v2/src/bin/categories b/v2/src/bin/categories
new file mode 100755
index 0000000..bc08704
--- /dev/null
+++ b/v2/src/bin/categories
@@ -0,0 +1,80 @@
+#!/bin/sh
+set -eu
+
+usage() {
+ cat <<-'EOF'
+ Usage:
+ categories FILENAME
+ categories -h
+ EOF
+}
+
+help() {
+ cat <<-'EOF'
+ Options:
+ -h, --help show this message
+
+ FILENAME the target categories index to be built
+
+
+ Generate FILENAME as the indexed list of articles by category.
+
+
+ Examples:
+
+ Generate the index.categories entry for english pastebins:
+
+ $ categories src/en/pastebins/index.categories
+ EOF
+}
+
+
+for flag in "$@"; do
+ case "$flag" in
+ --)
+ break
+ ;;
+ --help)
+ usage
+ help
+ exit
+ ;;
+ *)
+ ;;
+ esac
+done
+
+while getopts 'h' flag; do
+ case "$flag" in
+ h)
+ usage
+ help
+ exit
+ ;;
+ *)
+ usage >&2
+ exit 2
+ ;;
+ esac
+done
+shift $((OPTIND - 1))
+
+. src/lib.sh
+
+FILENAME="${1:-}"
+eval "$(assert_arg "$FILENAME" 'FILENAME')"
+DIR="$(dirname "$FILENAME")"
+
+
+mkdir -p "$DIR"
+printf '' > "$FILENAME"
+find "$DIR"/*.categorysort 2>/dev/null |
+ awk -F. '{ print $(NF-1) }' |
+ sort |
+ uniq |
+ while read -r category; do
+ find "$DIR"/*."$category".categorysort |
+ sort -nr |
+ xargs cat > "$DIR/$category.category"
+ printf '%s\n' "$category" >> "$FILENAME"
+ done
diff --git a/v2/src/bin/category b/v2/src/bin/category
new file mode 100755
index 0000000..2a2fdea
--- /dev/null
+++ b/v2/src/bin/category
@@ -0,0 +1,80 @@
+#!/bin/sh
+set -eu
+
+usage() {
+ cat <<-'EOF'
+ Usage:
+ category FILENAME
+ html -h
+ EOF
+}
+
+help() {
+ cat <<-'EOF'
+
+
+ Options:
+ -h, --help show this message
+
+ FILENAME the name of the input file .md file
+
+
+ Process the FILENAME, and generate a the derived category files.
+
+
+ Examples:
+
+ Generate the categories for a pastebin:
+
+ $ categories src/a-paste.md > src/a-paste.categoryentry
+ EOF
+}
+
+
+for f in "$@"; do
+ case "$f" in
+ --)
+ break
+ ;;
+ --help)
+ usage
+ help
+ exit
+ ;;
+ *)
+ ;;
+ esac
+done
+
+while getopts 'h' flag; do
+ case "$flag" in
+ h)
+ usage
+ help
+ exit
+ ;;
+ *)
+ usage >&2
+ exit 2
+ ;;
+ esac
+done
+shift $((OPTIND - 1))
+
+. src/lib.sh
+
+FILENAME="${1:-}"
+eval "$(assert_arg "$FILENAME" 'FILENAME')"
+
+
+# shellcheck source=/dev/null
+. "${FILENAME%.md}.conf"
+DIR="$(dirname "$FILENAME")"
+
+
+
+echo "${categories:-}" | tr ' ' '\n' | grep . | while read -r category; do
+ echo "$FILENAME" > "$DIR/${date_iso:?}.$category.categorysort"
+done
+
+envsubst < src/lib/category.html
diff --git a/v2/src/bin/collection-for b/v2/src/bin/collection-for
new file mode 100755
index 0000000..b3fc211
--- /dev/null
+++ b/v2/src/bin/collection-for
@@ -0,0 +1,83 @@
+#!/bin/sh
+set -eu
+
+usage() {
+ cat <<-'EOF'
+ Usage:
+ collection-for FILE
+ collection-for -h
+ EOF
+}
+
+help() {
+ cat <<-'EOF'
+
+
+ Options:
+ -h, --help show this message
+
+ FILE the path of the file to get the collection for
+
+
+ Say the collection of the given file, using the path of FILE.
+
+
+ Examples:
+
+ Get "tils" for "src/en/tils/some-pt.md":
+
+ $ collection-for src/en/tils/some-pt.md
+ tils
+ EOF
+}
+
+
+for flag in "$@"; do
+ case "$flag" in
+ --)
+ break
+ ;;
+ --help)
+ usage
+ help
+ exit
+ ;;
+ *)
+ ;;
+ esac
+done
+
+while getopts 'h' flag; do
+ case "$flag" in
+ h)
+ usage
+ help
+ exit
+ ;;
+ *)
+ usage >&2
+ exit 2
+ ;;
+ esac
+done
+shift $((OPTIND - 1))
+
+. src/lib.sh
+
+
+FILE="${1:-}"
+eval "$(assert_arg "$FILE" 'FILE')"
+
+
+# echo "${FILE#"$CONTENT_PREFIX"/}" | cut -d/ -f1
+# echo "${FILE#"$CONTENT_PREFIX"/}" | awk '{
+ # awk -F/ '$3 && $0=$2 { print; next } $0'
+
+ATTEMPT="$(echo "${FILE#"$CONTENT_PREFIX"/}" | cut -d/ -f2-)"
+
+if [ "$ATTEMPT" = 'index.html' ]; then
+ echo articles
+else
+ NAME="$(echo "$ATTEMPT" | cut -d/ -f1)"
+ collections | grep "$NAME"
+fi
diff --git a/v2/src/bin/conf b/v2/src/bin/conf
index 5717039..62ef97a 100755
--- a/v2/src/bin/conf
+++ b/v2/src/bin/conf
@@ -5,7 +5,7 @@ set -eu
usage() {
cat <<-'EOF'
Usage:
- conf FILENAME
+ conf [FILENAME]
conf -h
EOF
}
@@ -21,7 +21,8 @@ help() {
Separate the content from the "frontmatter", and emit the
- selected one, given the FILENAME.
+ selected one, given the FILENAME. If FILENAME is not given,
+ generate the global config.
Examples:
@@ -65,11 +66,36 @@ shift $((OPTIND - 1))
. src/lib.sh
+
FILENAME="${1:-}"
-eval "$(assert_arg "$FILENAME" 'FILENAME')"
+if [ -z "$FILENAME" ]; then
+ printf 'export style_url="%s"\n' "$(url-for 'style.css')"
+ printf 'export pubkey_url="%s"\n' "$(url-for 'public.asc.txt')"
+ printf 'export pubkey_id="%s"\n' "$(
+ LANG=C.UTF-8 gpg --list-key "$EMAIL" |
+ awk 'NR==2 { print substr($1, length($1) - 15) }' |
+ shesc
+ )"
+
+ for f in "$CONTENT_PREFIX"/img/*.svg; do
+ name="$(basename "$f" .svg | sed 's|-|_|g')"
+ printf 'export icon_%s_url="%s"\n' "$name" "$(url-for "img/$(basename "$f")")"
+ done
+ for l in $(langs); do
+ for f in "$CONTENT_PREFIX"/img/*.svg; do
+ name="$(basename "$f" .svg | sed 's|-|_|g')"
+ printf 'export icon_%s_alt="%s"\n' "$name" "$(shesc < "$CONTENT_PREFIX/img/alt/$(basename "$f" .svg).$l.txt" )"
+ done > src/lib/generated."$l".conf
+ done
+ exit
+fi
+
+lang="$(lang-for "$FILENAME")"
+export lang
-tee "$FILENAME".tmp < src/lib/base.conf
+cat src/lib/base.conf src/lib/generated.conf src/lib/generated."$lang".conf |
+ tee "$FILENAME".tmp
DELIMITER=0
while read -r line; do
if [ "$line" = '---' ]; then
@@ -92,14 +118,17 @@ done < "$FILENAME" | tee -a "$FILENAME".tmp
rm -f "$FILENAME".tmp
+collection="$(collection-for "$FILENAME" ||:)"
+if [ -n "$collection" ]; then
+ export collection
+ printf 'export collection="%s"\n' "$collection"
+fi
+
if [ -z "${layout:-}" ]; then
- if [ "$(dirname "$(dirname "$FILENAME")")" = "$CONTENT_PREFIX" ]; then
+ if [ -z "$collection" ]; then
layout=page
else
layout=post
- collection="$(basename "$(dirname "$FILENAME")")"
- export collection
- printf 'export collection="%s"\n' "$collection"
custom_layout="$(echo "$LAYOUTS" | grep . |
awk -v coll="$collection" '$1 == coll { print $2 }'
@@ -131,10 +160,10 @@ if [ -n "${date:-}" ]; then
formatted_date="$(LANG="$lang" date -ud "${date:?}" +"${date_fmt:?}")"
export formatted_date
+ printf 'export formatted_date_html="%s"\n' "$(htmlesc "$formatted_date" | shesc)"
printf 'export date_html="%s"\n' "$(envsubst < src/lib/date."$lang".html | shesc)"
- echo "${FILENAME%.md}.xmlentry" > "$(dirname "$FILENAME")/$date_iso.sortdata"
- touch "${FILENAME%.md}.sortref"
+ echo "$FILENAME" > "$(dirname "$FILENAME")/$date_iso.sortdata"
fi
if [ -n "${update:-}" ]; then
@@ -149,31 +178,19 @@ if [ -n "${update:-}" ]; then
fi
-url_part="$(printf '%s' "${FILENAME%.md}.html" | sed "s|^$CONTENT_PREFIX||")"
+url_part="$(printf '%s' "${FILENAME%.md}.html" | sed "s|^$CONTENT_PREFIX/||")"
+url="$(url-for "$url_part")"
title_uri="$(uri "$title")"
printf 'export title_html="%s"\n' "$(printf '%s' "$title" | htmlesc | shesc)"
printf 'export filename="%s"\n' "$FILENAME"
printf 'export url_part="%s"\n' "$url_part"
-printf 'export url="%s"\n' "$(url-for "$url_part" | absolute)"
+printf 'export url="%s"\n' "$url"
+printf 'export url_absolute="%s"\n' "$(absolute "$url")"
printf 'export mailto_uri="%s%s"\n' "${mailto_uri_prefix:?}" "$title_uri"
printf 'export discussions_url="%s%s"\n' "${discussions_url_prefix:?}" "$title_uri"
printf 'export sourcecode_url="%s%s"\n' "${sourcecode_url_prefix:?}" "$FILENAME"
-printf 'export style_url="%s"\n' "$(url-for 'style.css')"
-printf 'export favicon_url="%s"\n' "$(url-for 'favicon.svg')"
-printf 'export pubkey_url="%s"\n' "$(url-for 'public.asc.txt')"
-
-for f in "$CONTENT_PREFIX"/img/*.svg; do
- name="$(basename "$f" .svg | sed 's|-|_|g')"
- printf 'export icon_%s_url="%s"\n' "$name" "$(url-for "img/$(basename "$f")")"
-done
-
-# FIXME: special treatment of root
-printf 'export homepage_url="%s"\n' "$(url-for '/')"
-
-printf 'export about_url="%s"\n' "$(url-for "${about_url_name:?}")"
-
if [ "${layout:-}" = 'post' ]; then
export mailto_uri="$mailto_uri_prefix$title_uri"
diff --git a/v2/src/bin/feed b/v2/src/bin/feed
index 0488c86..52c6199 100755
--- a/v2/src/bin/feed
+++ b/v2/src/bin/feed
@@ -27,7 +27,7 @@ help() {
Generate a feed for TILs:
- $ feed src/en/feeds/til.xml
+ $ feed src/en/tils/feed.xml
EOF
}
@@ -68,24 +68,44 @@ FILENAME="${1:-}"
eval "$(assert_arg "$FILENAME" 'FILENAME')"
-COLLECTION="$(basename "$FILENAME" '.xml')"
-LANGUAGE="$(lang-for "$FILENAME")"
-DIR="$(dirname "$(dirname "$FILENAME")")/$COLLECTION"
-
-
. src/lib/base.conf
# shellcheck source=/dev/null
-. src/lib/base."$LANGUAGE".conf
+. src/lib/base."$(lang-for "$FILENAME")".conf
+
now="$(date -uIs)"
-url="$(url-for "${FILENAME#"$CONTENT_PREFIX"}" | absolute)"
+url_absolute="$(url-for "${FILENAME#"$CONTENT_PREFIX"/}" | absolute)"
site_name_html="$(htmlesc "${site_name:?}")"
-export now url site_name_html
+collection="$(collection-for "$FILENAME")"
+collection_url_absolute="$(url-for "${lang:?}/$collection/" | absolute)"
+feed_title_html="$(eval "echo \"\$feed_${collection}_title\"" | htmlesc)"
+export now url_absolute site_name_html collection_url_absolute feed_title_html
-
-mkdir -p "$(dirname "$FILENAME")"
+DIR="$(dirname "$FILENAME")"
+mkdir -p "$DIR"
{
envsubst < src/lib/feed.xml
- find "$DIR"/*.sortdata 2>/dev/null | sort -nr | xargs cat | xargs cat
+ find "$DIR"/*.sortdata 2>/dev/null |
+ sort -nr |
+ xargs cat |
+ sed 's|\.md$|.xmlentry|' |
+ xargs cat
printf '\n'
} > "$FILENAME"
+
+printf '' > "$DIR"/index.extrafeeds
+while read -r category; do
+ url_absolute="$(url-for "${DIR#"$CONTENT_PREFIX"/}/feed.$category.xml" | absolute)"
+ collection_url_absolute="$(url-for "${DIR#"$CONTENT_PREFIX"/}/${by_category_url_part:?}#$category" | absolute)"
+ feed_title_html="$(eval "echo \"\$index_category_${collection}_title\"" | htmlesc)"
+ export url_absolute collection_url_absolute feed_title_html
+
+ {
+ envsubst < src/lib/feed.xml
+ < "$DIR/$category.category" \
+ sed 's|\.md$|.xmlentry|' |
+ xargs cat
+ printf '\n'
+ } > "$DIR/feed.$category.xml"
+ echo "$DIR/feed.$category.xml" >> "$DIR"/index.extrafeeds
+done < "$DIR"/index.categories
diff --git a/v2/src/bin/index b/v2/src/bin/index
new file mode 100755
index 0000000..36750b3
--- /dev/null
+++ b/v2/src/bin/index
@@ -0,0 +1,128 @@
+#!/bin/sh
+set -eu
+
+usage() {
+ cat <<-'EOF'
+ Usage:
+ collection FILENAME
+ collection -h
+ EOF
+}
+
+help() {
+ cat <<-'EOF'
+ Options:
+ -h, --help show this message
+
+ FILENAME the target collection HTML page to be generated
+
+
+ Generate FILENAME as a collection index. The collection type
+ and language are inferred by the name of FILENAME.
+
+
+ Examples:
+
+ Generate an index.html entry for english pastebins:
+
+ $ collection src/en/pastebins/index.html
+ EOF
+}
+
+
+for flag in "$@"; do
+ case "$flag" in
+ --)
+ break
+ ;;
+ --help)
+ usage
+ help
+ exit
+ ;;
+ *)
+ ;;
+ esac
+done
+
+while getopts 'h' flag; do
+ case "$flag" in
+ h)
+ usage
+ help
+ exit
+ ;;
+ *)
+ usage >&2
+ exit 2
+ ;;
+ esac
+done
+shift $((OPTIND - 1))
+
+. src/lib.sh
+
+FILENAME="${1:-}"
+eval "$(assert_arg "$FILENAME" 'FILENAME')"
+DIR="$(dirname "$FILENAME")"
+
+
+l="$(lang-for "$FILENAME")"
+. src/lib/base.conf
+. src/lib/generated.conf
+# shellcheck source=/dev/null
+. src/lib/generated."$l".conf
+# shellcheck source=/dev/null
+. src/lib/base."$l".conf
+
+url_part="$(printf '%s' "${FILENAME#"$CONTENT_PREFIX"/}" | sed "s|\.md$|.html|")"
+url_absolute="$(url-for "$url_part" | absolute)"
+collection="$(collection-for "$FILENAME")"
+feed_url="$(url-for "${DIR#"$CONTENT_PREFIX"/}"/feed.xml)"
+by_category_url="$(url-for "${DIR#"$CONTENT_PREFIX"/}/${by_category_url_part:?}")"
+title_html="$(eval "echo \"\$index_${collection}_title\"" | htmlesc)"
+index_recent_title_html="$(eval "echo \"\$index_recent_${collection}_title\"" | htmlesc)"
+index_category_title_html="$(eval "echo \"\$index_category_${collection}_title\"" | htmlesc)"
+export url_absolute feed_url by_category_url title_html index_recent_title_html \
+ index_category_title_html
+
+
+
+mkdir -p "$DIR"
+{
+ cat src/lib/preamble.html src/lib/index-preamble.html | envsubst
+ find "$DIR"/*.sortdata 2>/dev/null |
+ sort -nr |
+ xargs cat |
+ sed 's|\.md$|.indexentry|' |
+ xargs cat
+ cat src/lib/index-postamble.html src/lib/postamble.html | envsubst
+} > "$FILENAME"
+
+
+CATEGORY_FILENAME="$CONTENT_PREFIX$by_category_url"
+echo "$CATEGORY_FILENAME" > "${FILENAME%.html}.extrahtml"
+
+url_absolute="$(absolute "$by_category_url")"
+title_html="$(eval "echo \"\$index_category_${collection}_title\"" | htmlesc)"
+export url_absolute title_html
+
+
+DIR="$(dirname "$CATEGORY_FILENAME")"
+mkdir -p "$DIR"
+{
+ envsubst < src/lib/preamble.html
+ while read -r category; do
+ feed_url="$(url-for "${DIR#"$CONTENT_PREFIX"/}/feed.$category.xml")"
+ index_recent_title_html="$category"
+ export category feed_url index_recent_title_html
+
+ envsubst < src/lib/category-header.html
+ echo ' '
+ < "$DIR/$category.category" \
+ sed 's|\.md$|.categoryentry|' |
+ xargs cat
+ echo '
'
+ done < "$DIR"/index.categories
+ envsubst < src/lib/postamble.html
+} > "$CATEGORY_FILENAME"
diff --git a/v2/src/bin/indexentry b/v2/src/bin/indexentry
new file mode 100755
index 0000000..03bf771
--- /dev/null
+++ b/v2/src/bin/indexentry
@@ -0,0 +1,73 @@
+#!/bin/sh
+set -eu
+
+usage() {
+ cat <<-'EOF'
+ Usage:
+ indexentry FILENAME
+ indexentry -h
+ EOF
+}
+
+help() {
+ cat <<-'EOF'
+
+
+ Options:
+ -h, --help show this message
+
+ FILENAME the name of the input .md file
+
+
+ Process FILE, and generate an index collection entry.
+
+
+ Examples:
+
+ Generate the index entry for a TIL:
+
+ $ indexentry src/tils/a-til.md > src/tils/a-til.indexentry
+ EOF
+}
+
+
+for flag in "$@"; do
+ case "$flag" in
+ --)
+ break
+ ;;
+ --help)
+ usage
+ help
+ exit
+ ;;
+ *)
+ ;;
+ esac
+done
+
+while getopts 'h' flag; do
+ case "$flag" in
+ h)
+ usage
+ help
+ exit
+ ;;
+ *)
+ usage >&2
+ exit 2
+ ;;
+ esac
+done
+shift $((OPTIND - 1))
+
+. src/lib.sh
+
+FILENAME="${1:-}"
+eval "$(assert_arg "$FILENAME" 'FILENAME')"
+
+
+# shellcheck source=/dev/null
+. "${FILENAME%.md}.conf"
+
+envsubst < src/lib/entry.html
diff --git a/v2/src/bin/makemake b/v2/src/bin/makemake
index 665bb84..20fd6dd 100755
--- a/v2/src/bin/makemake
+++ b/v2/src/bin/makemake
@@ -74,7 +74,8 @@ EXTENSIONS='
'
COLL_EXTENSIONS='
-.sortref
+.categoryentry
+.indexentry
.xmlentry
'
@@ -116,16 +117,20 @@ for lang in $(langs); do
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/'
+ mds | sed 's/^\(.*\)\.md$/\1.categoryentry \1.indexentry \1.html: \1.conf \1.content/'
+ mds | sed 's/^\(.*\)\.md$/\1.snippets \1.htmlbody: \1.html/'
if [ "$c" = 'pages' ]; then
continue
fi
- mds | sed 's/^\(.*\)\.md$/\1.sortref: \1.md/'
- mds | sed 's/^\(.*\)\.md$/\1.xmlentry: \1.html/'
+ mds | sed 's/^\(.*\)\.md$/\1.xmlentry: \1.htmlbody/'
- echo "$CONTENT_PREFIX/$lang/feeds/$c.xml: \$($c.$lang.xmlentry)"
+ echo "$CONTENT_PREFIX/$lang/$c/index.categories: \$($c.$lang.categoryentry)"
+ echo "$CONTENT_PREFIX/$lang/$c/index.html: \$($c.$lang.indexentry) $CONTENT_PREFIX/$lang/$c/index.categories"
+ echo "$CONTENT_PREFIX/$lang/$c/feed.xml: \$($c.$lang.xmlentry) $CONTENT_PREFIX/$lang/$c/index.categories"
+ echo "$CONTENT_PREFIX/$lang/$c/index.extrahtml: $CONTENT_PREFIX/$lang/$c/index.html"
+ echo "$CONTENT_PREFIX/$lang/$c/index.extrafeeds: $CONTENT_PREFIX/$lang/$c/feed.xml"
printf '\n\n'
done
@@ -141,17 +146,33 @@ for lang in $(langs); do
done
collections |
- sed "s|^\(.*\)\$|$CONTENT_PREFIX/$lang/feeds/\1.xml|" |
+ sed "s|^\(.*\)\$|$CONTENT_PREFIX/$lang/\1/index.categories|" |
+ varlist "all-generated.$lang.categories"
+
+ collections |
+ sed "s|^\(.*\)\$|$CONTENT_PREFIX/$lang/\1/index.extrahtml|" |
+ varlist "all-generated.$lang.extrahtml"
+
+ collections |
+ sed "s|^\(.*\)\$|$CONTENT_PREFIX/$lang/\1/index.extrafeeds|" |
+ varlist "all-generated.$lang.extrafeeds"
+
+ collections |
+ sed "s|^\(.*\)\$|$CONTENT_PREFIX/$lang/\1/index.html|" |
+ varlist "all-generated.$lang.index"
+
+ collections |
+ sed "s|^\(.*\)\$|$CONTENT_PREFIX/$lang/\1/feed.xml|" |
varlist "all-generated.$lang.xml"
- extensions '.xml' |
+ extensions '.categories' '.extrahtml' '.extrafeeds' '.index' '.xml' |
sed "s|^\(.*\)\$|\$(all-generated.$lang\1)|" |
varlist "all-generated.$lang"
printf '\n'
done
-for e in $(extensions .xml); do
+for e in $(extensions '.categories' '.extrahtml' '.extrafeeds' '.index' '.xml'); do
langs |
sed "s|^\(.*\)\$|\$(all-generated.\1$e)|" |
varlist "all-generated$e"
diff --git a/v2/src/content/en/pastebins/raku-tuple-type-annotation.md b/v2/src/content/en/pastebins/raku-tuple-type-annotation.md
index 5877470..6c13b39 100644
--- a/v2/src/content/en/pastebins/raku-tuple-type-annotation.md
+++ b/v2/src/content/en/pastebins/raku-tuple-type-annotation.md
@@ -4,6 +4,8 @@ title: Raku tuple type annotation
date: 2019-12-29
+categories: raku programming-languages
+
---
```perl
diff --git a/v2/src/content/en/pastebins/sicp-exercise-3-19.md b/v2/src/content/en/pastebins/sicp-exercise-3-19.md
index 3188dce..32f7aa9 100644
--- a/v2/src/content/en/pastebins/sicp-exercise-3-19.md
+++ b/v2/src/content/en/pastebins/sicp-exercise-3-19.md
@@ -4,6 +4,8 @@ title: SICP exercise 3.19
date: 2021-09-02
+categories: lisp programming-languages
+
---
Some content here, before:
diff --git a/v2/src/content/en/tils/lisp-three-way-conditional.md b/v2/src/content/en/tils/lisp-three-way-conditional.md
index cd7a034..20fbd09 100644
--- a/v2/src/content/en/tils/lisp-three-way-conditional.md
+++ b/v2/src/content/en/tils/lisp-three-way-conditional.md
@@ -6,6 +6,8 @@ date: 2021-04-24 3
update: 2021-08-14
+categories: lisp scheme common-lisp
+
---
A useful macro from Paul Graham's [On Lisp][on-lisp] book:
diff --git a/v2/src/content/favicon.svg b/v2/src/content/favicon.svg
deleted file mode 100644
index ce566b2..0000000
--- a/v2/src/content/favicon.svg
+++ /dev/null
@@ -1,62 +0,0 @@
-
-
diff --git a/v2/src/content/img/alt/atom.en.txt b/v2/src/content/img/alt/atom.en.txt
new file mode 100644
index 0000000..33bc955
--- /dev/null
+++ b/v2/src/content/img/alt/atom.en.txt
@@ -0,0 +1 @@
+three yellow lines representing an Atom feed
diff --git a/v2/src/content/img/alt/atom.pt.txt b/v2/src/content/img/alt/atom.pt.txt
new file mode 100644
index 0000000..33bc955
--- /dev/null
+++ b/v2/src/content/img/alt/atom.pt.txt
@@ -0,0 +1 @@
+three yellow lines representing an Atom feed
diff --git a/v2/src/content/img/alt/envelope.en.txt b/v2/src/content/img/alt/envelope.en.txt
new file mode 100644
index 0000000..8b72080
--- /dev/null
+++ b/v2/src/content/img/alt/envelope.en.txt
@@ -0,0 +1 @@
+an envelope icon representing an email address
diff --git a/v2/src/content/img/alt/envelope.pt.txt b/v2/src/content/img/alt/envelope.pt.txt
new file mode 100644
index 0000000..8b72080
--- /dev/null
+++ b/v2/src/content/img/alt/envelope.pt.txt
@@ -0,0 +1 @@
+an envelope icon representing an email address
diff --git a/v2/src/content/img/alt/favicon.en.txt b/v2/src/content/img/alt/favicon.en.txt
new file mode 100644
index 0000000..add8557
--- /dev/null
+++ b/v2/src/content/img/alt/favicon.en.txt
@@ -0,0 +1 @@
+a crude hand doing a thumbs up
diff --git a/v2/src/content/img/alt/favicon.pt.txt b/v2/src/content/img/alt/favicon.pt.txt
new file mode 100644
index 0000000..add8557
--- /dev/null
+++ b/v2/src/content/img/alt/favicon.pt.txt
@@ -0,0 +1 @@
+a crude hand doing a thumbs up
diff --git a/v2/src/content/img/alt/link.en.txt b/v2/src/content/img/alt/link.en.txt
new file mode 100644
index 0000000..bbf036f
--- /dev/null
+++ b/v2/src/content/img/alt/link.en.txt
@@ -0,0 +1 @@
+two chain rings, representing an anchor to this header
diff --git a/v2/src/content/img/alt/link.pt.txt b/v2/src/content/img/alt/link.pt.txt
new file mode 100644
index 0000000..bbf036f
--- /dev/null
+++ b/v2/src/content/img/alt/link.pt.txt
@@ -0,0 +1 @@
+two chain rings, representing an anchor to this header
diff --git a/v2/src/content/img/alt/linkto.en.txt b/v2/src/content/img/alt/linkto.en.txt
new file mode 100644
index 0000000..a192899
--- /dev/null
+++ b/v2/src/content/img/alt/linkto.en.txt
@@ -0,0 +1 @@
+a drawing of a box with an arrow going outwards, representing an internal link
diff --git a/v2/src/content/img/alt/linkto.pt.txt b/v2/src/content/img/alt/linkto.pt.txt
new file mode 100644
index 0000000..df3bbf7
--- /dev/null
+++ b/v2/src/content/img/alt/linkto.pt.txt
@@ -0,0 +1,2 @@
+a drawing of a box with an arrow going outwards, representing an internal
+link
diff --git a/v2/src/content/img/alt/lock.en.txt b/v2/src/content/img/alt/lock.en.txt
new file mode 100644
index 0000000..b809247
--- /dev/null
+++ b/v2/src/content/img/alt/lock.en.txt
@@ -0,0 +1 @@
+a lock icon representing a GPG public key
diff --git a/v2/src/content/img/alt/lock.pt.txt b/v2/src/content/img/alt/lock.pt.txt
new file mode 100644
index 0000000..b809247
--- /dev/null
+++ b/v2/src/content/img/alt/lock.pt.txt
@@ -0,0 +1 @@
+a lock icon representing a GPG public key
diff --git a/v2/src/content/img/atom.svg b/v2/src/content/img/atom.svg
new file mode 100644
index 0000000..37bace2
--- /dev/null
+++ b/v2/src/content/img/atom.svg
@@ -0,0 +1,5 @@
+
+
diff --git a/v2/src/content/img/favicon.svg b/v2/src/content/img/favicon.svg
new file mode 100644
index 0000000..ce566b2
--- /dev/null
+++ b/v2/src/content/img/favicon.svg
@@ -0,0 +1,62 @@
+
+
diff --git a/v2/src/content/img/linkto.svg b/v2/src/content/img/linkto.svg
new file mode 100644
index 0000000..d4d9fe1
--- /dev/null
+++ b/v2/src/content/img/linkto.svg
@@ -0,0 +1,7 @@
+
+
diff --git a/v2/src/content/pt/pastebins/exercicios-sicp-e-19.md b/v2/src/content/pt/pastebins/exercicios-sicp-e-19.md
index d4db88d..89dacfd 100644
--- a/v2/src/content/pt/pastebins/exercicios-sicp-e-19.md
+++ b/v2/src/content/pt/pastebins/exercicios-sicp-e-19.md
@@ -4,6 +4,8 @@ title: SICP exercise 3.19
date: 2021-09-02
+categories: lisp programming-languages
+
---
Some content here, before:
diff --git a/v2/src/content/security.txt b/v2/src/content/security.txt
deleted file mode 120000
index abdf74b..0000000
--- a/v2/src/content/security.txt
+++ /dev/null
@@ -1 +0,0 @@
-.well-known/security.txt
\ No newline at end of file
diff --git a/v2/src/lib/base.conf b/v2/src/lib/base.conf
index 319d08c..72f70b9 100644
--- a/v2/src/lib/base.conf
+++ b/v2/src/lib/base.conf
@@ -6,4 +6,3 @@ export mailto_uri_prefix="mailto:$list_addr?Subject=Re%3A%20"
export discussions_url_prefix="https://lists.sr.ht/~euandreh/public-inbox?search="
export sourcecode_url_prefix="https://$domain/git/$domain/tree/"
export author='EuAndreh'
-export pubkey_id='81F90EC3CD356060' # FIXME
diff --git a/v2/src/lib/base.en.conf b/v2/src/lib/base.en.conf
index 52aede3..5ced00a 100644
--- a/v2/src/lib/base.en.conf
+++ b/v2/src/lib/base.en.conf
@@ -2,6 +2,32 @@ export date_fmt='%B %-d, %Y'
export site_name="EuAndreh's website"
+export lang='en'
+
+export index_pastebins_title='Pastebins'
+
+export index_recent_pastebins_title='Pastebins listing'
+
+export index_category_pastebins_title='Pastebins by category'
+
+export index by_category_url_part='by-category.html'
+
+export feed_pastebins_title="EuAndreh's pastebins"
+
+export index_tils_title='TIL'
+
+export index_recent_tils_title='TIL listing'
+
+export index_category_tils_title='TIL by category'
+
+export feed_tils_title="EuAndreh's TIL"
+
export about='About'
export about_url_name='about.html'
+
+export homepage_url="$(url-for "$lang/")"
+
+export homepage_url_absolute="$(absolute "$homepage_url")"
+
+export about_url="$(url-for "$lang/$about_url_name")"
diff --git a/v2/src/lib/base.pt.conf b/v2/src/lib/base.pt.conf
index 52aede3..fe03f42 100644
--- a/v2/src/lib/base.pt.conf
+++ b/v2/src/lib/base.pt.conf
@@ -2,6 +2,32 @@ export date_fmt='%B %-d, %Y'
export site_name="EuAndreh's website"
+export lang='pt'
+
+export index_pastebins_title='Pastebins'
+
+export index_recent_pastebins_title='Pastebins listing'
+
+export index_category_pastebins_title='Pastebins by category'
+
+export index by_category_url_part='by-category.html'
+
+export feed_pastebins_title="EuAndreh's pastebins"
+
+export index_tils_title='TIL'
+
+export index_recent_tils_title='TIL listing'
+
+export index_category_tils_title='TIL by category'
+
+export feed_tils_title="EuAndreh's TIL"
+
export about='About'
export about_url_name='about.html'
+
+export homepage_url="$(url-for "$lang/")"
+
+export homepage_url_absolute="$(absolute "$homepage_url")"
+
+export about_url="$(url-for "$lang/$about_url_name")"
diff --git a/v2/src/lib/category-header.html b/v2/src/lib/category-header.html
new file mode 100755
index 0000000..a69b198
--- /dev/null
+++ b/v2/src/lib/category-header.html
@@ -0,0 +1,6 @@
+
diff --git a/v2/src/lib/category.html b/v2/src/lib/category.html
new file mode 100644
index 0000000..172829b
--- /dev/null
+++ b/v2/src/lib/category.html
@@ -0,0 +1,3 @@
+
+ $title_html - $formatted_date_html
+
diff --git a/v2/src/lib/entry.html b/v2/src/lib/entry.html
new file mode 100644
index 0000000..cbab9c0
--- /dev/null
+++ b/v2/src/lib/entry.html
@@ -0,0 +1,5 @@
+
+ $formatted_date_html
+
+ $title_html
+
diff --git a/v2/src/lib/entry.xml b/v2/src/lib/entry.xml
index e4a47c7..b43b238 100644
--- a/v2/src/lib/entry.xml
+++ b/v2/src/lib/entry.xml
@@ -2,13 +2,13 @@
$title_html
-
+
$date_iso
$update_xml
- $url
+ $url_absolute
diff --git a/v2/src/lib/feed.xml b/v2/src/lib/feed.xml
index 6fd82a4..8e70e98 100644
--- a/v2/src/lib/feed.xml
+++ b/v2/src/lib/feed.xml
@@ -2,11 +2,11 @@
xmlns="http://www.w3.org/2005/Atom"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xml:lang="$lang">
-
-
+
+
$site_name_html
- {{ site.t[include.kind].feed.title[include.lang] | smartify | xml_escape }}
- $url
+ $feed_title_html
+ $url_absolute
$now
diff --git a/v2/src/lib/index-postamble.html b/v2/src/lib/index-postamble.html
new file mode 100755
index 0000000..92ebbf2
--- /dev/null
+++ b/v2/src/lib/index-postamble.html
@@ -0,0 +1,8 @@
+
+
+
diff --git a/v2/src/lib/index-preamble.html b/v2/src/lib/index-preamble.html
new file mode 100755
index 0000000..2c17031
--- /dev/null
+++ b/v2/src/lib/index-preamble.html
@@ -0,0 +1,7 @@
+
+ $index_recent_title_html
+
+
+
+
+
diff --git a/v2/src/lib/postamble.html b/v2/src/lib/postamble.html
index 00dc1dc..e55666d 100644
--- a/v2/src/lib/postamble.html
+++ b/v2/src/lib/postamble.html
@@ -5,16 +5,20 @@ $comment_html
- The content for this site is licensed under CC BY-SA 4.0. The code is AGPLv3 or later. Patches welcome.
+ The content for this site is licensed under
+ CC BY-SA 4.0.
+ The code is
+ AGPLv3 or later.
+ Patches welcome.
diff --git a/v2/src/redirect.mappings b/v2/src/redirect.mappings
index 6945e89..6701b19 100644
--- a/v2/src/redirect.mappings
+++ b/v2/src/redirect.mappings
@@ -1 +1,3 @@
index.html en/index.html
+favicon.svg img/favicon.svg
+security.txt .well-known/security.txt
--
cgit v1.2.3