Trim the XML output file - #321
Conversation
|
Got curious, and tested each reduction. |
| See mentions of 'docbookwsi' on source code for parts that need to be | ||
| updated if/when a new version of Docbook is used. */ | ||
|
|
||
| $arg0 = array_shift( $argv ) ?? null; |
There was a problem hiding this comment.
This variable should be $argv0, print below will give Undefined variable $argv0.
|
|
||
| if ( $rngFile == null ) | ||
| { | ||
| print "Usage: '$argv0' rngFile [xmlFile]\n\n"; |
There was a problem hiding this comment.
What parameters did you use to test this and determine the list? Perhaps we should document that.
I tried it using this, and it seems to work fine.
php docbook/docbookwsi.php docbook/docbook-5.2.1/rng/docbook.rng .manual.xml
| // These first five elements account for almost 50% | ||
| // of all insignificant Docbook whitespace in manual. | ||
|
|
||
| $trimList[] = 'refsect1'; |
There was a problem hiding this comment.
I prefer to use this form given it's a static array. But that's preference.
$trimList = [
// These first five elements account for almost 50%
// of all insignificant Docbook whitespace in manual.
'refsect1',
'varlistentry',
'...',
];|
I'm delaying the merging of this PR, for now. There are some warnings being silenced on configure.php, and it is easier to check for insignificant differences without a change like this. |
|
Rebased. Trim doctype, comments and duplicated namespaces. Removed trim of inter element whitespaces for now, as to avoid surfacing new PhD render errors. Final reductions:
Also, exports DOCTYPE node as doc-base/temp/doctype.dtd, so code that needs to know all DTD entities used in manuals can consult this file. Comments and reviews are welcome. Plan to merge this in one week. |
This PR trims the generated Docbook XML file of PHP Manual, assembled by doc-base/configure.php. It strips:
Statistics:
I'm surprised that the time increase is so small, but more surprised to see a reduction in Maximum resident set size. This means that the peak memory occurs later in configure (or any of its subs scripts), after the initial assembly.
Testing with PhD will be done in future. I expect no functional changes, but a full test is necessary anyways. PhD developers may need to check this very critically. Included a tool to recalculate the list, in the case the RNGs are updated.
Comments and reviews are welcome. Plan to wait at least two weeks before merging.