aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2020-10-23 06:18:03 -0300
committerEuAndreh <eu@euandre.org>2020-10-23 06:19:10 -0300
commit5b141847bd01de0c0fa7c160c6443bc6c0d4f9f7 (patch)
tree30833fade5fb513a0c9ceec4eeacbdcc70468788
parentInterview article: Fix link to match title (diff)
downloadeuandre.org-5b141847bd01de0c0fa7c160c6443bc6c0d4f9f7.tar.gz
euandre.org-5b141847bd01de0c0fa7c160c6443bc6c0d4f9f7.tar.xz
assert-content.sh: Enforce "ref" is the slug of the "title" for pages in en
-rw-r--r--_articles/2018-08-01-verifying-npm-ci-reproducibility.md2
-rw-r--r--_articles/2019-06-02-stateless-os.md2
-rw-r--r--_articles/2020-08-10-guix-inside-sourcehut-builds-sr-ht-ci.md2
-rw-r--r--_articles/2020-10-05-cargo2nix-dramatically-simpler-rust-in-nix.md2
-rw-r--r--_articles/2020-10-19-feature-flags-differences-between-backend-frontent-and-mobile.md2
-rw-r--r--_tils/2020-09-05-pull-requests-with-git-the-oldschool-way.md2
-rw-r--r--_tils/2020-10-11-search-changes-to-a-filename-pattern-in-git-history.md2
-rwxr-xr-xscripts/assert-content.sh37
8 files changed, 36 insertions, 15 deletions
diff --git a/_articles/2018-08-01-verifying-npm-ci-reproducibility.md b/_articles/2018-08-01-verifying-npm-ci-reproducibility.md
index ff983e5..8faced9 100644
--- a/_articles/2018-08-01-verifying-npm-ci-reproducibility.md
+++ b/_articles/2018-08-01-verifying-npm-ci-reproducibility.md
@@ -3,7 +3,7 @@ title: Verifying "npm ci" reproducibility
date: 2018-08-01
layout: post
lang: en
-ref: veryfing-npm-ci-reproducibility
+ref: verifying-npm-ci-reproducibility
updated_at: 2019-05-22
---
When [npm@5](https://blog.npmjs.org/post/161081169345/v500) came bringing
diff --git a/_articles/2019-06-02-stateless-os.md b/_articles/2019-06-02-stateless-os.md
index eae470a..42c543c 100644
--- a/_articles/2019-06-02-stateless-os.md
+++ b/_articles/2019-06-02-stateless-os.md
@@ -3,7 +3,7 @@ title: Using NixOS as an stateless workstation
date: 2019-06-02
layout: post
lang: en
-ref: stateless-os
+ref: using-nixos-as-an-stateless-workstation
---
Last week[^last-week] I changed back to an old[^old-computer] Samsung laptop, and installed
[NixOS](https://nixos.org/) on it.
diff --git a/_articles/2020-08-10-guix-inside-sourcehut-builds-sr-ht-ci.md b/_articles/2020-08-10-guix-inside-sourcehut-builds-sr-ht-ci.md
index 3ce2acf..c699df4 100644
--- a/_articles/2020-08-10-guix-inside-sourcehut-builds-sr-ht-ci.md
+++ b/_articles/2020-08-10-guix-inside-sourcehut-builds-sr-ht-ci.md
@@ -4,7 +4,7 @@ date: 2020-08-10
updated_at: 2020-08-19
layout: post
lang: en
-ref: guix-sourcehut-ci
+ref: guix-inside-sourcehut-buildssrht-ci
---
After the release of the [NixOS images in builds.sr.ht][0] and much
usage of it, I also started looking at [Guix][1] and
diff --git a/_articles/2020-10-05-cargo2nix-dramatically-simpler-rust-in-nix.md b/_articles/2020-10-05-cargo2nix-dramatically-simpler-rust-in-nix.md
index c0ebb69..b1dbf69 100644
--- a/_articles/2020-10-05-cargo2nix-dramatically-simpler-rust-in-nix.md
+++ b/_articles/2020-10-05-cargo2nix-dramatically-simpler-rust-in-nix.md
@@ -1,5 +1,5 @@
---
-title: "cargo2nix: Dramatically simpler Rust inside Nix"
+title: "cargo2nix: Dramatically simpler Rust in Nix"
date: 2020-10-05
layout: post
lang: en
diff --git a/_articles/2020-10-19-feature-flags-differences-between-backend-frontent-and-mobile.md b/_articles/2020-10-19-feature-flags-differences-between-backend-frontent-and-mobile.md
index b27f480..74d4e15 100644
--- a/_articles/2020-10-19-feature-flags-differences-between-backend-frontent-and-mobile.md
+++ b/_articles/2020-10-19-feature-flags-differences-between-backend-frontent-and-mobile.md
@@ -3,7 +3,7 @@ title: "Feature flags: differences between backend, frontend and mobile"
date: 2020-10-19
layout: post
lang: en
-ref: feature-flags-differences-between-backend-frontent-and-mobile
+ref: feature-flags-differences-between-backend-frontend-and-mobile
category: presentation
---
diff --git a/_tils/2020-09-05-pull-requests-with-git-the-oldschool-way.md b/_tils/2020-09-05-pull-requests-with-git-the-oldschool-way.md
index ce14009..6684631 100644
--- a/_tils/2020-09-05-pull-requests-with-git-the-oldschool-way.md
+++ b/_tils/2020-09-05-pull-requests-with-git-the-oldschool-way.md
@@ -3,7 +3,7 @@ title: Pull requests with Git, the old school way
date: 2020-09-05
layout: post
lang: en
-ref: pull-requests-with-git-the-oldschool-way
+ref: pull-requests-with-git-the-old-school-way
---
It might be news to you, as it was to me, that "pull requests" that you can
create on a Git hosting provider's web UI[^pr-webui] like
diff --git a/_tils/2020-10-11-search-changes-to-a-filename-pattern-in-git-history.md b/_tils/2020-10-11-search-changes-to-a-filename-pattern-in-git-history.md
index 264d1bd..0a91b76 100644
--- a/_tils/2020-10-11-search-changes-to-a-filename-pattern-in-git-history.md
+++ b/_tils/2020-10-11-search-changes-to-a-filename-pattern-in-git-history.md
@@ -3,7 +3,7 @@ title: Search changes to a filename pattern in Git history
date: 2020-10-11
layout: post
lang: en
-ref: search-changes-to-a-filename-pattern-in-git-history.md
+ref: search-changes-to-a-filename-pattern-in-git-history
---
This is [yet][git-til-1] [another][git-til-2] ["search in Git"][git-til-3] TIL
diff --git a/scripts/assert-content.sh b/scripts/assert-content.sh
index 626353c..2fcf1a9 100755
--- a/scripts/assert-content.sh
+++ b/scripts/assert-content.sh
@@ -14,9 +14,20 @@ JSON='_site/site.json'
LANGS=(en pt fr)
IGNORED_PAGES=(site.json sitemap.xml *.atom)
+export LC_ALL=en_US.UTF-8
## Helper function definitions
+slugify() {
+ echo "${1}" | \
+ tr '[:upper:]' '[:lower:]' | \
+ perl -ne 'tr/\000-\177//cd;
+ s/[^\w\s-]//g;
+ s/^\s+|\s+$//g;
+ s/[-\s]+/-/g;
+ print;'
+}
+
contains-element() {
local e match="$1"
shift
@@ -45,7 +56,7 @@ get-url() {
}
get-date() {
- echo "${1}" | base64 --decode | jq -r .date
+ echo "${1}" | base64 --decode | jq -r .date | awk '{print $1}'
}
get-title() {
@@ -88,21 +99,31 @@ assert-frontmatter() {
exit 1
fi
- if [[ -n "${PREFIX}" ]]; then
- DATE="$(get-date "$F" | awk '{print $1}')"
+ if [[ "$DESIRED_LAYOUT" != 'page' ]]; then
+ DATE="$(get-date "$F")"
URL_BASENAME="$(basename "$(get-url "$F")")"
- FILE="${PREFIX}/${DATE}-${URL_BASENAME%.html}.${EXTENSION}"
+ FILE="${PREFIX}${DATE}-${URL_BASENAME%.html}.${EXTENSION}"
[[ -f "${FILE}" ]] || {
red "date/filename mismatch: '${FILE}' does not exist."
exit 1
}
+
+ if [[ "$DESIRED_LAYOUT" != 'pastebin' ]] && [[ "$LANG" = 'en' ]]; then
+ TITLE_SLUG="$(slugify "$TITLE")"
+ if [[ "$TITLE_SLUG" != "$REF" ]]; then
+ red "ref isn't the slug of the title."
+ red "ref: '$REF'"
+ red "title slug: '$TITLE_SLUG'"
+ exit 1
+ fi
+ fi
fi
}
echo Linting articles... >&2
for article in $(jq -r '.articles[] | @base64' "${JSON}"); do
- assert-frontmatter "$article" 'post' '_articles'
+ assert-frontmatter "$article" 'post' '_articles/'
done
echo Linting pages... >&2
@@ -115,17 +136,17 @@ done
echo Linting pastebins... >&2
for pastebin in $(jq -r '.pastebins[] | @base64' "${JSON}"); do
- assert-frontmatter "$pastebin" 'pastebin' '_pastebins'
+ assert-frontmatter "$pastebin" 'pastebin' '_pastebins/'
done
echo Linting tils... >&2
for til in $(jq -r '.tils[] | @base64' "${JSON}"); do
- assert-frontmatter "$til" 'post' '_tils'
+ assert-frontmatter "$til" 'post' '_tils/'
done
echo Linting slides... >&2
for slide in $(jq -r '.slides[] | @base64' "${JSON}"); do
- assert-frontmatter "$slide" 'slides' '_slides' 'slides'
+ assert-frontmatter "$slide" 'slides' '_slides/' 'slides'
done
echo Asserting unique refs... >&2