aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xscripts/assert-content.sh15
1 files changed, 12 insertions, 3 deletions
diff --git a/scripts/assert-content.sh b/scripts/assert-content.sh
index a832a23..7f5aa5f 100755
--- a/scripts/assert-content.sh
+++ b/scripts/assert-content.sh
@@ -12,7 +12,7 @@ jekyll build --future
JSON='_site/site.json'
LANGS=(en pt fr eo) # jp zh es de
-IGNORED_PAGES=(site.json sitemap.xml *.atom)
+IGNORED_PAGES=(site.json sitemap.xml)
## Helper function definitions
@@ -66,6 +66,15 @@ get-layout() {
echo "${1}" | base64 --decode | jq -r .layout
}
+is-ignored() {
+ URL="$1"
+ EXTENSION="${URL##*.}"
+ if contains-element "${URL}" "${IGNORED_PAGES[@]}" || [[ "$EXTENSION" == 'atom' ]]; then
+ return 0
+ else
+ return 1
+ fi
+}
## Assertions
@@ -133,7 +142,7 @@ done
echo Linting pages... >&2
for page in $(jq -r '.pages[] | @base64' "${JSON}"); do
URL="$(get-url "$page")"
- if ! contains-element "${URL}" "${IGNORED_PAGES[@]}"; then
+ if ! is-ignored "${URL}"; then
assert-frontmatter "${page}" 'page'
fi
done
@@ -159,7 +168,7 @@ assert-unique-ref() {
TYPE="$2"
for page in $1; do
URL="$(get-url "$page")"
- if ! contains-element "${URL}" "${IGNORED_PAGES[@]}"; then
+ if ! is-ignored "${URL}"; then
LLANG="$(get-lang "$page")"
REF="$(get-ref "$page")"
ID="${TYPE}:${LLANG}:${REF}"