diff options
author | EuAndreh <eu@euandre.org> | 2020-11-14 13:50:00 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2020-11-14 13:51:08 -0300 |
commit | fb6c91068a544d7958edad8786563a511107a97d (patch) | |
tree | fcdbe0998cc6e9a80f7f22421178bdafe9d2057f /scripts/assert-content.sh | |
parent | Generate feed files for all collections and languages (diff) | |
download | euandre.org-fb6c91068a544d7958edad8786563a511107a97d.tar.gz euandre.org-fb6c91068a544d7958edad8786563a511107a97d.tar.xz |
assert-content.sh: Filter out all .atom files
Diffstat (limited to 'scripts/assert-content.sh')
-rwxr-xr-x | scripts/assert-content.sh | 15 |
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}" |