File: myspellfixprefix.pl

package info (click to toggle)
hkgerman 1%3A2-35
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 6,052 kB
  • sloc: makefile: 215; sh: 128; perl: 42; sed: 29
file content (31 lines) | stat: -rw-r--r-- 668 bytes parent folder | download | duplicates (5)
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
#!/usr/bin/perl -w

# 2002-05-05 Bjrn Jacke <bjoern@j3e.de>
#
# script to expand prefixes of capital words to work around a myspell
# bug which would otherwise create words like "unTier" instead of "Untier"

while (<STDIN>) {
	chomp;
	if (m/^[A-Z].*\/.*[GUV]/) {
		print STDERR "Capital prefixes will be expanded: $_\n";

		($start,$rest) = split("",$_,2);
		$start =~  tr/A-Z/a-z/;
		$rest =~ s/(\/.*)U/$1/;
		$rest =~ s/(\/.*)V/$1/;
		$rest =~ s/(\/.*)G/$1/;
		$rest =~ s/\/$//;

		if (m/\/.*U/) {
			s/(\/.*)U/$1/;
			print "Un$start$rest\n";
		}
		if (m/\/.*V/) {
			s/(\/.*)V/$1/;
			print "Ver$start$rest\n";
		}
	}
	chop if (m/\/$/);
	print "$_\n";
}