Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document and complement XInclude failures as warnings on translations #196

Merged
merged 2 commits into from
Dec 5, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions configure.php
Original file line number Diff line number Diff line change
Expand Up @@ -814,10 +814,16 @@ function getFileModificationHistory(): array {
}
}

{ # Automatic xi:include / xi:fallback fixups
if ( $ac['LANG'] != 'en' )
{
// XInclude failures are soft erros on translations, so replace
// residual XInclude tags on translations to keep then building.

$explain = false;

$xpath = new DOMXPath( $dom );
$nodes = $xpath->query( "//*[local-name()='include']" );
$xpath->registerNamespace( "xi" , "http://www.w3.org/2001/XInclude" );
$nodes = $xpath->query( "//xi:include" );
foreach( $nodes as $node )
{
$fixup = null;
Expand All @@ -831,8 +837,15 @@ function getFileModificationHistory(): array {
case "refsect1":
$fixup = "<title></title>";
break;
case "tbody":
$fixup = "<row><entry></entry></row>";
break;
// case "variablelist":
// $fixup = "<varlistentry><term>></term><listitem><simpara></simpara></listitem></varlistentry>";
// break;
default:
echo "Unknown parent element, validation may fail: $tagName\n";
echo "Unknown parent element at XInclude failure: $tagName\n";
$explain = true;
continue 2;
}
if ( $fixup != "" )
Expand All @@ -844,6 +857,17 @@ function getFileModificationHistory(): array {
}
$node->parentNode->removeChild( $node );
}

if ( $explain )
{
echo <<<MSG
\nIf you are seeing this message on a translation, this means that
XInclude/XPointers failures reported above are so many or unknown,
so that configure.php cannot patch the translated manual in a consistent
state. Please report this issue on the doc-base repository.\n\n
MSG;
exit(-1); // stop here, do not let more messages further confuse the matter
}
}

echo "Validating {$ac["INPUT_FILENAME"]}... ";
Expand Down
Loading