From 191728a2cac217e96a7f1e4e9a4710606f6ad920 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 12 Aug 2020 06:34:38 -0300 Subject: Add TILs section, with Atom support and i18n - add i18n logic to support translated TIL entries and listing; - make the website title less tied to a blog: "EuAndreh::blog" -> EuAndreh; - remove old Atom feed link aliases; - remove feed.all.atom and it's link in the about page; - create Atom feed for TIL entries; - show blog and TIL Atom feed on their listing pages (index and tils-listing); - add root alias: / -> /en/ - remove explicit list of feeds from $IGNORED_PAGES and use a '*.atom' glob instead; - also lint, assert-content and assert-unique-ref of TILs; - fix wrong "post.date" in pastebin entry in site.json; --- scripts/assert-content.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/assert-content.sh b/scripts/assert-content.sh index 7448c61..d83ec33 100755 --- a/scripts/assert-content.sh +++ b/scripts/assert-content.sh @@ -34,7 +34,8 @@ get-ref() { } get-url() { - echo "${1}" | base64 --decode | jq -r .url + # Remove leading / to match more closely the filesystem hierarchy + echo "${1}" | base64 --decode | jq -r .url | sed 's_^/__' } get-date() { @@ -69,7 +70,7 @@ for post in $(jq -r '.posts[] | @base64' "${JSON}"); do done echo Linting pages... >&2 -IGNORED_PAGES=(/site.json /sitemap.xml /rss.xml /atom.xml /feed.atom /feed.xml /feed.all.atom /feed.en.atom /feed.pt.atom) +IGNORED_PAGES=(site.json sitemap.xml *.atom) for page in $(jq -r '.pages[] | @base64' "${JSON}"); do URL="$(get-url "$page")" if ! contains-element "${URL}" "${IGNORED_PAGES[@]}"; then @@ -82,6 +83,11 @@ for pastebin in $(jq -r '.pastebins[] | @base64' "${JSON}"); do assert-frontmatter "$pastebin" done +echo Linting tils... >&2 +for til in $(jq -r '.tils[] | @base64' "${JSON}"); do + assert-frontmatter "$til" +done + echo Asserting unique refs... >&2 KNOWN_IDS=() assert-unique-ref() { @@ -96,6 +102,8 @@ assert-unique-ref() { printf '%s\n' "${KNOWN_IDS[@]}" red "Duplicated lang:ref match: '${ID}'." >&2 red "Page: ${URL}." >&2 + echo "$page" | base64 --decode | jq + exit 1 fi @@ -106,5 +114,6 @@ assert-unique-ref() { assert-unique-ref "$(jq -r '.pages[] | @base64' "${JSON}")" assert-unique-ref "$(jq -r '.posts[] | @base64' "${JSON}")" +assert-unique-ref "$(jq -r '.tils[] | @base64' "${JSON}")" echo Done. >&2 -- cgit v1.2.3