I build a new version with the ideas from Goba (Thanks!), now there is only one script in php and it is in english.
This is more simple, so, to use:
 
Apply the path to Makefile.in 
Add the script to /scripts
./configure
make file=file to generate, example:
make file=./en/reference/mysql/functions/mysql-query.xml
 
Index: Makefile.in
===================================================================
RCS file: /repository/phpdoc/Makefile.in,v
retrieving revision 1.146
diff -u -r1.146 Makefile.in
--- Makefile.in 3 Jan 2004 12:32:15 -0000 1.146
+++ Makefile.in 10 Jan 2004 19:35:29 -0000
@@ -21,6 +21,12 @@
 
 all: html
 
+ifdef file
+buildfile=addentities.xml.tmp
+else
+buildfile=manual.xml
+endif
+
 # {{{ variables
 
 [EMAIL PROTECTED]@
@@ -167,7 +173,8 @@
 html/index.html: manual.xml $(HTML_DEPS)
  @test -d html || mkdir html
  $(PHP) -q $(scriptdir)/rtlpatch/hackmanuallang.php $(LANGDIR)
- $(JADE) $(CATALOG) -d $(HTML_STYLESHEET) -V use-output-dir -t sgml $(XMLDCL) manual.xml
+ $(PHP) -q $(scriptdir)/addentities.php $(file)
+ $(JADE) $(CATALOG) -d $(HTML_STYLESHEET) -V use-output-dir -t sgml $(XMLDCL) $(buildfile)
  $(PHP) -q $(scriptdir)/html_syntax.php html html/
  $(PHP) -q $(scriptdir)/rtlpatch/hackmanuallang.php en
  $(HACK_RTL_LANGS_PAGES)
 
*******************************************
addentities.php.in
 
<?php
/**
* by Fernando Correa da Conceição <fernandoc at php.net>
*
* This script let you compile only one file. Use:
* make file=filename
* example:
* make file=./en/reference/mysql/functions/mysql-query.xml
* to all functions from a extension
* make file=./en/reference/mysql/reference.xml
*/
$file=$argv[1];
// if we are working with the default rule, exit
// TODO: maybe do this on Makefile
if($file == "") exit;
 
$lines=file($file);
 
// this is the beginning from manual.xml.in
$header = <<<endblock
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
          "@srcdir@/dtds/dbxml-4.1.2/docbookx.dtd" [
 
<!-- Add translated specific definitions and snippets -->
<!ENTITY % language-defs     SYSTEM "@srcdir@/@LANGDIR@/language-defs.ent">
<!ENTITY % language-snippets SYSTEM "@srcdir@/@LANGDIR@/language-snippets.ent">
 
%language-defs;
%language-snippets;
 
<!-- Fallback to English definitions and snippets (in case of missing translation) -->
<!ENTITY % language-defs.default     SYSTEM "@srcdir@/en/language-defs.ent">
<!ENTITY % language-snippets.default SYSTEM "@srcdir@/en/language-snippets.ent">
 
%language-defs.default;
%language-snippets.default;
 
<!-- phpweb entities - autogenerated! -->
<!ENTITY % phpweb.entities  SYSTEM "entities/phpweb.ent">
 
%phpweb.entities;
 
<!-- All global entities for the XML files -->
<!ENTITY % global.entities  SYSTEM "@srcdir@/entities/global.ent">
 
<!-- These are language independent -->
<!ENTITY % build.version    SYSTEM "entities/version.ent">
<!ENTITY % file.entities    SYSTEM "entities/file-entities.ent">
 
<!-- Include all external DTD parts defined previously -->
%global.entities;
%file.entities;
%build.version;
 
<!-- Autogenerated missing entites and IDs to make build work -->
<!ENTITY % missing-entities  SYSTEM "entities/missing-entities.ent">
%missing-entities;
 
<!ENTITY missing-ids SYSTEM "entities/missing-ids.xml">
]>
endblock;
 
// here a add the beginning from manual.xml.in
// and the tags <book> and <article> to make jade happy
$lines[1].="\n".$header."\n<book>\n<article>";
 
// join all again and add closing tags for book and article
$output=join("",$lines);
$output.="\n</article>\n</book>";
 
// generate a temp file with all things
$saveto="./addentities.xml.tmp";
if (!$handle = fopen($saveto, 'w')) {
   echo "Error, can´t create/open ($saveto)";
   exit;
}
if (!fwrite($handle, $output)) {
    print "Error, can´t write ($saveto)";
    exit;
}
 
?>
 
Fernando Correa da Conceição
ICQ 168518047
 
http://manualphp.sourceforge.net
Participe da Tradução do Manual do PHP

Reply via email to