3636
3737# Output
3838
39- This script collects grouped and individual entity files (detailed
40- below), at some expected relative paths, and generates an
41- .entities.ent file, in a sibling position to manual.xml.in.
42-
43- The output file .entities.ent has no duplications, so collection
44- order is important to keep the necessary operational semantics. Here,
45- newer loaded entities takes priority (overwrites) over previous one.
46- Note that this is the reverse of <!ENTITY> convention, where
47- duplicated entity names are ignored. The priority order used here
48- is important to allow detecting cases where "constant" entities
49- are being overwriten, or if translatable entities are missing
50- translations.
39+ This script collects grouped and individual XML Entity files
40+ (detailed below), at some expected relative paths, and generates an
41+ doc-base/temp/entities.ent file with their respective DTD Entities.
42+
43+ The output file has no duplications, so collection order is important
44+ to keep the necessary operational semantics. Here, latter loaded entities
45+ takes priority (overrides) an previous defined one. Note that this is the
46+ reverse of DTD <!ENTITY> convention, where duplicated entity names are
47+ ignored. The priority order used here is important to allow detecting
48+ cases where global entities are being overwritten, or if expected
49+ translatable entities are missing translations.
5150
5251# Individual XML Entities, or `.xml` files at `entities/`
5352
5453As explained above, the individual entity contents are not really
5554valid XML *documents*, they are only at most valid XML *fragments*.
55+ More technically, these XML files are really well-balanced texts, per
56+ https://www.w3.org/TR/xml-fragment/#defn-well-balanced .
5657
5758Yet, individual entities are stored in entities/ as .xml files, for
58- two reasons: first, text editors in general can highlights XML syntax,
59- even for XML fragments, and second, this allows normal revision tracking
59+ two reasons: first, text editors in general can highlights XML syntax in
60+ well-balanced texts; and second, this allows normal revision tracking
6061per file, without requiring weird changes on `revcheck.php`. Note that
6162is *invalid* to place XML declaration in these fragment files, at least
62- in files that are invalid XML documents (on multi node rooted ones).
63+ in files that are invalid XML documents (on multi- node rooted ones).
6364
6465# Grouped entities files, file tracked
6566
6667For very small textual entities, down to simple text words or single
67- tag elements, that may never change, individual entity tracking is
68+ tag elements that may never change, individual entity tracking is
6869an overkill. This script also loads grouped XML Entities files, at
6970some expected locations, with specific semantics.
7071
7172These grouped files are really normal XML files, correctly annotated
72- with XML namespaces used on manual , so any individual exported entity
73- have correct anc clean XML namespace annotations. These grouped entity
73+ with XML namespaces used on manuals , so any individual exported entity
74+ has correct and clean XML namespace annotations. These grouped entity
7475files are tracked normally by revcheck, but are not directly included
7576in manual.xml.in, as they only participate in general entity loading,
7677described above.
9899
99100$ langs = [];
100101$ normal = true ; // Normal configure.php mode
101- $ debug = false ; // Detailed console mode
102102
103103for ( $ idx = 1 ; $ idx < count ( $ argv ) ; $ idx ++ )
104104 if ( $ argv [$ idx ] == "--debug " )
105- {
106105 $ normal = false ;
107- $ debug = true ;
108- }
109106 else
110107 $ langs [] = $ argv [$ idx ];
111108
109+ $ debug = ! $ normal ;
110+
112111if ( $ normal )
113112 print "Creating .entities.ent... " ;
114113else
@@ -154,12 +153,12 @@ class Entities
154153
155154 private static string $ filename = __DIR__ . "/../temp/entities.ent " ; // idempotent
156155
157- private static array $ entities = []; // All entities, overwriten
156+ private static array $ entities = []; // All entities, bi duplications
158157 private static array $ global = []; // Entities expected not replaced
159158 private static array $ replace = []; // Entities expected replaced / translated
160159 private static array $ remove = []; // Entities expected not replaced and not used
161160 private static array $ count = []; // Name / Count
162- private static array $ slow = []; // External entities, slow, uncontroled overwrite
161+ private static array $ slow = []; // External entities, slow, uncontrolled file overwrites
163162
164163 static function put ( string $ path , string $ name , string $ text , bool $ global = false , bool $ replace = false , bool $ remove = false )
165164 {
@@ -184,7 +183,7 @@ static function put( string $path , string $name , string $text , bool $global =
184183 static function slow ( string $ path )
185184 {
186185 if ( isset ( $ slow [$ path ] ) )
187- fwrite ( STDERR , "Unexpected physical file ovewrite : $ path \n" );
186+ fwrite ( STDERR , "Unexpected file overwrite : $ path \n" );
188187 $ slow [ $ path ] = $ path ;
189188 }
190189
0 commit comments