Files
doc-gtk/scripts/gen_manualxml.php
2006-03-26 02:44:13 +00:00

36 lines
1.0 KiB
PHP

<?php
/**
* generates manual.xml for a specific language from the manual.xml.in template
*/
$template = 'scripts/manual.xml.in';
if (!file_exists($template)) {
die("\r\nRun the script from the base php-gtk-doc directory\r\n");
}
if ($GLOBALS['argc'] < 2 || strlen($GLOBALS['argv'][1]) != 2) {
die("\r\nError: Pass the desired language as only parameter\r\n");
}
$lang = $GLOBALS['argv'][1];
if (!is_dir('manual/' . $lang)) {
die("\r\nThere is no directory for language $lang\r\n");
}
$outputfile = 'scripts/manual.xml';
$hdl = fopen($outputfile, "w+");
fwrite($hdl,
str_replace('@PHP_GTK2_DOC_BUILD_DATE@', date('r'),
str_replace('@LANG@', $lang,
str_replace('@LANGDIR@', "manual/$lang",
str_replace('@MANUAL@', "manual",
str_replace('<!DOCTYPE', "<!-- DO NOT EDIT THIS FILE! IT IS GENERATED AUTOMATICALLY BY gen_manualxml.php -->\r\n<!DOCTYPE",
str_replace('@DOCBOOK_DOCTYPE@', '-//PHP Group//DTD DocBk XML V3.1.7-Based Extension//EN',
file_get_contents($template)
))))))
);
fclose($hdl);
?>