[DOC-CVS] [doc-base] standalone-mode: Replace standalone mode with base language configuration
[email protected] (Jordi Kroon)
| Newsgroups | php.doc.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: Jordi Kroon (jordikroon)
Date: 2026-08-04T21:37:17+02:00
Commit: https://github.com/php/doc-base/commit/624b94b14a9e3f3f759bdc41b9ef477d7cb0f7e4
Raw diff: https://github.com/php/doc-base/commit/624b94b14a9e3f3f759bdc41b9ef477d7cb0f7e4.diff
Replace standalone mode with base language configuration
Changed paths:
M configure.php
Diff:
diff --git a/configure.php b/configure.php
index 407450a679..e244f9b14d 100755
--- a/configure.php
+++ b/configure.php
@@ -84,9 +84,8 @@ function usage() // {{{
--disable-libxml-check Disable the libxml 2.7.4+ requirement check
--with-php=PATH Path to php CLI executable [detect]
--with-lang=LANG Language to build [{$acd['LANG']}]
- --standalone Treat the language directory as a complete,
- authoritative manual tree instead of a
- translation overlay of en [{$acd['STANDALONE']}]
+ --with-base-lang=LANG Language directory that is the base
+ (authoritative) manual tree [{$acd['LANG_BASE_DIR']}]
--with-partial=my-xml-id Root ID to build (e.g. <book xml:id="MY-ID">) [{$acd['PARTIAL']}]
--with-jing=auto|yes|no Validate with Jing (requires Java) instead of
libxml [{$acd['JING']}]
@@ -214,7 +213,7 @@ function print_dom_errors()
function print_xml_errors()
{
global $ac;
- $report = lang_is_base() || $ac['XPOINTER_REPORTING'] == 'yes';
+ $report = is_single_language() || $ac['XPOINTER_REPORTING'] == 'yes';
$output = ( $ac['STDERR_TO_STDOUT'] == 'yes' ) ? STDOUT : STDERR ;
$errors = libxml_get_errors();
@@ -299,9 +298,9 @@ function find_xml_files($path) // {{{
'CHMONLY_INCL_BEGIN' => '<!--',
'CHMONLY_INCL_END' => '-->',
'LANG' => 'en',
+ 'LANGS' => ['en'],
'LANGDIR' => "{$rootdir}/en",
- 'EN_DIR' => 'en',
- 'STANDALONE' => 'no',
+ 'LANG_BASE_DIR' => 'en',
'ENCODING' => 'utf-8',
'PARTIAL' => 'no',
'DETAILED_ERRORMSG' => 'no',
@@ -387,8 +386,8 @@ function find_xml_files($path) // {{{
$ac['LANG'] = $v;
break;
- case 'standalone':
- $ac['STANDALONE'] = $v;
+ case 'base-lang':
+ $ac['LANG_BASE_DIR'] = $v;
break;
case 'partial':
@@ -519,7 +518,18 @@ function find_xml_files($path) // {{{
} else if ($ac['LANG'] == 'yes') {
$ac['LANG'] = 'en';
}
-if ($ac["LANG"] == "en" || $ac['STANDALONE'] == 'yes') {
+// Language dirs in consideration, in overwriting order (last wins):
+// the base manual tree first, an optional translation overlay second.
+
+if (!in_array('LANG', $overridden_settings)) {
+ $ac['LANG'] = $ac['LANG_BASE_DIR'];
+}
+$ac['LANGS'] = [$ac['LANG_BASE_DIR']];
+if ($ac['LANG'] !== $ac['LANG_BASE_DIR']) {
+ $ac['LANGS'][] = $ac['LANG'];
+}
+
+if (is_single_language()) {
$ac["TRANSLATION_ONLY_INCL_BEGIN"] = "<!--";
$ac["TRANSLATION_ONLY_INCL_END"] = "-->";
}
@@ -533,16 +543,12 @@ function find_xml_files($path) // {{{
}
$ac['LANGDIR'] = basename($LANGDIR);
-if ($ac['STANDALONE'] == 'yes') {
- // The language directory is itself the base tree; no en overlay.
- $ac['EN_DIR'] = $ac['LANGDIR'];
-}
checkvalue("yes");
-function lang_is_base() : bool
+function is_single_language() : bool
{
global $ac;
- return $ac['LANG'] === $ac['EN_DIR'];
+ return count($ac['LANGS']) === 1;
}
checking("for partial build");
@@ -578,9 +584,9 @@ function git_status()
return;
$repos = array();
- $repos['doc-base'] = $ac['basedir'];
- $repos[$ac['EN_DIR']] = "{$ac['rootdir']}/{$ac['EN_DIR']}";
- $repos[$ac['LANG']] = "{$ac['rootdir']}/{$ac['LANG']}";
+ $repos['doc-base'] = $ac['basedir'];
+ $repos[$ac['LANG_BASE_DIR']] = "{$ac['rootdir']}/{$ac['LANG_BASE_DIR']}";
+ $repos[$ac['LANG']] = "{$ac['rootdir']}/{$ac['LANG']}";
$output = "";
foreach ( $repos as $name => $path )
@@ -627,13 +633,13 @@ function dtd_pe_body( string $filename = '' )
$baseEnt2 = dtd_pe_body( __DIR__ . '/temp/file-entities.ent' );
$baseEnt3 = dtd_pe_body( __DIR__ . '/temp/entities.ent' );
- $base = $ac['EN_DIR'];
+ $base = $ac['LANG_BASE_DIR'];
$langOne1 = dtd_pe_body( __DIR__ . "/../$base/language-defs.ent" );
$langOne2 = dtd_pe_body( __DIR__ . "/../$base/language-snippets.ent" );
$langOne3 = dtd_pe_body( __DIR__ . "/../$base/extensions.ent" );
- if ( lang_is_base() )
+ if ( is_single_language() )
{
$langTwo1 = dtd_pe_body();
$langTwo2 = dtd_pe_body();
@@ -653,11 +659,7 @@ function dtd_pe_body( string $filename = '' )
$conf = [];
- // Standalone trees are not named after a language, so they must
- // declare xml:lang themselves. Not defining &LANG; makes any
- // accidental use of it fail.
- if ( $ac['STANDALONE'] != 'yes' )
- $conf[] = "<!ENTITY LANG '$lang'>";
+ $conf[] = "<!ENTITY LANG '$lang'>";
$conf[] = "<!ENTITY manual.chmonly $chmpath>";
@@ -688,8 +690,8 @@ function dtd_file_entities()
$parts = array();
$parts[] = $withphp;
$parts[] = __DIR__ . "/scripts/file-entities.php";
- $parts[] = $ac['EN_DIR'];
- if ( $lang != $ac['EN_DIR'] )
+ $parts[] = $ac['LANG_BASE_DIR'];
+ if ( $lang != $ac['LANG_BASE_DIR'] )
$parts[] = $lang;
if ( $withchm )
$parts[] = '--chmonly';
@@ -715,8 +717,8 @@ function dtd_text_entities()
$parts = [ $php
, __DIR__ . "/scripts/text-entities.php"
- , $ac['EN_DIR'] ];
- if ( $lang != $ac['EN_DIR'] )
+ , $ac['LANG_BASE_DIR'] ];
+ if ( $lang != $ac['LANG_BASE_DIR'] )
$parts[] = $lang;
foreach ( $parts as & $part )
@@ -766,7 +768,7 @@ function dom_saveload( DOMDocument $dom , string $filename = "" ) : string
echo "Creating monolithic temp/manual.xml... ";
$dom = new DOMDocument();
-if ( dom_load( $dom , __DIR__ . "/../{$ac['EN_DIR']}/manual.xml" , true ) )
+if ( dom_load( $dom , __DIR__ . "/../{$ac['LANG_BASE_DIR']}/manual.xml" , true ) )
{
echo " done.\n";
print_dom_errors();
@@ -822,7 +824,7 @@ function xinclude_no_fallback( DOMDocument $dom )
if ( $xifallbacks->length > 0 )
{
- if ( lang_is_base() )
+ if ( is_single_language() )
{
print "\n<xi:fallback> cause silent errors in all languages.\n";
print "Not allowed on base manual trees.\n";
@@ -1041,7 +1043,7 @@ function xinclude_residual_fixup( DOMDocument $dom )
// Duplicated structural xml:ids are fatal on base manual trees
- $fatal = lang_is_base();
+ $fatal = is_single_language();
if ( $structural && $fatal )
errors_are_bad( 1 );
@@ -1161,7 +1163,7 @@ function xml_validate_jing()
if ( preg_match( '/IDREF "[^"]+" without matching ID/', $line ) )
$countFatal--;
- if ( lang_is_base() || $countFatal > 0 )
+ if ( is_single_language() || $countFatal > 0 )
errors_are_bad( 1 );
}
@@ -1170,7 +1172,7 @@ function xml_validate_libxml( $dom )
echo "Validating temp/manual.xml (libxml)... ";
$ok = $dom->relaxNGValidate( RNG_SCHEMA_FILE );
- if ( ! $ok && ! lang_is_base() )
+ if ( ! $ok && ! is_single_language() )
{
$errors = libxml_get_errors();
$warnings = 0;
@@ -1234,7 +1236,7 @@ function phd_conf_json()
'rootdir' => $ac['rootdir'],
'srcdir' => $ac['srcdir'],
'lang' => $ac['LANG'],
- 'enDir' => $ac['EN_DIR'],
+ 'enDir' => $ac['LANG_BASE_DIR'],
'langDir' => $ac['LANGDIR'],
'generate' => $ac['GENERATE'],
'xpointerReporting' => $ac['XPOINTER_REPORTING'] === 'yes',
@@ -1267,7 +1269,7 @@ function php_history()
echo 'PhD history:';
- $lang_mod_file = "{$ac['rootdir']}/{$ac['EN_DIR']}/fileModHistory.php";
+ $lang_mod_file = "{$ac['rootdir']}/{$ac['LANG_BASE_DIR']}/fileModHistory.php";
$doc_base_mod_file = __DIR__ . "/fileModHistory.php";
$history_file = null;
@@ -1302,12 +1304,12 @@ function phd_sources()
echo ' reading,';
$source_map = array();
- $en_dir = "{$ac['rootdir']}/{$ac['EN_DIR']}";
+ $base_dir = "{$ac['rootdir']}/{$ac['LANG_BASE_DIR']}";
$source_langs = array(
array('base', $ac['srcdir'], array('manual.xml', 'funcindex.xml')),
- array($ac['EN_DIR'], $en_dir, find_xml_files($en_dir)),
+ array($ac['LANG_BASE_DIR'], $base_dir, find_xml_files($base_dir)),
);
- if (!lang_is_base()) {
+ if (!is_single_language()) {
$lang_dir = "{$ac['rootdir']}/{$ac['LANGDIR']}";
$source_langs[] = array($ac['LANG'], $lang_dir, find_xml_files($lang_dir));
}
@@ -1366,7 +1368,7 @@ function phd_version()
$globdir = dirname($ac["GENERATE"]) . "/{../../}versions.xml";
}
else {
- $globdir = "{$ac['rootdir']}/{$ac['EN_DIR']}";
+ $globdir = "{$ac['rootdir']}/{$ac['LANG_BASE_DIR']}";
$globdir .= "/*/*/versions.xml";
}
echo ' transforming,';