Also close bug
[filters.git] / chef
1 #!/usr/bin/perl -p
2 # Swedish Chef filter. Bork Bork Bork!
3 # Copyright 1999 by Joey Hess under the terms of the GNU GPL.
4
5 # Note that the order of the commands in this program is very important!
6
7 # Change 'e' at the end of a word to 'e-a', but don't mess with the word
8 # "the".
9 s{(\w+)e(\b)}{
10 if (lc($1) ne 'th') {
11 "$1e-a$2"
12 }
13 else {
14 "$1e$2"
15 }
16 }eg;
17
18 # Stuff that happens at the end of a word.
19 s/en(\b)/ee$1/g;
20 s/th(\b)/t$1/g;
21
22 # Stuff that happens if not the first letter of a word.
23 s/(\w)f/$1ff/g;
24
25 # Change 'o' to 'u' and at the same time, change 'u' to 'oo'. But only
26 # if it's not the first letter of the word.
27 tr/ou/uo/;
28 s{(\b)([uo])}{
29 $1 . $2 eq 'o' ? 'u' : 'o'
30 }eg;
31 # Note that this also handles doubling "oo" at the beginning of words.
32 s/o/oo/g;
33 # Have to double "Oo" seperatly.
34 s/(\b)O(\w)/$1Oo$2/g;
35 # Fix the word "bork", which will have been mangled to "burk"
36 # by above commands. Note that any occurrence of "burk" in the input
37 # gets changed to "boork", so it's completly safe to do this:
38 s/\b([Bb])urk\b/$1ork/g;
39
40 # Stuff to do to letters that are the first letter of any word.
41 s/\be/i/g;
42 s/\bE/I/g;
43
44 # Stuff that always happens.
45 s/tiun/shun/g; # this actually has the effect of changing "tion" to "shun".
46 s/the/zee/g;
47 s/The/Zee/g;
48 tr/vVwW/fFvV/;
49
50 # Stuff to do to letters that are not the last letter of a word.
51 s/a(?!\b)/e/g;
52 s/A(?!\b)/E/g;
53
54 s/en/un/g; # this actually has the effect of changing "an" to "un".
55 s/En/Un/g; # this actually has the effect of changing "An" to "Un".
56 s/eoo/oo/g; # this actually has the effect of changing "au" to "oo".
57 s/Eoo/Oo/g; # this actually has the effect of changing "Au" to "Oo".
58
59 # Change "ow" to "oo".
60 s/uv/oo/g;
61
62 # Change 'i' to 'ee', but not at the beginning of a word,
63 # and only affect the first 'i' in each word.
64 s/(\b\w[a-hj-zA-HJ-Z]*)i/$1ee/g;
65
66 # Special punctuation of the end of sentances but only at end of lines.
67 s/([.?!])$/$1\nBork Bork Bork!/g;
This page took 0.023871 seconds and 4 git commands to generate.