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