diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-02-23 15:19:26 +0100 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-02-23 15:19:26 +0100 |
commit | 208ddaa76019af05d1e0f352912dab38ceedad6b (patch) | |
tree | eafd9aefa77d7cf9581c2e4de87968d700d74aaf /m4 | |
parent | ab6d91982264623ae626115349d2c8a7579f1b1e (diff) |
Add nvim-ts article
Diffstat (limited to 'm4')
-rw-r--r-- | m4/article.m4 | 17 | ||||
-rw-r--r-- | m4/fmt-code.m4 | 10 |
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) +}) |