[doc-base] master: Fix text-entities statistics, clean ups (#330)

From: Date: Mon, 03 Aug 2026 14:36:14 +0000
Subject: [doc-base] master: Fix text-entities statistics, clean ups (#330)
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-23531@lists.php.net to get a copy of this message
Author: alfsb (alfsb) Committer: GitHub (web-flow) Pusher: alfsb Date: 2026-08-03T11:36:12-03:00 Commit: https://github.com/php/doc-base/commit/f235f541e7feb34dc9d89cdc41dce7c49bb68cca Raw diff: https://github.com/php/doc-base/commit/f235f541e7feb34dc9d89cdc41dce7c49bb68cca.diff Fix text-entities statistics, clean ups (#330) * Fix text-entities statistics, clean ups * Tests in positive form, use direct count Changed paths: D entities/normal.ent-dist D entities/remove.ent-dist D entities/unique.ent-dist M scripts/revcheck.php M scripts/text-entities.php Diff: diff --git a/entities/normal.ent-dist b/entities/normal.ent-dist deleted file mode 100644 index ca5b02df42..0000000000 --- a/entities/normal.ent-dist +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="utf8" ?> -<!-- $Revision:$ --> -<!-- - -# Description - -This is a "normal" XML Entity file. -See doc-base/script/text-entities.php for details. - -Place here small entities that are expected to be translated. -For big or complex entities, please create an individual entity -file at doc-lang/entities/entityname.xml. - -# Examples - -<entity name="name">Direct text</entity> - -<entity name="name.name"> - Single-, multi- or text rooted XML fragment, as long as it is - a well-balanced one. Mind the XML namespaces of the root XML - element below. -</entity> - ---> - -<entities xmlns = "http://docbook.org/ns/docbook" - xmlns:xlink = "http://www.w3.org/1999/xlink" - translate = "yes"> - - -</entities> diff --git a/entities/remove.ent-dist b/entities/remove.ent-dist deleted file mode 100644 index 01c45b673e..0000000000 --- a/entities/remove.ent-dist +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0" encoding="utf8" ?><?phprevcheck no ?> -<!-- $Revision:$ --> -<!-- - -# Description - -This is a "remove" XML Entity file. -See doc-base/script/text-entities.php for details. - -Place here only deprecated entities that are expected NOT -be being used in any part of the manual. - -DO NOT COPY OR TRANSLATE THIS FILE. - -If an entity moved here is used in a language in your control, -this means that the entity on the original file is planned to be -removed, or already was removed. - -# Examples - -<entity name="name"></entity> - -<entity name="name.name"> - It may be necessary to preserve the original body to avoid - breakage in manual translations. -</entity> - ---> - -<entities xmlns = "http://docbook.org/ns/docbook" - xmlns:xlink = "http://www.w3.org/1999/xlink" - translate = "remove"> - - - -</entities> diff --git a/entities/unique.ent-dist b/entities/unique.ent-dist deleted file mode 100644 index 145e36a724..0000000000 --- a/entities/unique.ent-dist +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0" encoding="utf8" ?><?phprevcheck no ?> -<!-- $Revision:$ --> -<!-- - -# Description - -This is a "unique" XML Entity file. -See doc-base/script/text-entities.php for details. - -Place here only small entities that are expected NOT -being translated in any part of the manual. - -DO NOT COPY OR TRANSLATE THIS FILE. - -If you want/need to translate some entity placed here, -open an issue on doc-base or doc-en repository, so the -translatable entity is moved to a normal entity file. - -# Examples - -<entity name="name">Direct text</entity> - -<entity name="name.name"> - Single-, multi- or text rooted XML fragment, as long as it is - a well-balanced one. Mind the XML namespaces of <entities> - XML element below. -</entity> - ---> - -<entities xmlns = "http://docbook.org/ns/docbook" - xmlns:xlink = "http://www.w3.org/1999/xlink" - translate = "no"> - - - -</entities> diff --git a/scripts/revcheck.php b/scripts/revcheck.php index 6638b4d718..f2e1055eb3 100644 --- a/scripts/revcheck.php +++ b/scripts/revcheck.php @@ -42,10 +42,15 @@ exit; } -$lang = $argv[1]; -$revc = new RevcheckRun( 'en' , $argv[1] ); -$data = $revc->revData; +$lang = rtrim( $argv[1] , "/" ); +if ( $lang == 'en' ) +{ + print "{$argv[0]} cannot run on doc-en.\n"; + exit( 1 ); +} +$revc = new RevcheckRun( 'en' , $lang ); +$data = $revc->revData; print_html_all( $data ); // Output diff --git a/scripts/text-entities.php b/scripts/text-entities.php index 19bfea8d03..05d79cbf4a 100644 --- a/scripts/text-entities.php +++ b/scripts/text-entities.php @@ -225,46 +225,47 @@ static function checkReplaces( bool $debug ) foreach( Entities::$merged as $name => $null ) { - $replaced = Entities::$nameCount[$name] - 1; - $languages = Entities::$countLanguages; + $count = Entities::$nameCount[$name]; + $singleLang = Entities::$countLanguages == 1; + $translation = Entities::$countLanguages > 1; $entityUnique = in_array( $name , Entities::$unique ); $entityRemove = in_array( $name , Entities::$remove ); $entityNormal = ! ( $entityUnique || $entityRemove ); - if ( $entityUnique && $replaced != 0 ) + if ( $entityUnique && $count != 1 ) { Entities::$countOtherFailures++; if ( $debug ) - print " Unique entity, redefined $replaced times: $name\n"; + print " Unique entity, defined $count times: $name\n"; } - if ( $entityRemove && $replaced != 0 ) + if ( $entityRemove && $count != 1 ) { Entities::$countOtherFailures++; if ( $debug ) - print " Remove entity, redefined $replaced times: $name\n"; + print " Remove entity, defined $count times: $name\n"; } - if ( $entityNormal && $languages == 1 && $replaced != 0 ) + if ( $entityNormal && $count != 1 && $singleLang ) { Entities::$countOtherFailures++; if ( $debug ) - print " Normal entity, redefined $replaced times: $name\n"; + print " Normal entity, defined $count times: $name\n"; } - if ( $entityNormal && $languages != 1 ) + if ( $entityNormal && $translation ) { - if ( $replaced == 0 ) + if ( $count == 1 ) { Entities::$countTransFailures++; if ( $debug ) - print " Not translated: $name\n"; + print " Not translated: $name\n"; } - else + if ( $count > 2 ) { Entities::$countOtherFailures++; if ( $debug ) - print " Multiple redefined/translated: $name\n"; + print " Multiple redefined/translated: $name\n"; } } }

« previous php.doc.cvs (#23531) next »