Guidebook datestamping
Allow the hints file to apply a correct timestamp to the Guidebooks prior to use. Detect the NH_DATESUB in the Guidebook.mn or Guidebook.tex files and replace the datestamping line that follows. If git is available, it determines the hash of the last commit applied to doc/Guidebook.mn, and then determines the date of that commit. The interim Guidebook.dated.mn (or Guidebook.dated.tex) gets the datestamp applied. If git isn't available or doesn't correctly provide the hash for doc/Guidebook.mn, it should just continue to use whatever hard-coded date in the Guidebook.mn source file (it uses it instead of the interim file).
This commit is contained in:
10
sys/unix/hints/include/gbdates-post.370
Executable file
10
sys/unix/hints/include/gbdates-post.370
Executable file
@@ -0,0 +1,10 @@
|
||||
# NetHack 3.7 gbdates-post.370 $NHDT-Date: 1599687610 2020/09/09 21:40:10 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.11 $
|
||||
ifdef MAKEFILE_DOC
|
||||
ifdef GB_DATESTAMP
|
||||
Guidebook.dated.mn: $(GUIDEBOOK_MN_SRC)
|
||||
@awk 'f{$$0=".ds f2 \"$(GB_DATESTAMP)";f=0}/NH_DATESUB/{f=1} 1' < $(GUIDEBOOK_MN_SRC) > $@
|
||||
Guidebook.dated.tex: $(GUIDEBOOK_TEX_SRC)
|
||||
@awk 'f{$$0="\\date{$(GB_DATESTAMP)}";f=0}/NH_DATESUB/{f=1} 1' < $(GUIDEBOOK_TEX_SRX) > $@
|
||||
endif # GB_DATESTAMP
|
||||
endif # MAKEFILE_DOC
|
||||
#
|
||||
17
sys/unix/hints/include/gbdates-pre.370
Executable file
17
sys/unix/hints/include/gbdates-pre.370
Executable file
@@ -0,0 +1,17 @@
|
||||
# NetHack 3.7 gbdates-pre.370 $NHDT-Date: 1599687610 2020/09/09 21:40:10 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.11 $
|
||||
|
||||
ifdef MAKEFILE_DOC
|
||||
ifneq "$(GIT)" "0"
|
||||
#Get the hash of the last update to Guidebook.mn
|
||||
GB_LAST_COMMIT := $(shell git log -n 1 --pretty=format:%H -- Guidebook.mn)
|
||||
ifneq "$(GB_LAST_COMMIT)" ""
|
||||
GB_DATESTAMP := $(shell git show -s --format=%cd --date=format:'%B %d, %Y' $(GB_LAST_COMMIT))
|
||||
endif # GB_LAST_COMMIT
|
||||
ifneq "$(GB_DATESTAMP)" ""
|
||||
DOC_EXTRAS += Guidebook.dated.mn Guidebook.dated.tex
|
||||
override GUIDEBOOK_MN = Guidebook.dated.mn
|
||||
override GUIDEBOOK_TEX = Guidebook.dated.tex
|
||||
endif # GB_DATESTAMP
|
||||
endif # GIT=0 explicitly
|
||||
endif # MAKEFILE_DOC
|
||||
#
|
||||
Reference in New Issue
Block a user