@@ -149,6 +149,7 @@ if test "${do_gitversion}" == "yes"; then
149
149
150
150
# TODO: Should we fail if dirty?
151
151
raw_version=" $( git describe --always --tags) "
152
+ echo " Git version: ${raw_version} "
152
153
IFS=' -' read -r -a dash_hunks <<< " ${raw_version}"
153
154
154
155
# Could be one of:
@@ -262,11 +263,21 @@ sed 's/^---$/\\newpage/g;1s/\\newpage/---/g' "${build_dir}/${input_file}.1" > "$
262
263
# While we're doing this, transform the case to all-caps.
263
264
sed ' 0,/\\tableofcontents/s/^# \(.*\)/\\section*\{\U\1\}/g' " ${build_dir} /${input_file} .2" > " ${build_dir} /${input_file} .3"
264
265
265
- # Grab the date from the front matter and generate the full date and year.
266
- DATE=" $( grep date: " ${input_file} " | head -n 1 | cut -d ' ' -f 2) "
266
+ if test " ${do_gitversion} " == " yes" ; then
267
+ # If using the git information for versioning, grab the date from there
268
+ DATE=" $( git show -s --date=format:' %Y/%m/%d' --format=%ad) "
269
+ else
270
+ # Else, grab the date from the front matter and generate the full date and year.
271
+ DATE=" $( grep date: " ${input_file} " | head -n 1 | cut -d ' ' -f 2) "
272
+ fi
273
+
267
274
YEAR=" $( date --date=" ${DATE} " +%Y) "
268
275
DATE_ENGLISH=" $( date --date=" ${DATE} " " +%B %-d, %Y" ) "
269
276
277
+ echo " Date: ${DATE} "
278
+ echo " Year: ${YEAR} "
279
+ echo " Date (English): ${DATE_ENGLISH} "
280
+
270
281
# Run Pandoc
271
282
export MERMAID_FILTER_THEME=" forest"
272
283
export MERMAID_FILTER_FORMAT=" pdf"
@@ -292,6 +303,7 @@ if [ -n "${pdf_output}" ]; then
292
303
--top-level-division=section \
293
304
--variable=block-headings \
294
305
--variable=numbersections \
306
+ --metadata=date:" ${DATE} " \
295
307
--metadata=date-english:" ${DATE_ENGLISH} " \
296
308
--metadata=year:" ${YEAR} " \
297
309
--metadata=titlepage:true \
0 commit comments