Skip to content

Commit dfcbb86

Browse files
authored
Document and complement XInclude failures as warnings on translations (#196)
1 parent 9d68f54 commit dfcbb86

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

configure.php

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -814,10 +814,16 @@ function getFileModificationHistory(): array {
814814
}
815815
}
816816

817-
{ # Automatic xi:include / xi:fallback fixups
817+
if ( $ac['LANG'] != 'en' )
818+
{
819+
// XInclude failures are soft errors on translations, so remove
820+
// residual XInclude tags on translations to keep them building.
821+
822+
$explain = false;
818823

819824
$xpath = new DOMXPath( $dom );
820-
$nodes = $xpath->query( "//*[local-name()='include']" );
825+
$xpath->registerNamespace( "xi" , "http://www.w3.org/2001/XInclude" );
826+
$nodes = $xpath->query( "//xi:include" );
821827
foreach( $nodes as $node )
822828
{
823829
$fixup = null;
@@ -831,8 +837,15 @@ function getFileModificationHistory(): array {
831837
case "refsect1":
832838
$fixup = "<title></title>";
833839
break;
840+
case "tbody":
841+
$fixup = "<row><entry></entry></row>";
842+
break;
843+
// case "variablelist":
844+
// $fixup = "<varlistentry><term>></term><listitem><simpara></simpara></listitem></varlistentry>";
845+
// break;
834846
default:
835-
echo "Unknown parent element, validation may fail: $tagName\n";
847+
echo "Unknown parent element of failed XInclude: $tagName\n";
848+
$explain = true;
836849
continue 2;
837850
}
838851
if ( $fixup != "" )
@@ -844,6 +857,18 @@ function getFileModificationHistory(): array {
844857
}
845858
$node->parentNode->removeChild( $node );
846859
}
860+
861+
if ( $explain )
862+
{
863+
echo <<<MSG
864+
\nIf you are seeing this message on a translation, this means that
865+
XInclude/XPointers failures reported above are so many or unknown,
866+
that configure.php cannot patch the translated manual into a validating
867+
state. Please report any "Unknown parent" messages on the doc-base
868+
repository, and focus on fixing XInclude/XPointers failures above.\n\n
869+
MSG;
870+
exit(-1); // stop here, do not let more messages further confuse the matter
871+
}
847872
}
848873

849874
echo "Validating {$ac["INPUT_FILENAME"]}... ";

0 commit comments

Comments
 (0)