|
14 | 14 | //----------------------------------------
|
15 | 15 |
|
16 | 16 | // set your language (en/ja/ru/ro/es/tr/fr/de/zh/pt_BR)
|
17 |
| -$cfg_lang = 'ja'; |
18 |
| -$cfg_ver = '7.1'; |
| 17 | +$cfg_lang = 'zh'; |
| 18 | +$cfg_ver = '7.4'; |
19 | 19 |
|
20 | 20 | // set your chm-extract command
|
21 | 21 | // ** must be 'sprintf() format'
|
22 | 22 | // *** arg1: target chm file, arg2: extract dir
|
23 | 23 |
|
24 | 24 | // Windows
|
25 |
| -$cfg_chm = 'hh -decompile %2$s %1$s'; |
| 25 | +// $cfg_chm = 'hh -decompile %2$s %1$s'; |
26 | 26 | // Mac, Linux
|
27 |
| -//$cfg_chm = 'extract_chmLib %1$s %2$s'; |
| 27 | +$cfg_chm = 'extract_chmLib %1$s %2$s'; |
28 | 28 |
|
29 | 29 | // set true, if you have font trouble with google open sans (e.g. Zeal on windows)
|
30 | 30 | $cfg_nosans = true;
|
|
69 | 69 | try {
|
70 | 70 | // get php manual (en) docset
|
71 | 71 | exec_ex("rm -rf {$c_rbase}/");
|
72 |
| - //exec_ex("mkdir -p {$c_rbase}/"); |
| 72 | + // exec_ex("mkdir -p {$c_rbase}/"); |
73 | 73 |
|
74 | 74 | if (
|
75 | 75 | !mkdir("{$c_dbase}/", 0777, true) ||
|
|
81 | 81 | exec_ex("wget {$c_url_doc}");
|
82 | 82 | exec_ex("wget --trust-server-names {$c_url_chm}");
|
83 | 83 |
|
84 |
| - if (preg_match('#.+/get/(php_(manual|enhanced)_ja\.chm)/from/.+#i', $c_url_chm, $match)) { |
| 84 | + if (preg_match('#.+/get/(php_(manual|enhanced)_(en|ja|ru|ro|es|tr|fr|de|zh|pt_BR)\.chm)/from/.+#i', $c_url_chm, $match)) { |
85 | 85 | $target_chm = $match[1];
|
86 | 86 | echo "\nDetect CHM file '{$target_chm}'. set as target ...\n";
|
87 | 87 | }
|
|
97 | 97 | exec_ex("tar xzf {$target_doc} -C {$c_origd} --strip-components 1");
|
98 | 98 | sleep(5);
|
99 | 99 |
|
100 |
| - $base_dir = "{$c_origd}/Contents/Resources/Documents/php.net/manual/en"; |
| 100 | + $base_dir = "{$c_origd}/Contents/Resources/Documents/www.php.net/manual/en"; |
101 | 101 |
|
102 | 102 | // replace html
|
103 | 103 | // ** note: Do not use 'rm' command.
|
|
117 | 117 | }
|
118 | 118 |
|
119 | 119 | echo "Removing original manual/en ...\n";
|
120 |
| - exec_ex("rm -rf {$c_origd}/Contents/Resources/Documents/php.net/manual/en"); |
| 120 | + exec_ex("rm -rf {$c_origd}/Contents/Resources/Documents/www.php.net/manual/en"); |
121 | 121 | exec_ex(sprintf($cfg_chm, $target_chm, $c_mychm));
|
122 | 122 | sleep(1);
|
123 | 123 | exec_ex("rm -f {$c_mychm}/res/style.css");
|
|
131 | 131 | }
|
132 | 132 |
|
133 | 133 | // copy & replace documents
|
134 |
| - exec_ex("mv {$c_origd}/Contents/Resources/Documents/php.net {$c_dbase}/php.net"); |
135 |
| - exec_ex("mv {$c_mychm}/res {$c_dbase}/php.net/manual/en"); |
| 134 | + exec_ex("mkdir -p {$c_dbase}/www.php.net/manual"); |
| 135 | + exec_ex("mv {$c_origd}/Contents/Resources/Documents/www.php.net {$c_dbase}/php.net"); |
| 136 | + exec_ex("mv {$c_mychm}/res {$c_dbase}/www.php.net/manual/en"); |
136 | 137 |
|
137 | 138 | if (!copy(
|
138 | 139 | __DIR__ . sprintf('/%s', $cfg_nosans ? 'style-nosans.css' : 'style.css'),
|
139 |
| - "{$c_dbase}/php.net/manual/en/style.css" |
| 140 | + "{$c_dbase}/www.php.net/manual/en/style.css" |
140 | 141 | )) {
|
141 | 142 | do_exception(__LINE__);
|
142 | 143 | }
|
|
178 | 179 | copy(__DIR__ . '/icon@2x.png', "{$c_cbase}/../icon@2x.png");
|
179 | 180 |
|
180 | 181 |
|
181 |
| -// update db (add japanese indexes) |
| 182 | +// update db (add target language's indexes) |
182 | 183 | echo "\nAdd search indexes from Title ...\n\n";
|
183 | 184 |
|
184 | 185 | $db = new PDO("sqlite:{$c_rbase}/docSet.dsidx");
|
|
0 commit comments