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
This commit is contained in:
thiemowmde 2024-07-19 15:00:01 +02:00
parent f1bd3175fd
commit 5ef0ccdaa6
29 changed files with 2 additions and 100 deletions

View file

@ -1 +0,0 @@
@import 'ext.cite.parsoid.comma-instead-of-dot.less';

View file

@ -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 );
}

View file

@ -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 );
}

View file

@ -1 +0,0 @@
@import 'ext.cite.parsoid.comma-instead-of-dot.less';

View file

@ -1 +0,0 @@
@import 'ext.cite.parsoid.comma-instead-of-dot.less';

View file

@ -1 +0,0 @@
@import 'ext.cite.parsoid.comma-instead-of-dot.less';

View file

@ -1 +0,0 @@
@import 'ext.cite.parsoid.comma-instead-of-dot.less';

View file

@ -1 +0,0 @@
@import 'ext.cite.parsoid.comma-instead-of-dot.less';

View file

@ -1 +0,0 @@
@import 'ext.cite.parsoid.comma-instead-of-dot.less';

View file

@ -1 +0,0 @@
@import 'ext.cite.parsoid.comma-instead-of-dot.less';

View file

@ -1 +0,0 @@
@import 'ext.cite.parsoid.comma-instead-of-dot.less';

View file

@ -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 );
}

View file

@ -1 +0,0 @@
@import 'ext.cite.parsoid.comma-instead-of-dot.less';

View file

@ -1 +0,0 @@
@import 'ext.cite.parsoid.comma-instead-of-dot.less';

View file

@ -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 );
}

View file

@ -1 +0,0 @@
@import 'ext.cite.parsoid.comma-instead-of-dot.less';

View file

@ -1 +0,0 @@
@import 'ext.cite.parsoid.comma-instead-of-dot.less';

View file

@ -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 );
}

View file

@ -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 );
}

View file

@ -1 +0,0 @@
@import 'ext.cite.parsoid.comma-instead-of-dot.less';

View file

@ -1 +0,0 @@
@import 'ext.cite.parsoid.comma-instead-of-dot.less';

View file

@ -1 +0,0 @@
@import 'ext.cite.parsoid.comma-instead-of-dot.less';

View file

@ -1 +0,0 @@
@import 'ext.cite.parsoid.comma-instead-of-dot.less';

View file

@ -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 );
}

View file

@ -1 +0,0 @@
@import 'ext.cite.parsoid.comma-instead-of-dot.less';

View file

@ -1 +0,0 @@
@import 'ext.cite.parsoid.comma-instead-of-dot.less';

View file

@ -1 +0,0 @@
@import 'ext.cite.parsoid.comma-instead-of-dot.less';

View file

@ -1 +0,0 @@
@import 'ext.cite.parsoid.comma-instead-of-dot.less';

View file

@ -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'] );
}
}