diff options
author | EuAndreh <eu@euandre.org> | 2020-08-17 15:39:08 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2020-08-17 15:39:08 -0300 |
commit | 37109100c380814e21e5d7cc244f1d17e5b8b638 (patch) | |
tree | d144b91fc8feb4108d2ae00ea0b91e2677caa76c /scripts | |
parent | public-inbox.html: Simplify page footer. (diff) | |
download | euandre.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-x | scripts/assert-content.sh | 22 |
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 |