aboutsummaryrefslogtreecommitdiff
path: root/scripts/assert-content.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xscripts/assert-content.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/assert-content.sh b/scripts/assert-content.sh
index d83ec33..0642663 100755
--- a/scripts/assert-content.sh
+++ b/scripts/assert-content.sh
@@ -59,6 +59,7 @@ assert-frontmatter() {
echo Linting posts... >&2
for post in $(jq -r '.posts[] | @base64' "${JSON}"); do
assert-frontmatter "$post"
+ REF="$(get-ref "$post")"
DATE="$(get-date "$post" | awk '{print $1}')"
URL="$(basename "$(get-url "$post")")"
FILE="_posts/${DATE}-${URL%.html}.md"
@@ -67,6 +68,11 @@ for post in $(jq -r '.posts[] | @base64' "${JSON}"); do
red "date/filename mismatch: '${FILE}' does not exist."
exit 1
}
+
+ grep '\-post$' <(echo "${REF}") > /dev/null || {
+ red "ref '${REF}' doesn't end with '-post'."
+ exit 1
+ }
done
echo Linting pages... >&2
@@ -85,7 +91,12 @@ done
echo Linting tils... >&2
for til in $(jq -r '.tils[] | @base64' "${JSON}"); do
+ REF="$(get-ref "$til")"
assert-frontmatter "$til"
+ grep '\-til$' <(echo "${REF}") > /dev/null || {
+ red "ref '${REF}' doesn't end with '-til'."
+ exit 1
+ }
done
echo Asserting unique refs... >&2