aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2020-08-17 15:39:08 -0300
committerEuAndreh <eu@euandre.org>2020-08-17 15:39:08 -0300
commit37109100c380814e21e5d7cc244f1d17e5b8b638 (patch)
treed144b91fc8feb4108d2ae00ea0b91e2677caa76c /scripts
parentpublic-inbox.html: Simplify page footer. (diff)
downloadeuandre.org-37109100c380814e21e5d7cc244f1d17e5b8b638.tar.gz
euandre.org-37109100c380814e21e5d7cc244f1d17e5b8b638.tar.xz
assert-content.sh: Check that declared layout matches the folder
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/assert-content.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/scripts/assert-content.sh b/scripts/assert-content.sh
index ee028a6..da73e65 100755
--- a/scripts/assert-content.sh
+++ b/scripts/assert-content.sh
@@ -58,6 +58,10 @@ get-title() {
echo "${1}" | base64 --decode | jq -r .title
}
+get-layout() {
+ echo "${1}" | base64 --decode | jq -r .layout
+}
+
LANGS=(en pt fr)
IGNORED_PAGES=(site.json sitemap.xml *.atom)
@@ -144,4 +148,22 @@ 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 Asserting layouts... >&2
+assert-layout() {
+ DESIRED=$2
+ for p in $1; do
+ LAYOUT="$(get-layout "$p")"
+ URL="$(get-url "$p")"
+ if [[ "${DESIRED}" != "${LAYOUT}" ]]; then
+ red "Layout mismatch: expected '${DESIRED}', got '${LAYOUT}'."
+ red "Page: ${URL}."
+ # exit 1
+ fi
+ done
+}
+
+assert-layout "$(jq -r '.posts[] | @base64' "${JSON}")" "post"
+assert-layout "$(jq -r '.pastebins[] | @base64' "${JSON}")" "pastebin"
+assert-layout "$(jq -r '.tils[] | @base64' "${JSON}")" "til"
+
echo Done. >&2