1#!/usr/bin/perl -w
2use strict;
3
4my $cmd;
5my $name;
6
7my $author;
8
9while (<STDIN>) {
10 if (/^NAME$/ || eof(STDIN)) {
11 if ($cmd) {
12 print PAGE $author if defined($author);
13 print PAGE "Documentation\n--------------\nDocumentation by David Greaves, Junio C Hamano and the git-list <git\@vger.kernel.org>.\n\n";
14 print PAGE "GIT\n---\nPart of the link:git.html[git] suite\n\n";
15
16 if ($#ARGV || $ARGV[0] eq "-html") {
17 system(qw(asciidoc -b css-embedded -d manpage), "$cmd.txt");
18 } elsif ($ARGV[0] eq "-man") {
19 system(qw(asciidoc -b docbook -d manpage), "$cmd.txt");
20 system(qw(xmlto man), "$cmd.xml") if -e "$cmd.xml";
21 }
22 }
23 exit if eof(STDIN);
24 $_=<STDIN>;$_=<STDIN>; # discard underline and get command
25 chomp;
26 $name = $_;
27 ($cmd) = split(' ',$_);
28 print "$name\n";
29 open(PAGE, "> $cmd.txt") or die;
30 print PAGE "$cmd(1)\n==="."="x length($cmd);
31 print PAGE "\nv0.1, May 2005\n\nNAME\n----\n$name\n\n";
32
33
34 $author = "Author\n------\nWritten by Linus Torvalds <torvalds\@osdl.org>\n\n";
35
36 next;
37 }
38 next unless $cmd;
39
40 $author=undef if /^AUTHOR$/i; # don't use default for commands with an author
41
42 print PAGE $_;
43
44}