summaryrefslogtreecommitdiffhomepage
path: root/include/lib.m4
blob: ead0887247563f645655030f6a484ba421c3ff77 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
m4_dnl To avoid annoying conflicts with quote characters, use
m4_dnl U+2068 FIRST STRONG ISOLATE and U+2069 POP DIRECTIONAL ISOLATE
m4_changequote(⁨,⁩)

m4_dnl We also need to avoid the comment character ever doing absolutely
m4_dnl anything.  I don’t think I’ll ever use ASCII character 1 (SOH) lol.
m4_changecom()

m4_dnl Macro to create a page footer
m4_define(
	m4_footer,
	⁨m4_define(⁨m4___caller__⁩, m4___file__)m4_include(footer.gsp)⁩
)

m4_dnl Macro to properly format code blocks
m4_define(
	m4_fmt_code,
	⁨m4_esyscmd(fmt-code "$1" m4___file__)m4_dnl⁩
)

m4_dnl Macro for generating abbrevations
m4_define(m4_abbr, ⁨@abbr .m4_translit($1, A-Z2, a-zt) {-$1}⁩)

m4_define(m4_file_create_date, ⁨m4_esyscmd(
	git log --follow --pretty='format:%cI' $(dirname m4___file__)/$1/index.gsp \
	| tail -n1 \
	| ifne xargs date +'%-d %B %Y' -d \
	| ifne -n echo 'No date yet…'
)⁩)

m4_define(m4_article, ⁨li .article {
	a href="$1" $2
	span {-m4_file_create_date($1)}
}⁩)