File: chef

package info (click to toggle)
filters 2.55-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 292 kB
  • ctags: 50
  • sloc: lex: 1,820; perl: 1,019; ansic: 217; makefile: 50
file content (67 lines) | stat: -rwxr-xr-x 1,920 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/perl -p
# Swedish Chef filter. Bork Bork Bork!
# Copyright 1999 by Joey Hess under the terms of the GNU GPL.

# Note that the order of the commands in this program is very important!

# Change 'e' at the end of a word to 'e-a', but don't mess with the word
# "the".
s{(\w+)e(\b)}{
	if (lc($1) ne 'th') {
		"$1e-a$2"
	}
	else {
		"$1e$2"
	}
}eg;

# Stuff that happens at the end of a word.
s/en(\b)/ee$1/g;
s/th(\b)/t$1/g;

# Stuff that happens if not the first letter of a word.
s/(\w)f/$1ff/g;

# Change 'o' to 'u' and at the same time, change 'u' to 'oo'. But only
# if it's not the first letter of the word.
tr/ou/uo/;
s{(\b)([uo])}{
	$1 . $2 eq 'o' ? 'u' : 'o'
}eg;
# Note that this also handles doubling "oo" at the beginning of words.
s/o/oo/g;
# Have to double "Oo" seperatly.
s/(\b)O(\w)/$1Oo$2/g;
# Fix the word "bork", which will have been mangled to "burk"
# by above commands. Note that any occurrence of "burk" in the input
# gets changed to "boork", so it's completly safe to do this:
s/\b([Bb])urk\b/$1ork/g;

# Stuff to do to letters that are the first letter of any word.
s/\be/i/g;
s/\bE/I/g;

# Stuff that always happens.
s/tiun/shun/g; # this actually has the effect of changing "tion" to "shun".
s/the/zee/g;
s/The/Zee/g;
tr/vVwW/fFvV/;

# Stuff to do to letters that are not the last letter of a word.
s/a(?!\b)/e/g;
s/A(?!\b)/E/g;

s/en/un/g; # this actually has the effect of changing "an" to "un".
s/En/Un/g; # this actually has the effect of changing "An" to "Un".
s/eoo/oo/g; # this actually has the effect of changing "au" to "oo".
s/Eoo/Oo/g; # this actually has the effect of changing "Au" to "Oo".

# Change "ow" to "oo".
s/uv/oo/g;

# Change 'i' to 'ee', but not at the beginning of a word,
# and only affect the first 'i' in each word.
s/(\b\w[a-hj-zA-HJ-Z]*)i/$1ee/g;

# Special punctuation of the end of sentances but only at end of lines.
s/([.?!])$/$1\nBork Bork Bork!/g;