Index: phpdoc/chm/make_chm.php diff -u phpdoc/chm/make_chm.php:1.5 phpdoc/chm/make_chm.php:1.6 --- phpdoc/chm/make_chm.php:1.5 Sun Oct 6 05:35:03 2002 +++ phpdoc/chm/make_chm.php Sun Nov 17 11:11:54 2002 @@ -14,25 +14,79 @@ $FANCY_PATH = getenv("PHP_HELP_COMPILE_FANCYDIR"); $LANGUAGE = getenv("PHP_HELP_COMPILE_LANG"); $INDEX_IN_HTML = "index.html"; +$INTERNAL_CHARSET = "UTF-8"; +$DEFAULT_FONT = "Arial,10,0"; if (empty($FANCY_PATH)) { $FANCY_PATH = $HTML_PATH; } // Array to manual code -> HTML Help Code conversion // Code list: http://www.helpware.net/htmlhelp/hh_info.htm $LANGUAGES = array( - "tw" => "0x404 Traditional Chinese", - "cs" => "0x405 Czech", - "de" => "0x407 German (Germany)", - "en" => "0x809 Enlish (United Kingdom)", - "es" => "0xc0a Spanish (International Sort)", - "fr" => "0x40c French (France)", - "hu" => "0x40e Hungarian", - "it" => "0x410 Italian (Italy)", - "ja" => "0x411 Japanese", - "kr" => "0x412 Korean", - "nl" => "0x413 Dutch (Netherlands)", - "pt_BR" => "0x416 Portuguese (Brazil)", - "zh" => "0x804 Simplified Chinese" + "tw" => array( + "langcode" => "0x404 Traditional Chinese", + "preferred_charset" => "CP950", + "preferred_font" => $DEFAULT_FONT + ), + "cs" => array( + "langcode" => "0x405 Czech", + "preferred_charset" => "Windows-1250", + "preferred_font" => $DEFAULT_FONT + ), + "de" => array( + "langcode" => "0x407 German (Germany)", + "preferred_charset" => "Windows-1252", + "preferred_font" => $DEFAULT_FONT + ), + "en" => array( + "langcode" => "0x809 English (United Kingdom)", + "preferred_charset" => "Windows-1252", + "preferred_font" => $DEFAULT_FONT + ), + "es" => array( + "langcode" => "0xc0a Spanish (International Sort)", + "preferred_charset" => "Windows-1252", + "preferred_font" => $DEFAULT_FONT + ), + "fr" => array( + "langcode" => "0x40c French (France)", + "preferred_charset" => "Windows-1252", + "preferred_font" => $DEFAULT_FONT + ), + "hu" => array( + "langcode" => "0x40e Hungarian", + "preferred_charset" => "Windows-1250", + "preferred_font" => $DEFAULT_FONT + ), + "it" => array( + "langcode" => "0x410 Italian (Italy)", + "preferred_charset" => "Windows-1252", + "preferred_font" => $DEFAULT_FONT + ), + "ja" => array( + "langcode" => "0x411 Japanese", + "preferred_charset" => "CP932", + "preferred_font" => "MS P Gothic,10,0" + ), + "kr" => array( + "langcode" => "0x412 Korean", + "preferred_charset" => "CP949", + "preferred_font" => $DEFAULT_FONT + ), + "nl" => array( + "langcode" => "0x413 Dutch (Netherlands)", + "preferred_charset" => "Windows-1252", + "preferred_font" => $DEFAULT_FONT + ), + "pt_BR" => array( + "langcode" => "0x416 Portuguese (Brazil)", + "preferred_charset" => "Windows-1252", + "preferred_font" => $DEFAULT_FONT + ), + "zh" => array( + "langcode" => "0x804 Simplified Chinese", + "preferred_charset" => "CP936", + "preferred_font" => $DEFAULT_FONT + ) ); // Files on the top level of the TOC @@ -46,6 +100,18 @@ "appendixes.html" ); +// backwards compatibility +if (!function_exists("file_get_contents")) { + function file_get_contents($file) + { + $cnt = file($file); + if ($cnt !== false) { + return join('', $cnt); + } + return false; + } +} + // Header for index and toc $HEADER = ' @@ -72,8 +138,8 @@ $index = fopen("php_manual_$LANGUAGE.hhk", "w"); // Write out file headers - fputs($toc, $HEADER); - fputs($index, $HEADER); + fputs_wrapper($toc, $HEADER); + fputs_wrapper($index, $HEADER); // Read original index file and drop out newlines $indexline = oneLiner("$HTML_PATH/$INDEX_IN_HTML"); @@ -85,7 +151,7 @@ if ($FIRST_PAGE != $INDEX_IN_HTML) { // Find the name of the Table of Contents - preg_match('|CLASS=\"TOC\" >
- (.*)
- (.*)(.*)|U', $indexline, $match); + preg_match('|([^<]*)|U', $indexline, $match); if (empty($match[1])) { // Fallback $match[1] = "Preface"; } mapAndIndex($match[1], "preface.html", " ", $toc, $index); // Now autofind the main pages + $MAIN_REGEXP = join("|", $MAIN_FILES); - preg_match_all("![IVX]+\. (.+)(.+)(?=[IVX]+\.
- \n");
- preg_match_all("!(.+)!U", $matchinfo[3], $subpages, PREG_SET_ORDER);
+ fputs_wrapper($toc, "\n
- \n");
+ preg_match_all("!([^<]*)!iU", $matchinfo[3], $subpages, PREG_SET_ORDER);
+
foreach ($subpages as $spinfo) {
mapAndIndex($spinfo[2], $spinfo[1], " ", $toc, $index);
findDeeperLinks($spinfo[1], $toc, $index);
}
- fputs($toc, "\n
(.*)
([^<]*)\n\n

