aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2020-11-14 13:50:00 -0300
committerEuAndreh <eu@euandre.org>2020-11-14 13:51:08 -0300
commitfb6c91068a544d7958edad8786563a511107a97d (patch)
treefcdbe0998cc6e9a80f7f22421178bdafe9d2057f
parentGenerate feed files for all collections and languages (diff)
downloadeuandre.org-fb6c91068a544d7958edad8786563a511107a97d.tar.gz
euandre.org-fb6c91068a544d7958edad8786563a511107a97d.tar.xz
assert-content.sh: Filter out all .atom files
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}"