diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-16 20:55:00 +0200 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-16 20:55:00 +0200 |
commit | 0e106be1dc6d52ce14f1291ac1ec1149007f918c (patch) | |
tree | 8ad119b0a0569bf549230eff1de92d6d75b07f75 | |
parent | 9b4fb13f94bc8fa2f7d50519652bead8ede4ee3a (diff) |
generate post info using gitjekyll
-rw-r--r-- | _data/.gitignore | 1 | ||||
-rw-r--r-- | _data/authors.yml | 1 | ||||
-rwxr-xr-x | _scripts/postinfo | 21 | ||||
-rw-r--r-- | makefile | 13 |
4 files changed, 34 insertions, 2 deletions
diff --git a/_data/.gitignore b/_data/.gitignore new file mode 100644 index 0000000..8b1e502 --- /dev/null +++ b/_data/.gitignore @@ -0,0 +1 @@ +post diff --git a/_data/authors.yml b/_data/authors.yml index 225bec1..62cc535 100644 --- a/_data/authors.yml +++ b/_data/authors.yml @@ -1,6 +1,7 @@ authors: - name: Loek git: + - Loek Le Blansch - lonkaars - name: Willem git: diff --git a/_scripts/postinfo b/_scripts/postinfo new file mode 100755 index 0000000..95fe872 --- /dev/null +++ b/_scripts/postinfo @@ -0,0 +1,21 @@ +#!/bin/sh +file="$1" +tab="$(printf '\t')" + +history="$(git log \ + --follow \ + --ignore-all-space --diff-filter=AM \ + --date=short --pretty=format:"%cd$tab%an" \ + -- "$file")" + +dates="$(echo "$history" | cut -d"$tab" -f1)" +authors="$(echo "$history" | cut -d"$tab" -f2 | sort -u)" + +cat << EOF +date: $(echo "$dates" | head -n1) +date_initial: $(echo "$dates" | tail -n1) +edits: $(echo "$dates" | wc -l) +authors: +$(echo "$authors" | sed 's/^/- /') +EOF + @@ -1,3 +1,5 @@ +.PHONY: FORCE + JEKYLL_ENV ?= development # JEKYLL_ENV ?= production @@ -10,12 +12,19 @@ JEKYLL_BUILD_ARGS += --destination $(WEBROOT) # installed GEMS = Gemfile.lock -build: $(GEMS) +POSTS := $(wildcard _items/*) +POST_META := $(patsubst _items/%.md,_data/post/%.yml,$(POSTS)) + +build: $(GEMS) $(POST_META) FORCE bundle exec jekyll build $(JEKYLL_BUILD_ARGS) $(GEMS): Gemfile bundle install --quiet -clean: +_data/post/%.yml: _items/%.md + @mkdir -p _data/post + _scripts/postinfo $< > $@ + +clean: FORCE $(RM) -r $(WEBROOT) |