rename foo.n to foo.3tk
[manpages-zh.git] / utils / totw.pl
blob42ea957b676b2b5297988eac110d17888dbd5b29
1 #!/usr/bin/perl -p
3 # ¥»µ{¦¡¬O¥Î¨Ó¹ï cman ÁcÅ餤¤åª©§@¥Xªº¡uµ½«á³B²z¡v¡C
5 # §@ªÌ¡GÀNªFÆF Anthony Fok <foka@debian.org>
6 # ª©Åv¡GGNU General Public License v2 ©Î§ó·sª©¥»
8 # next if /^%/;
10 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)¡§/$1¡u/);
11 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)¡¨/$1¡v/);
12 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)¸Ì/$1ùØ/);
14 # ² -> Ác
15 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)­S¨Ò/$1½d¨Ò/);
16 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?(¥Ü|¨å|³W))­S/$1½d/);
17 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)¨î(?=§@|³y)/$1»s/);
18 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)´_¨î/$1½Æ»s/);
19 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)ºÉºÞ/$1¾¨ºÞ/);
20 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)´å(?=À¸|¼Ö|ª±)/$1¹C/);
21 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?(´²|µo))¥¬/$1§G/);
22 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)¤_/$1©ó/);
23 # 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?(Ãö|²×|°ò|¦Ü|¦P|¦b|¦ì))¤_/$1©ó/);
24 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)ÃÒ/$1µý/);
25 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)¤z²b/$1°®²b/);
26 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?(?:¤é|¼Ð))§Ó/$1»x/);
27 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)§E/$1¾l/);
29 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)¶H/$1¹³/);
30 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?(?:²{|¹ï|¸ñ|©â|¤Ñ|®ð))¹³/$1¶H/);
31 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)¹³(?=¼x|§Î|´Ñ|¤ú)/$1¶H/);
34 s/¾Þ§@¨t²Î/§@·~¨t²Î/g;
35 s/¤å¥»¤å¥ó/¯Â¤å¦rÀÉ/g;
36 s/¤å¦r³B²z/¤å®Ñ³B²z/g;
37 # 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)¤å¥»/$1¤å¦r/);
38 s/¤å¥»(?=¼Ò¦¡|½s¿è|®æ¦¡)/¤å¦r/g;
39 s/¤å¥óºÞ²z¾¹/Àɮ׺޲z­û/g;
40 s/¤å¥ó¨t²Î/Àɮרt²Î/g;
41 s/ªA°È¾¹/¦øªA¾¹/g;
43 s/§Y´¡§Y¥Î/ÀH´¡§Y¥Î/g;
44 s/µ¡¤f¨t²Î/µøµ¡¨t²Î/g;
45 s/X~µ¡¤f/X~µøµ¡/g;
46 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)µ¡¤f/$1µøµ¡/);
49 # hashao §â "server" ¥s§@ "ªA¨Í¾¹" ¡K¡K
50 s/ªA¨Í¾¹/¦øªA¾¹/g;
52 # Riser §â "server" ¥s§@ "ªA°Èµ{§Ç" ¡K¡K
53 s/ªA°Èµ{§Ç/¦øªA¾¹/g;
55 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)­pºâ¾÷/$1¹q¸£/);
56 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)¤º®Ö/$1®Ö¤ß/);
57 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)¤A¤Ó(?=ºô)/$1¥H¤Ó/);
58 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)¦rÅé/$1¦r«¬/);
59 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)«á¥x/$1­I´º/);
60 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)µæ³æ/$1¿ï³æ/);
61 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)«Ì¹õ/$1¿Ã¹õ/);
62 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)¥ú¼Ð/$1´å¼Ð/);
63 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)¹«¼Ð/$1·Æ¹«/);
64 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)¸}¥»/$1½Z¥»/);
65 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)ºôµ¸/$1ºô¸ô/);
66 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)¤¬Ápºô/$1ºô»Úºô¸ô/);
70 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)¥Î¤á/$1¨Ï¥ÎªÌ/);
71 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)(¯Ê¬Ù|Àq»{)/$1¹w³]/);
72 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)µn¿ý/$1µn¤J/);
73 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)¤å¥ó¦W(?!ºÙ|¦r)/$1ÀɦW/);
74 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)¤å¥ó/$1ÀÉ®×/);
75 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)¤åÀÉ/$1¤å¥ó/);
76 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)­Ý®e/$1¬Û®e/);
77 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)µ{§Ç/$1µ{¦¡/);
78 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)§»©R¥O¥](?!§t|¬A)/$1¥¨¶°®M¥ó/);
79 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)§»©R¥O/$1¥¨¶°/);
80 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)¥´¦L¾÷/$1¦Cªí¾÷/);
81 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)¥´¦L/$1¦C¦L/);
82 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)¤â¤u/$1¤â°Ê/);
83 # 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)¤ä«ù/$1¤ä´©/);
84 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)«áºó/$1©µ¦ùÀɦW/);
85 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)¤º¦s/$1°O¾ÐÅé/);
86 s/°t¸m¤å¥ó/³]©wÀÉ/g;
87 s/(ĵ§i|¿ù»~)«H®§/$1°T®§/g;
90 s/³n¥ó¥](?!¸Ë|¬A)/®M¥ó/g;
91 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?(³n|µw))¥ó/$1Åé/);
92 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?(³n|µw|¥ú|ºÏ|Zip~))½L/$1ºÐ/);
93 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)·½(¥N)?½X/$1­ì©l½X/);
95 # zh_HK --> zh_TW
96 # 1 while (s/^((?:[\x00-\x7f]|[\x80-\xff].)*?)ºÏºÐ/$1ºÏ¤ù/);
99 # s/\<t\<(.+?)\>\>/$1/g;
101 # s/\<s\<¤åÀÉ\>\>/¤å¥ó/g;
102 # s/\<s\<¤å¥ó\>\>/ÀÉ®×/g;
103 # s/\<s\<ÀÉ®×\>\>/ÀÉ®×®w/g;
104 # s/\<s\<¤å¥ó¦W\>\>/ÀɮצWºÙ/g;
105 # s/\<s\<°t¸m¤å¥ó\>\>/³]©wÀÉ/g;
106 # s/\<s\<°t¸m\>\>/³]©w/g;
107 # s/\<s\<µ{§Ç\>\>/µ{¦¡/g;
108 # s/«È¤áµ{§Ç/«È¤áµ{¦¡/g;
109 # s/\<s\<¼Æ¾Ú\>\>/¸ê®Æ/g;
110 # s/\<s\<«H®§\>\>/¸ê°T/g;
111 # s/\<s\<Àq»{\>\>/¹w³]/g;
112 # s/\<s\<¯Ê¬Ù\>\>/¹w³]/g;
113 # s/\<s\<ºôÃö\>\>/¹h¹D/g;
114 # s/\<s\<¤Þ¾É\>\>/±Ò°Ê/g;
115 # s/\<s\<¤º¦s\>\>/°O¾ÐÅé/g;
116 # s/\<s\<¤ä«ù\>\>/¤ä´©/g;
117 # s/\<s\<¹B¦æ\>\>/°õ¦æ/g;
118 # s/\<s\<¥]\>\>/®M¥ó/g;
119 # s/\<s\<ª`\>\>/µù/g;
120 # s/\<s\<¤â¤u\>\>/¤â°Ê/g;
122 s/«æ±Ï½L/«æ±ÏºÏºÐ/g;
123 s/À³«æ½L/«æ±ÏºÏºÐ/g;
124 s/±Ò°Ê½L/±Ò°ÊºÏºÐ/g;
125 s/¤Þ¾É½L/±Ò°ÊºÏºÐ/g;
127 # And, finally, add an extra backslash where needed.
128 s/\G((?:[\x00-\x7f]|[\x80-\xff].)*?[\x80-\xff]\\)/$1\\/g;
130 # µ²§ô
132 sub changewww () {
133 s|^(<HTML lang="zh)">|$1-TW">|;
134 s/(\.zh)(?=\.(?:gif|jpg|png))/$1-tw/g;
135 s|^<A href=".*">(¤¤¤å&nbsp;\(Big5\))</A>(?=&nbsp;)|$1|;
137 s/µ¡¤f¨t²Î/µøµ¡¨t²Î/g;
138 s/¶l(»¼|¥ó)¦Cªí/³q«H½×¾Â/g;
139 s/Ãè¹³((ºô)?¯¸)/¬M®g$1/g;
140 s/ºôµ¸¹ï¶H¼Ò«¬Àô¹Ò/ºôµ¸ª«¥ó¼Ò«¬Àô¹Ò/g;