Skip to content

Commit 3ab4fe9

Browse files
authored
Warn/show failed XIncludes (#227)
1 parent bd3c7d6 commit 3ab4fe9

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

configure.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1001,13 +1001,21 @@ function xinclude_residual( DOMDocument $dom )
10011001
// XInclude failures are soft errors on translations, so remove
10021002
// residual XInclude tags on translations to keep them building.
10031003

1004+
$header = false;
10041005
$explain = false;
10051006

10061007
$xpath = new DOMXPath( $dom );
10071008
$xpath->registerNamespace( "xi" , "http://www.w3.org/2001/XInclude" );
10081009
$nodes = $xpath->query( "//xi:include" );
10091010
foreach( $nodes as $node )
10101011
{
1012+
if ( $header == false )
1013+
{
1014+
echo "\nFailed XInclude:\n";
1015+
$header = true;
1016+
}
1017+
echo "- {$node->getAttribute("xpointer")}\n";
1018+
10111019
$fixup = null;
10121020
$parent = $node->parentNode;
10131021
$tagName = $parent->nodeName;
@@ -1030,7 +1038,7 @@ function xinclude_residual( DOMDocument $dom )
10301038
$explain = true;
10311039
continue 2;
10321040
}
1033-
if ( $fixup != "" )
1041+
if ( $fixup !== null )
10341042
{
10351043
$other = new DOMDocument( '1.0' , 'utf8' );
10361044
$other->loadXML( "<f>$fixup</f>" );
@@ -1043,6 +1051,9 @@ function xinclude_residual( DOMDocument $dom )
10431051
$node->parentNode->removeChild( $node );
10441052
}
10451053

1054+
if ( $header )
1055+
echo "\n";
1056+
10461057
if ( $explain )
10471058
{
10481059
echo <<<MSG

0 commit comments

Comments
 (0)