diff options
Diffstat (limited to 'scripts/assert-content.sh')
-rwxr-xr-x | scripts/assert-content.sh | 13 |
1 files changed, 11 insertions, 2 deletions
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 |