Commit graph

8 commits

Author SHA1 Message Date
James D. Forrester
41f8acfd52 Coding style: Auto-fix MediaWiki.Commenting.DocComment.*
Change-Id: Iea5a07e10712723970a15008eb367e0af226fcc3
2020-01-10 12:28:12 -08:00
Timo Tijhof
fe11acb2a7 resourceloader: Document variable escape logic in LessVarFileModule
Also:
* Fix ref of CSSJanus that was meant to refer to CSSMin,
  and clarify that this is about LESS specifically (not related
  to CSS, and hence this is not something CSSMin can/should do),
  and that it isn't specific to less.php.

* Rename and invert excludeMessagesFromBlob as pluckFromMessageBlob
  so that we can express "get X" as "X" instead of "everything without Y".

* Remove the (object) cast from excludeMessagesFromBlob, which was specific
  to the use case of one of its callers (getMessageBlob) where it is now
  inlined.

Change-Id: Ia1667199aef6d383faeb213fb163cb0627d91f1e
2019-12-18 23:06:01 +00:00
Fomafix
705146d102 resourceloader: Add array type hints (2)
This change is a follow-up to a9823d16f6.

Change-Id: I80f570a98c02aa5521504262a6839e9241936db1
2019-10-10 04:58:16 +00:00
Fomafix
a9823d16f6 resourceloader: Add array type hints
Change-Id: I4844eae68e85adc46e52646ea066b459bbabdcce
2019-10-05 15:26:56 +00:00
Timo Tijhof
a5ce1d7792 resourceloader: Add Doxygen group and improve overall docs
* Add license header where missing.
* Add missing `@since` (1.17 for most classes), except
  ResourceLoaderLessVarFileModule since 1.32 (1bc62c548c).

* Remove duplicate file-level description for class-only files,
  merge with the class description instead.

* Remove my own `@author` annotation from one file.

* Mark core's own FileModule subclasses as `@internal`, except
  for the following which we support use of in extensions:
  ResourceLoaderLessVarFileModule,
  ResourceLoaderOOUIIconPackModule, and
  ResourceLoaderWikiModule.

Change-Id: I336af2e4ccdbe2512594e8861b72628d24194e41
2019-09-14 18:37:36 +00:00
Umherirrender
9fa4b4ebdb resourceloader: Fix return type in ResourceLoader-related classes
Change-Id: I543e321129cf8fadc1159017b622528f462ea116
2019-06-18 20:20:34 +00:00
Fomafix
ce6ae6ada0 ResourceLoaderLessVarFileModule: Add parameter 'lessMessages'
This change allows to add internationalized messages into CSS. The new
parameter 'lessMessages' contains the array of message keys that get
set as Less variables.

In Less the variables must enclosed in double quotes (") or single
quotes (') to prevent CSS injection.

Example usage:
Resources:
	"class": "ResourceLoaderLessVarFileModule",
	"lessMessages": [ "editsection" ],
Message 'editsection':
	edit
Less file:
	content: '[@{msg-editsection}]';
Generated CSS file:
	content: '[edit]';

Also add a type case (object) to ensure that an empty object is
serialized as '{}' and not as '[]'.

Also include Less variables from parent.

Change-Id: I280b52c6745fe8e5755dc5d58c5621a64757d99d
2018-05-12 17:46:15 +02:00
jdlrobson
1bc62c548c Introduce ResourceLoaderLessVarFileModule
This ResourceLoader module provides a way to ship
messages to CSS variables.

We will need this going forward to deal with flash of
unstyled content in various JavaScript based UIs that
are subject to i18n such as table sorting and
collapsible elements.

To avoid overhead of hitting the database to fetch and
transform localisation messages we make use of the MessageBlobStore
making use of `messages` definition already inside
ResourceLoaderFileModule. Given this resource is only intended
for render blocking styles without JavaScript this should be okay
(although if requested in JavaScript will also ship associated
messages)

Bug: T42812
Change-Id: I2bf12cdc848478889acbe9a7a970e46f8aefa287
2018-04-25 11:27:11 -07:00