From 21cb2b25735943f55c5ecce58fdd55ff8e326544 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20L=20F=20S=20Bacci?= Date: Sat, 25 Jul 2026 12:39:56 -0300 Subject: [PATCH 1/2] Fix text-entities statistics, clean ups --- entities/normal.ent-dist | 31 ------------------------------- entities/remove.ent-dist | 36 ------------------------------------ entities/unique.ent-dist | 37 ------------------------------------- scripts/revcheck.php | 11 ++++++++--- scripts/text-entities.php | 32 ++++++++++++++++---------------- 5 files changed, 24 insertions(+), 123 deletions(-) delete mode 100644 entities/normal.ent-dist delete mode 100644 entities/remove.ent-dist delete mode 100644 entities/unique.ent-dist 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 @@ - - - - - - - - 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 @@ - - - - - - - - - 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 @@ - - - - - - - - - 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..187b8655d2 100644 --- a/scripts/text-entities.php +++ b/scripts/text-entities.php @@ -225,48 +225,48 @@ static function checkReplaces( bool $debug ) foreach( Entities::$merged as $name => $null ) { - $replaced = Entities::$nameCount[$name] - 1; - $languages = Entities::$countLanguages; + $replaces = Entities::$nameCount[$name] - 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 && $replaces != 0 ) { Entities::$countOtherFailures++; if ( $debug ) - print " Unique entity, redefined $replaced times: $name\n"; + print " Unique entity, redefined $replaces times: $name\n"; } - if ( $entityRemove && $replaced != 0 ) + if ( $entityRemove && $replaces != 0 ) { Entities::$countOtherFailures++; if ( $debug ) - print " Remove entity, redefined $replaced times: $name\n"; + print " Remove entity, redefined $replaces times: $name\n"; } - if ( $entityNormal && $languages == 1 && $replaced != 0 ) + if ( $entityNormal && $translation ) { - Entities::$countOtherFailures++; - if ( $debug ) - print " Normal entity, redefined $replaced times: $name\n"; - } - - if ( $entityNormal && $languages != 1 ) - { - if ( $replaced == 0 ) + if ( $replaces == 0 ) { Entities::$countTransFailures++; if ( $debug ) print " Not translated: $name\n"; } - else + if ( $replaces > 1 ) { Entities::$countOtherFailures++; if ( $debug ) print " Multiple redefined/translated: $name\n"; } } + + if ( $entityNormal && ! $translation && $replaces != 0 ) + { + Entities::$countOtherFailures++; + if ( $debug ) + print " Multiple redefined/translated: $name\n"; + } } } } From 10774f769e8cbccd18ce2a2ea7c3d357bf6c8e2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20L=20F=20S=20Bacci?= Date: Mon, 27 Jul 2026 15:38:20 -0300 Subject: [PATCH 2/2] Tests in positive form, use direct count --- scripts/text-entities.php | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/scripts/text-entities.php b/scripts/text-entities.php index 187b8655d2..05d79cbf4a 100644 --- a/scripts/text-entities.php +++ b/scripts/text-entities.php @@ -225,48 +225,49 @@ static function checkReplaces( bool $debug ) foreach( Entities::$merged as $name => $null ) { - $replaces = Entities::$nameCount[$name] - 1; + $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 && $replaces != 0 ) + if ( $entityUnique && $count != 1 ) { Entities::$countOtherFailures++; if ( $debug ) - print " Unique entity, redefined $replaces times: $name\n"; + print " Unique entity, defined $count times: $name\n"; } - if ( $entityRemove && $replaces != 0 ) + if ( $entityRemove && $count != 1 ) { Entities::$countOtherFailures++; if ( $debug ) - print " Remove entity, redefined $replaces times: $name\n"; + print " Remove entity, defined $count times: $name\n"; + } + + if ( $entityNormal && $count != 1 && $singleLang ) + { + Entities::$countOtherFailures++; + if ( $debug ) + print " Normal entity, defined $count times: $name\n"; } if ( $entityNormal && $translation ) { - if ( $replaces == 0 ) + if ( $count == 1 ) { Entities::$countTransFailures++; if ( $debug ) - print " Not translated: $name\n"; + print " Not translated: $name\n"; } - if ( $replaces > 1 ) + if ( $count > 2 ) { Entities::$countOtherFailures++; if ( $debug ) - print " Multiple redefined/translated: $name\n"; + print " Multiple redefined/translated: $name\n"; } } - - if ( $entityNormal && ! $translation && $replaces != 0 ) - { - Entities::$countOtherFailures++; - if ( $debug ) - print " Multiple redefined/translated: $name\n"; - } } } }