From: Jonas Fonseca Date: Thu, 31 May 2007 08:31:34 +0000 (+0200) Subject: Add version information to man pages X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=bb0ab19f0540342604a8b9dfc97bd7b3bb822a51;p=tig.git Add version information to man pages Inspired and copied from git 7ef195ba3efe0ffa815e12afc4cb1e39a21ddfb4: Override the [header] macro of asciidoc's docbook backend to add version information to the generated man pages. by Frank Lichtenheld . Slightly improved to use asciidoc {version} macro to avoid having to invoke sed. --- diff --git a/Makefile b/Makefile index f8e601d..5e96234 100644 --- a/Makefile +++ b/Makefile @@ -16,9 +16,10 @@ DOCS = $(DOCS_MAN) $(DOCS_HTML) \ manual.toc manual.pdf ifneq (,$(wildcard .git)) -VERSION = $(shell git-describe) -WTDIRTY = $(shell git-diff-index --name-only HEAD 2>/dev/null) -CFLAGS += '-DVERSION="$(VERSION)$(if $(WTDIRTY),-dirty)"' +GITDESC = $(subst tig-,,$(shell git describe)) +WTDIRTY = $(if $(shell git-diff-index HEAD 2>/dev/null),-dirty) +VERSION = $(GITDESC)$(WTDIRTY) +CFLAGS += '-DVERSION="tig-$(VERSION)"' endif all: $(PROGS) @@ -88,7 +89,7 @@ README.html: README asciidoc -b xhtml11 -d manpage $< %.1.xml : %.1.txt - asciidoc -b docbook -d manpage $< + asciidoc -b docbook -d manpage -aversion=$(VERSION) $< %.1 : %.1.xml xmlto -m manpage.xsl man $< @@ -97,7 +98,7 @@ README.html: README asciidoc -b xhtml11 -d manpage $< %.5.xml : %.5.txt - asciidoc -b docbook -d manpage $< + asciidoc -b docbook -d manpage -aversion=$(VERSION) $< %.5 : %.5.xml xmlto -m manpage.xsl man $< diff --git a/asciidoc.conf b/asciidoc.conf index 8343a86..8ad167a 100644 --- a/asciidoc.conf +++ b/asciidoc.conf @@ -21,6 +21,25 @@ ifdef::backend-xhtml11[] {target}{0?({0})} endif::backend-xhtml11[] +ifdef::doctype-manpage[] +ifdef::backend-docbook[] +[header] +template::[header-declarations] + + +{mantitle} +{manvolnum} +Tig +{version} +Tig Manual + + + {manname} + {manpurpose} + +endif::backend-docbook[] +endif::doctype-manpage[] + ifdef::readme[] # No header or footers for README.html [header]