Skip to content

Commit c0ccec5

Browse files
committed
fixed: path name with 'www.'; chm filename for multi language
1 parent 497d378 commit c0ccec5

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
PHP.docset/Contents/Resources
2+
PHP.docset/Contents/Info.plist
23
PHP.docset.zip
34
Thumbs.db
45
desktop.ini

PHP.docset/Contents/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
<plist version="1.0">
44
<dict>
55
<key>CFBundleIdentifier</key>
6-
<string>phpdoc-ja</string>
6+
<string>phpdoc-zh</string>
77
<key>CFBundleName</key>
8-
<string>PHP 7.1-ja</string>
8+
<string>PHP 7.4-zh</string>
99
<key>DocSetPlatformFamily</key>
1010
<string>php</string>
1111
<key>dashIndexFilePath</key>

generate-php.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@
1414
//----------------------------------------
1515

1616
// 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';
1919

2020
// set your chm-extract command
2121
// ** must be 'sprintf() format'
2222
// *** arg1: target chm file, arg2: extract dir
2323

2424
// Windows
25-
$cfg_chm = 'hh -decompile %2$s %1$s';
25+
// $cfg_chm = 'hh -decompile %2$s %1$s';
2626
// Mac, Linux
27-
//$cfg_chm = 'extract_chmLib %1$s %2$s';
27+
$cfg_chm = 'extract_chmLib %1$s %2$s';
2828

2929
// set true, if you have font trouble with google open sans (e.g. Zeal on windows)
3030
$cfg_nosans = true;
@@ -69,7 +69,7 @@
6969
try {
7070
// get php manual (en) docset
7171
exec_ex("rm -rf {$c_rbase}/");
72-
//exec_ex("mkdir -p {$c_rbase}/");
72+
// exec_ex("mkdir -p {$c_rbase}/");
7373

7474
if (
7575
!mkdir("{$c_dbase}/", 0777, true) ||
@@ -81,7 +81,7 @@
8181
exec_ex("wget {$c_url_doc}");
8282
exec_ex("wget --trust-server-names {$c_url_chm}");
8383

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)) {
8585
$target_chm = $match[1];
8686
echo "\nDetect CHM file '{$target_chm}'. set as target ...\n";
8787
}
@@ -97,7 +97,7 @@
9797
exec_ex("tar xzf {$target_doc} -C {$c_origd} --strip-components 1");
9898
sleep(5);
9999

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";
101101

102102
// replace html
103103
// ** note: Do not use 'rm' command.
@@ -117,7 +117,7 @@
117117
}
118118

119119
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");
121121
exec_ex(sprintf($cfg_chm, $target_chm, $c_mychm));
122122
sleep(1);
123123
exec_ex("rm -f {$c_mychm}/res/style.css");
@@ -131,12 +131,13 @@
131131
}
132132

133133
// 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");
136137

137138
if (!copy(
138139
__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"
140141
)) {
141142
do_exception(__LINE__);
142143
}
@@ -178,7 +179,7 @@
178179
copy(__DIR__ . '/icon@2x.png', "{$c_cbase}/../icon@2x.png");
179180

180181

181-
// update db (add japanese indexes)
182+
// update db (add target language's indexes)
182183
echo "\nAdd search indexes from Title ...\n\n";
183184

184185
$db = new PDO("sqlite:{$c_rbase}/docSet.dsidx");

0 commit comments

Comments
 (0)