summaryrefslogtreecommitdiffhomepage
path: root/m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4')
-rw-r--r--m4/article.m417
-rw-r--r--m4/fmt-code.m410
2 files changed, 27 insertions, 0 deletions
diff --git a/m4/article.m4 b/m4/article.m4
new file mode 100644
index 0000000..9572ff8
--- /dev/null
+++ b/m4/article.m4
@@ -0,0 +1,17 @@
+m4_define(ARTICLE, ⁨li .article {
+ a href="$1" $2 __FILE_CREATE_DATA($1)
+}⁩)
+
+m4_define(__FILE_CREATE_DATA, ⁨
+ m4_define(⁨__DT⁩, m4_esyscmd(
+ git log --follow --pretty='format:%cI' $(dirname m4___file__)/$1/index.gsp \
+ | tail --lines=1
+ ))
+ m4_ifelse(__DT, ,
+ span {-No date yet…},
+ time datetime="__DT" {=
+ m4_esyscmd(date --date='__DT' '+%-d of %B %Y' \
+ | ordinal --positions=1)
+ }
+ )
+⁩)
diff --git a/m4/fmt-code.m4 b/m4/fmt-code.m4
new file mode 100644
index 0000000..f1af3e1
--- /dev/null
+++ b/m4/fmt-code.m4
@@ -0,0 +1,10 @@
+m4_define(FMT_CODE, ⁨pre .code-sample {=
+ m4_esyscmd(sed '
+ s/[@\\}]/\\&/g
+ m4_regexp($1, .*\.diff$,
+ /^+/s/.*/@ins{-&}/
+ /^-/s/.*/@del{-&}/
+ )
+ s/.*/@code{-&}/
+ ' $(dirname 'm4___file__')/$1)
+}⁩)