From 5ef0ccdaa6dc5f49b6174db4421561b02bbbbce9 Mon Sep 17 00:00:00 2001 From: thiemowmde Date: Fri, 19 Jul 2024 15:00:01 +0200 Subject: [PATCH] Drop redundant fallbacks from parsoid-styles directory These .less files are pointless because these languages have fallbacks, and the .less file for the fallback is identical. The behavior on the cluster will not change when we remove these files. Another file with the same rules will be loaded instead. I made this patch algorithmically by writing a piece of code that iterates all existing .less files, checks if the language does have fallbacks, and if one of the fallback .less files is identical. I also updated the existing test case to reflect what's going on. Change-Id: Iab647956f7bf45e59da1af33ff2b3e81ad016b4c --- modules/parsoid-styles/ext.cite.style.be_tarask.less | 1 - modules/parsoid-styles/ext.cite.style.blk.less | 11 ----------- modules/parsoid-styles/ext.cite.style.bpy.less | 11 ----------- modules/parsoid-styles/ext.cite.style.ca.less | 1 - modules/parsoid-styles/ext.cite.style.crh_cyrl.less | 1 - modules/parsoid-styles/ext.cite.style.cs.less | 1 - modules/parsoid-styles/ext.cite.style.de_ch.less | 1 - modules/parsoid-styles/ext.cite.style.frp.less | 1 - modules/parsoid-styles/ext.cite.style.fur.less | 1 - modules/parsoid-styles/ext.cite.style.gl.less | 1 - modules/parsoid-styles/ext.cite.style.kaa.less | 1 - modules/parsoid-styles/ext.cite.style.kjp.less | 11 ----------- modules/parsoid-styles/ext.cite.style.kk_latn.less | 1 - modules/parsoid-styles/ext.cite.style.ksh.less | 1 - modules/parsoid-styles/ext.cite.style.ksw.less | 11 ----------- modules/parsoid-styles/ext.cite.style.lbe.less | 1 - modules/parsoid-styles/ext.cite.style.ln.less | 1 - modules/parsoid-styles/ext.cite.style.mag.less | 11 ----------- modules/parsoid-styles/ext.cite.style.mnw.less | 11 ----------- modules/parsoid-styles/ext.cite.style.nb.less | 1 - modules/parsoid-styles/ext.cite.style.nds.less | 1 - modules/parsoid-styles/ext.cite.style.oc.less | 1 - modules/parsoid-styles/ext.cite.style.pt.less | 1 - modules/parsoid-styles/ext.cite.style.sa.less | 11 ----------- modules/parsoid-styles/ext.cite.style.sah.less | 1 - modules/parsoid-styles/ext.cite.style.se.less | 1 - modules/parsoid-styles/ext.cite.style.udm.less | 1 - modules/parsoid-styles/ext.cite.style.wa.less | 1 - tests/phpunit/CiteCSSFileModuleTest.php | 4 ++-- 29 files changed, 2 insertions(+), 100 deletions(-) delete mode 100644 modules/parsoid-styles/ext.cite.style.be_tarask.less delete mode 100644 modules/parsoid-styles/ext.cite.style.blk.less delete mode 100644 modules/parsoid-styles/ext.cite.style.bpy.less delete mode 100644 modules/parsoid-styles/ext.cite.style.ca.less delete mode 100644 modules/parsoid-styles/ext.cite.style.crh_cyrl.less delete mode 100644 modules/parsoid-styles/ext.cite.style.cs.less delete mode 100644 modules/parsoid-styles/ext.cite.style.de_ch.less delete mode 100644 modules/parsoid-styles/ext.cite.style.frp.less delete mode 100644 modules/parsoid-styles/ext.cite.style.fur.less delete mode 100644 modules/parsoid-styles/ext.cite.style.gl.less delete mode 100644 modules/parsoid-styles/ext.cite.style.kaa.less delete mode 100644 modules/parsoid-styles/ext.cite.style.kjp.less delete mode 100644 modules/parsoid-styles/ext.cite.style.kk_latn.less delete mode 100644 modules/parsoid-styles/ext.cite.style.ksh.less delete mode 100644 modules/parsoid-styles/ext.cite.style.ksw.less delete mode 100644 modules/parsoid-styles/ext.cite.style.lbe.less delete mode 100644 modules/parsoid-styles/ext.cite.style.ln.less delete mode 100644 modules/parsoid-styles/ext.cite.style.mag.less delete mode 100644 modules/parsoid-styles/ext.cite.style.mnw.less delete mode 100644 modules/parsoid-styles/ext.cite.style.nb.less delete mode 100644 modules/parsoid-styles/ext.cite.style.nds.less delete mode 100644 modules/parsoid-styles/ext.cite.style.oc.less delete mode 100644 modules/parsoid-styles/ext.cite.style.pt.less delete mode 100644 modules/parsoid-styles/ext.cite.style.sa.less delete mode 100644 modules/parsoid-styles/ext.cite.style.sah.less delete mode 100644 modules/parsoid-styles/ext.cite.style.se.less delete mode 100644 modules/parsoid-styles/ext.cite.style.udm.less delete mode 100644 modules/parsoid-styles/ext.cite.style.wa.less diff --git a/modules/parsoid-styles/ext.cite.style.be_tarask.less b/modules/parsoid-styles/ext.cite.style.be_tarask.less deleted file mode 100644 index 54ee3f257..000000000 --- a/modules/parsoid-styles/ext.cite.style.be_tarask.less +++ /dev/null @@ -1 +0,0 @@ -@import 'ext.cite.parsoid.comma-instead-of-dot.less'; diff --git a/modules/parsoid-styles/ext.cite.style.blk.less b/modules/parsoid-styles/ext.cite.style.blk.less deleted file mode 100644 index f93ebf561..000000000 --- a/modules/parsoid-styles/ext.cite.style.blk.less +++ /dev/null @@ -1,11 +0,0 @@ -.mw-ref > a[ style~='mw-Ref' ]::after { - content: '[' counter( mw-Ref, myanmar ) ']'; -} - -.mw-ref > a[ style~='mw-Ref' ][ data-mw-group ]::after { - content: '[' attr( data-mw-group ) ' ' counter( mw-Ref, myanmar ) ']'; -} - -span[ rel='mw:referencedBy' ] > a::before { - content: counter( mw-references, myanmar ) '.' counter( mw-ref-linkback, myanmar ); -} diff --git a/modules/parsoid-styles/ext.cite.style.bpy.less b/modules/parsoid-styles/ext.cite.style.bpy.less deleted file mode 100644 index ba0210ada..000000000 --- a/modules/parsoid-styles/ext.cite.style.bpy.less +++ /dev/null @@ -1,11 +0,0 @@ -.mw-ref > a[ style~='mw-Ref' ]::after { - content: '[' counter( mw-Ref, bengali ) ']'; -} - -.mw-ref > a[ style~='mw-Ref' ][ data-mw-group ]::after { - content: '[' attr( data-mw-group ) ' ' counter( mw-Ref, bengali ) ']'; -} - -span[ rel='mw:referencedBy' ] > a::before { - content: counter( mw-references, bengali ) '.' counter( mw-ref-linkback, bengali ); -} diff --git a/modules/parsoid-styles/ext.cite.style.ca.less b/modules/parsoid-styles/ext.cite.style.ca.less deleted file mode 100644 index 54ee3f257..000000000 --- a/modules/parsoid-styles/ext.cite.style.ca.less +++ /dev/null @@ -1 +0,0 @@ -@import 'ext.cite.parsoid.comma-instead-of-dot.less'; diff --git a/modules/parsoid-styles/ext.cite.style.crh_cyrl.less b/modules/parsoid-styles/ext.cite.style.crh_cyrl.less deleted file mode 100644 index 54ee3f257..000000000 --- a/modules/parsoid-styles/ext.cite.style.crh_cyrl.less +++ /dev/null @@ -1 +0,0 @@ -@import 'ext.cite.parsoid.comma-instead-of-dot.less'; diff --git a/modules/parsoid-styles/ext.cite.style.cs.less b/modules/parsoid-styles/ext.cite.style.cs.less deleted file mode 100644 index 54ee3f257..000000000 --- a/modules/parsoid-styles/ext.cite.style.cs.less +++ /dev/null @@ -1 +0,0 @@ -@import 'ext.cite.parsoid.comma-instead-of-dot.less'; diff --git a/modules/parsoid-styles/ext.cite.style.de_ch.less b/modules/parsoid-styles/ext.cite.style.de_ch.less deleted file mode 100644 index 54ee3f257..000000000 --- a/modules/parsoid-styles/ext.cite.style.de_ch.less +++ /dev/null @@ -1 +0,0 @@ -@import 'ext.cite.parsoid.comma-instead-of-dot.less'; diff --git a/modules/parsoid-styles/ext.cite.style.frp.less b/modules/parsoid-styles/ext.cite.style.frp.less deleted file mode 100644 index 54ee3f257..000000000 --- a/modules/parsoid-styles/ext.cite.style.frp.less +++ /dev/null @@ -1 +0,0 @@ -@import 'ext.cite.parsoid.comma-instead-of-dot.less'; diff --git a/modules/parsoid-styles/ext.cite.style.fur.less b/modules/parsoid-styles/ext.cite.style.fur.less deleted file mode 100644 index 54ee3f257..000000000 --- a/modules/parsoid-styles/ext.cite.style.fur.less +++ /dev/null @@ -1 +0,0 @@ -@import 'ext.cite.parsoid.comma-instead-of-dot.less'; diff --git a/modules/parsoid-styles/ext.cite.style.gl.less b/modules/parsoid-styles/ext.cite.style.gl.less deleted file mode 100644 index 54ee3f257..000000000 --- a/modules/parsoid-styles/ext.cite.style.gl.less +++ /dev/null @@ -1 +0,0 @@ -@import 'ext.cite.parsoid.comma-instead-of-dot.less'; diff --git a/modules/parsoid-styles/ext.cite.style.kaa.less b/modules/parsoid-styles/ext.cite.style.kaa.less deleted file mode 100644 index 54ee3f257..000000000 --- a/modules/parsoid-styles/ext.cite.style.kaa.less +++ /dev/null @@ -1 +0,0 @@ -@import 'ext.cite.parsoid.comma-instead-of-dot.less'; diff --git a/modules/parsoid-styles/ext.cite.style.kjp.less b/modules/parsoid-styles/ext.cite.style.kjp.less deleted file mode 100644 index f93ebf561..000000000 --- a/modules/parsoid-styles/ext.cite.style.kjp.less +++ /dev/null @@ -1,11 +0,0 @@ -.mw-ref > a[ style~='mw-Ref' ]::after { - content: '[' counter( mw-Ref, myanmar ) ']'; -} - -.mw-ref > a[ style~='mw-Ref' ][ data-mw-group ]::after { - content: '[' attr( data-mw-group ) ' ' counter( mw-Ref, myanmar ) ']'; -} - -span[ rel='mw:referencedBy' ] > a::before { - content: counter( mw-references, myanmar ) '.' counter( mw-ref-linkback, myanmar ); -} diff --git a/modules/parsoid-styles/ext.cite.style.kk_latn.less b/modules/parsoid-styles/ext.cite.style.kk_latn.less deleted file mode 100644 index 54ee3f257..000000000 --- a/modules/parsoid-styles/ext.cite.style.kk_latn.less +++ /dev/null @@ -1 +0,0 @@ -@import 'ext.cite.parsoid.comma-instead-of-dot.less'; diff --git a/modules/parsoid-styles/ext.cite.style.ksh.less b/modules/parsoid-styles/ext.cite.style.ksh.less deleted file mode 100644 index 54ee3f257..000000000 --- a/modules/parsoid-styles/ext.cite.style.ksh.less +++ /dev/null @@ -1 +0,0 @@ -@import 'ext.cite.parsoid.comma-instead-of-dot.less'; diff --git a/modules/parsoid-styles/ext.cite.style.ksw.less b/modules/parsoid-styles/ext.cite.style.ksw.less deleted file mode 100644 index f93ebf561..000000000 --- a/modules/parsoid-styles/ext.cite.style.ksw.less +++ /dev/null @@ -1,11 +0,0 @@ -.mw-ref > a[ style~='mw-Ref' ]::after { - content: '[' counter( mw-Ref, myanmar ) ']'; -} - -.mw-ref > a[ style~='mw-Ref' ][ data-mw-group ]::after { - content: '[' attr( data-mw-group ) ' ' counter( mw-Ref, myanmar ) ']'; -} - -span[ rel='mw:referencedBy' ] > a::before { - content: counter( mw-references, myanmar ) '.' counter( mw-ref-linkback, myanmar ); -} diff --git a/modules/parsoid-styles/ext.cite.style.lbe.less b/modules/parsoid-styles/ext.cite.style.lbe.less deleted file mode 100644 index 54ee3f257..000000000 --- a/modules/parsoid-styles/ext.cite.style.lbe.less +++ /dev/null @@ -1 +0,0 @@ -@import 'ext.cite.parsoid.comma-instead-of-dot.less'; diff --git a/modules/parsoid-styles/ext.cite.style.ln.less b/modules/parsoid-styles/ext.cite.style.ln.less deleted file mode 100644 index 54ee3f257..000000000 --- a/modules/parsoid-styles/ext.cite.style.ln.less +++ /dev/null @@ -1 +0,0 @@ -@import 'ext.cite.parsoid.comma-instead-of-dot.less'; diff --git a/modules/parsoid-styles/ext.cite.style.mag.less b/modules/parsoid-styles/ext.cite.style.mag.less deleted file mode 100644 index d6820184f..000000000 --- a/modules/parsoid-styles/ext.cite.style.mag.less +++ /dev/null @@ -1,11 +0,0 @@ -.mw-ref > a[ style~='mw-Ref' ]::after { - content: '[' counter( mw-Ref, devanagari ) ']'; -} - -.mw-ref > a[ style~='mw-Ref' ][ data-mw-group ]::after { - content: '[' attr( data-mw-group ) ' ' counter( mw-Ref, devanagari ) ']'; -} - -span[ rel='mw:referencedBy' ] > a::before { - content: counter( mw-references, devanagari ) '.' counter( mw-ref-linkback, devanagari ); -} diff --git a/modules/parsoid-styles/ext.cite.style.mnw.less b/modules/parsoid-styles/ext.cite.style.mnw.less deleted file mode 100644 index f93ebf561..000000000 --- a/modules/parsoid-styles/ext.cite.style.mnw.less +++ /dev/null @@ -1,11 +0,0 @@ -.mw-ref > a[ style~='mw-Ref' ]::after { - content: '[' counter( mw-Ref, myanmar ) ']'; -} - -.mw-ref > a[ style~='mw-Ref' ][ data-mw-group ]::after { - content: '[' attr( data-mw-group ) ' ' counter( mw-Ref, myanmar ) ']'; -} - -span[ rel='mw:referencedBy' ] > a::before { - content: counter( mw-references, myanmar ) '.' counter( mw-ref-linkback, myanmar ); -} diff --git a/modules/parsoid-styles/ext.cite.style.nb.less b/modules/parsoid-styles/ext.cite.style.nb.less deleted file mode 100644 index 54ee3f257..000000000 --- a/modules/parsoid-styles/ext.cite.style.nb.less +++ /dev/null @@ -1 +0,0 @@ -@import 'ext.cite.parsoid.comma-instead-of-dot.less'; diff --git a/modules/parsoid-styles/ext.cite.style.nds.less b/modules/parsoid-styles/ext.cite.style.nds.less deleted file mode 100644 index 54ee3f257..000000000 --- a/modules/parsoid-styles/ext.cite.style.nds.less +++ /dev/null @@ -1 +0,0 @@ -@import 'ext.cite.parsoid.comma-instead-of-dot.less'; diff --git a/modules/parsoid-styles/ext.cite.style.oc.less b/modules/parsoid-styles/ext.cite.style.oc.less deleted file mode 100644 index 54ee3f257..000000000 --- a/modules/parsoid-styles/ext.cite.style.oc.less +++ /dev/null @@ -1 +0,0 @@ -@import 'ext.cite.parsoid.comma-instead-of-dot.less'; diff --git a/modules/parsoid-styles/ext.cite.style.pt.less b/modules/parsoid-styles/ext.cite.style.pt.less deleted file mode 100644 index 54ee3f257..000000000 --- a/modules/parsoid-styles/ext.cite.style.pt.less +++ /dev/null @@ -1 +0,0 @@ -@import 'ext.cite.parsoid.comma-instead-of-dot.less'; diff --git a/modules/parsoid-styles/ext.cite.style.sa.less b/modules/parsoid-styles/ext.cite.style.sa.less deleted file mode 100644 index d6820184f..000000000 --- a/modules/parsoid-styles/ext.cite.style.sa.less +++ /dev/null @@ -1,11 +0,0 @@ -.mw-ref > a[ style~='mw-Ref' ]::after { - content: '[' counter( mw-Ref, devanagari ) ']'; -} - -.mw-ref > a[ style~='mw-Ref' ][ data-mw-group ]::after { - content: '[' attr( data-mw-group ) ' ' counter( mw-Ref, devanagari ) ']'; -} - -span[ rel='mw:referencedBy' ] > a::before { - content: counter( mw-references, devanagari ) '.' counter( mw-ref-linkback, devanagari ); -} diff --git a/modules/parsoid-styles/ext.cite.style.sah.less b/modules/parsoid-styles/ext.cite.style.sah.less deleted file mode 100644 index 54ee3f257..000000000 --- a/modules/parsoid-styles/ext.cite.style.sah.less +++ /dev/null @@ -1 +0,0 @@ -@import 'ext.cite.parsoid.comma-instead-of-dot.less'; diff --git a/modules/parsoid-styles/ext.cite.style.se.less b/modules/parsoid-styles/ext.cite.style.se.less deleted file mode 100644 index 54ee3f257..000000000 --- a/modules/parsoid-styles/ext.cite.style.se.less +++ /dev/null @@ -1 +0,0 @@ -@import 'ext.cite.parsoid.comma-instead-of-dot.less'; diff --git a/modules/parsoid-styles/ext.cite.style.udm.less b/modules/parsoid-styles/ext.cite.style.udm.less deleted file mode 100644 index 54ee3f257..000000000 --- a/modules/parsoid-styles/ext.cite.style.udm.less +++ /dev/null @@ -1 +0,0 @@ -@import 'ext.cite.parsoid.comma-instead-of-dot.less'; diff --git a/modules/parsoid-styles/ext.cite.style.wa.less b/modules/parsoid-styles/ext.cite.style.wa.less deleted file mode 100644 index 54ee3f257..000000000 --- a/modules/parsoid-styles/ext.cite.style.wa.less +++ /dev/null @@ -1 +0,0 @@ -@import 'ext.cite.parsoid.comma-instead-of-dot.less'; diff --git a/tests/phpunit/CiteCSSFileModuleTest.php b/tests/phpunit/CiteCSSFileModuleTest.php index 6085b91cd..c7bf3e556 100644 --- a/tests/phpunit/CiteCSSFileModuleTest.php +++ b/tests/phpunit/CiteCSSFileModuleTest.php @@ -16,14 +16,14 @@ class CiteCSSFileModuleTest extends \MediaWikiIntegrationTestCase { $this->setService( 'ContentLanguage', - $this->getServiceContainer()->getLanguageFactory()->getLanguage( 'fa' ) + $this->getServiceContainer()->getLanguageFactory()->getLanguage( 'wa' ) ); } public function testModule() { $module = new CiteCSSFileModule( [], __DIR__ . '/../../modules/parsoid-styles' ); $styles = $module->getStyleFiles( $this->createMock( Context::class ) ); - $this->assertSame( [ 'ext.cite.style.fa.less' ], $styles['all'] ); + $this->assertSame( [ 'ext.cite.style.fr.less' ], $styles['all'] ); } }