4 Code modelled after Joes Hess` description of the 'chef' filter from
5 the debian text filters package. This one is heavily broken,
6 rearranging the rules is required; some other differences are because
7 the orig. 'chef' filter gets some rules wrong too.
11 $ewiki_plugins["view_final"][] = "ewiki_page_filter_chef";
14 function ewiki_page_filter_chef(&$o) {
15 $o = preg_replace('/>([^<>]+)</e',
16 '">".stripslashes(strhtml_chef("\\1"))."<"', $o);
20 function strhtml_chef($text) {
23 $text = preg_replace('/th\b/', 't', $text);
24 $text = preg_replace('/en\b/', 'ee', $text);
27 $text = preg_replace('/the/', 'zhe', $text);
28 $text = preg_replace('/The/', 'Zhe', $text);
30 #-- if not first letter
31 $text = preg_replace('/(\w)f/', '\\1ff', $text);
32 $text = preg_replace('/\b(\w+?)i(\w+)\b/', '\\1ee\\2', $text);
35 $text = strtr($text, "uo", "ou");
36 $text = preg_replace('/o/', 'oo', $text);
38 $text = preg_replace('/\bO(\w)/', 'Oo\\2', $text);
40 #-- always (o and u rules)
41 $text = preg_replace('/au/', 'oo', $text);
42 $text = preg_replace('/Au/', 'Oo', $text);
44 #-- always (not conflicting)
45 $text = preg_replace('/v/', 'f', $text);
46 $text = preg_replace('/V/', 'F', $text);
47 $text = preg_replace('/w/', 'v', $text);
48 $text = preg_replace('/W/', 'V', $text);
49 $text = preg_replace('/an/', 'un', $text);
50 $text = preg_replace('/An/', 'Un', $text);
51 // $text = preg_replace('/en/', 'un', $text); // for bug emulation
54 $text = preg_replace('/\be/', 'i', $text);
55 $text = preg_replace('/\bE/', 'I', $text);
58 $text = preg_replace('/[Aa](\w)/', 'e\\1', $text);
60 #-- all following must take into account previous garbaging, and revert
64 $text = preg_replace('/(tion|teeun)/', 'shun', $text);
67 $text = preg_replace('/(?<![zZ]h)e\b/', 'e-a', $text);
69 $text = preg_replace('/[ou][vw]\b/', 'oo', $text);
71 $text = preg_replace('/([.!?]\s*\n)/', "\\1<br />\nBork Bork Bork!<br />\n", $text);