From 5cefc33bffd3580d07ca548bc8e2ff38c945c78c Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 10 Dec 2007 01:15:57 -0800 Subject: [PATCH] Documentation: add gitman.info target Signed-off-by: Junio C Hamano --- Documentation/Makefile | 36 +++++++++++++++++++++++++++-------- Documentation/cat-texi.perl | 38 +++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 8 deletions(-) create mode 100755 Documentation/cat-texi.perl diff --git a/Documentation/Makefile b/Documentation/Makefile index 9f0f9d70f..37ec355ba 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -5,7 +5,11 @@ MAN1_TXT= \ MAN5_TXT=gitattributes.txt gitignore.txt gitmodules.txt MAN7_TXT=git.txt -DOC_HTML=$(patsubst %.txt,%.html,$(MAN1_TXT) $(MAN5_TXT) $(MAN7_TXT)) +MAN_TXT = $(MAN1_TXT) $(MAN5_TXT) $(MAN7_TXT) +MAN_XML=$(patsubst %.txt,%.xml,$(MAN_TXT)) +MAN_HTML=$(patsubst %.txt,%.html,$(MAN_TXT)) + +DOC_HTML=$(MAN_HTML) ARTICLES = tutorial ARTICLES += tutorial-2 @@ -80,7 +84,7 @@ man1: $(DOC_MAN1) man5: $(DOC_MAN5) man7: $(DOC_MAN7) -info: git.info +info: git.info gitman.info install: man $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir) @@ -92,9 +96,10 @@ install: man install-info: info $(INSTALL) -d -m 755 $(DESTDIR)$(infodir) - $(INSTALL) -m 644 git.info $(DESTDIR)$(infodir) + $(INSTALL) -m 644 git.info gitman.info $(DESTDIR)$(infodir) if test -r $(DESTDIR)$(infodir)/dir; then \ $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\ + $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) gitman.info ;\ else \ echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \ fi @@ -165,12 +170,27 @@ XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css user-manual.html: user-manual.xml xsltproc $(XSLTOPTS) -o $@ $(XSLT) $< -git.info: user-manual.xml - $(RM) $@ $*.texi $*.texi+ - $(DOCBOOK2X_TEXI) user-manual.xml --to-stdout >$*.texi+ - $(PERL_PATH) fix-texi.perl <$*.texi+ >$*.texi +git.info: git.texi + $(MAKEINFO) --no-split $*.texi + +git.texi: user-manual.xml + $(RM) $@+ $@ + $(DOCBOOK2X_TEXI) user-manual.xml --to-stdout | $(PERL_PATH) fix-texi.perl >$@+ + mv $@+ $@ + +gitman.texi: $(MAN_XML) cat-texi.perl + $(RM) $@+ $@ + ($(foreach xml,$(MAN_XML),$(DOCBOOK2X_TEXI) --to-stdout $(xml);)) | \ + $(PERL_PATH) cat-texi.perl $@ >$@+ + mv $@+ $@ + +gitman.info: gitman.texi $(MAKEINFO) --no-split $*.texi - $(RM) $*.texi $*.texi+ + +$(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml + $(RM) $@+ $@ + $(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@+ + mv $@+ $@ howto-index.txt: howto-index.sh $(wildcard howto/*.txt) $(RM) $@+ $@ diff --git a/Documentation/cat-texi.perl b/Documentation/cat-texi.perl new file mode 100755 index 000000000..e3d8e9faa --- /dev/null +++ b/Documentation/cat-texi.perl @@ -0,0 +1,38 @@ +#!/usr/bin/perl -w + +my @menu = (); +my $output = $ARGV[0]; + +open TMP, '>', "$output.tmp"; + +while () { + next if (/^\\input texinfo/../\@node Top/); + next if (/^\@bye/ || /^\.ft/); + if (s/^\@top (.*)/\@node $1,,,Top/) { + push @menu, $1; + } + s/\(\@pxref{\[URLS\]}\)//; + print TMP; +} +close TMP; + +printf '\input texinfo +@setfilename gitman.info +@documentencoding us-ascii +@node Top,,%s +@top Git Manual Pages +@documentlanguage en +@menu +', $menu[0]; + +for (@menu) { + print "* ${_}::\n"; +} +print "\@end menu\n"; +open TMP, '<', "$output.tmp"; +while () { + print; +} +close TMP; +print "\@bye\n"; +unlink "$output.tmp"; -- 2.30.2