From bb0ab19f0540342604a8b9dfc97bd7b3bb822a51 Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Thu, 31 May 2007 10:31:34 +0200 Subject: [PATCH] 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. --- Makefile | 11 ++++++----- asciidoc.conf | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index f8e601d53..5e96234d6 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 8343a86cb..8ad167ab4 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]