[PATCH] Add Makefile target glossary.html
[git.git] / Documentation / sort_glossary.pl
blobbabbea04158404e0b38d332f4fd47e91482d3c60
1 #!/usr/bin/perl
3 %terms=();
5 while(<>) {
6 if(/^(\S.*)::$/) {
7 my $term=$1;
8 if(defined($terms{$term})) {
9 die "$1 defined twice\n";
11 $terms{$term}="";
12 LOOP: while(<>) {
13 if(/^$/) {
14 last LOOP;
16 if(/^ \S/) {
17 $terms{$term}.=$_;
18 } else {
19 die "Error 1: $_";
25 sub format_tab_80 ($) {
26 my $text=$_[0];
27 my $result="";
28 $text=~s/\s+/ /g;
29 $text=~s/^\s+//;
30 while($text=~/^(.{1,72})(|\s+(\S.*)?)$/) {
31 $result.=" ".$1."\n";
32 $text=$3;
34 return $result;
37 sub no_spaces ($) {
38 my $result=$_[0];
39 $result=~tr/ /_/;
40 return $result;
43 print 'GIT Glossary
44 ============
45 Aug 2005
47 This list is sorted alphabetically:
51 @keys=sort {uc($a) cmp uc($b)} keys %terms;
52 $pattern='(\b'.join('\b|\b',reverse @keys).'\b)';
53 foreach $key (@keys) {
54 $terms{$key}=~s/$pattern/sprintf "<<ref_".no_spaces($1).",$1>>";/eg;
55 print '[[ref_'.no_spaces($key).']]'.$key."::\n"
56 .format_tab_80($terms{$key})."\n";
59 print '
61 Author
62 ------
63 Written by Johannes Schindelin <Johannes.Schindelin@gmx.de> and
64 the git-list <git@vger.kernel.org>.
66 GIT
67 ---
68 Part of the link:git.html[git] suite