diff options
author | EuAndreh <eu@euandre.org> | 2020-08-12 07:35:01 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2020-08-12 07:35:01 -0300 |
commit | e0db9261ea31c38ea5b6de4246d9f651920443a0 (patch) | |
tree | 5ca7d8eeed85ce1c620e4ccf7d010f54853ff354 /scripts/assert-content.sh | |
parent | public-inbox.html: Add link to email me directly (diff) | |
download | euandre.org-e0db9261ea31c38ea5b6de4246d9f651920443a0.tar.gz euandre.org-e0db9261ea31c38ea5b6de4246d9f651920443a0.tar.xz |
Assert all post refs end with '-post' and TIL refs end with -til
Also add this assertion to ./scripts/assert-content.sh.
Diffstat (limited to 'scripts/assert-content.sh')
-rwxr-xr-x | scripts/assert-content.sh | 11 |
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 |