This shortens some lines below 120 characters when a tab is
counted as 4 characters (not that line lengths are currently
counted like that).
Bug: T243598
Change-Id: I828cd540268810bd56589885e38ad03f8bafc6f9
This adds methods to ParserOutput ::addExtraCSPStyleSrc,
::addExtraCSPDefaultSrc, and ::addExtraCSPScriptSrc, to easily
allow parser tags/functions to add additional CSP sources if their
tag needs it. Previously such an extension would need to use
and OutputPage hook. This is modeled on how addModules() works.
The immediate use case is for Kartographer (T240960), although
its expected that lots of extensions might do something like this,
especially extensions used outside of Wikimedia.
Change-Id: I24e5f0b4edff58025a0c2a3e1a9aa3f62eb7db7b
Follows bb48ecbbc7.
This adds some documentation and renames the property that checks if a
non-string replacement has been used multiple times. The goal is to be
more mindful of other code that might inspect it.
A test is added to assert that the replacements are only cloned from the
second use onward, in case someone holds on to the inject object to
listen for clicks or something similar.
Change-Id: Icd1e06ed50f12483cf0884027e83dacf17eebb02
Allows .vue files to be used in package modules as if they were .js
files: they can be added to the 'packageFiles' array in module
definitions, and require()d from JS files.
In the load.php output, each .vue file is transformed to a function that
contains the JS from the <script> tag, then a line that sets
module.exports.template to the contents of the <template> tag (encoded
as a string). The contents of the <style> tag are added to the module's
styles.
Internally, the type of a .vue file is inferred as 'script-vue', and the
file is parsed with VueComponentParser, which extracts the three parts.
After the transformation, the file's type is set to 'script+style', and
files of this type contribute to both getScript() and getStyles().
This change also adds caching to getPackageFiles(), because it now needs
to be called twice (in getScript() and getStyles()).
Change-Id: Ic0a5c771901450a518eb7d24456053956507e1ed
Skins that are using ResourceLoaderSkinModule will need to update their
features to include `legacy`
Note that Ic7af947cfd5a5df4218f006232ede4ee7ed36c62 for Vector
and I6471bc169f3c2a1f51e17b8ee26ac245b0374c18 for Monobook should
be merged in the same release as this patch to ensure these styles
do not disappear from those skins. Minerva or Timeless will not be impacted.
Changes for other skins including Modern and CologneBlue to follow
where needed.
Bug: T242177
Change-Id: Icb910a563273bde92a09b1bb92857d5b6e348baa
A new documentation template exists on TranslateWiki:
https://translatewiki.net/wiki/Template:Doc-mediawiki-options-list
giving a central place to document the format of these messages
(which are already the same anyway).
Change-Id: I618444290a43b5dd19af0625106d0381826896e3
This file had six different almost-identical calls to the system
call file_get_contents(), which makes it hard to fix all nine of
them neatly.
Change-Id: I607f3cd3dbfa0f47f8d9766a27e581fdc127a0cf
The code was introduced in I5d35b6fddd7, which copied the
code from UploadWizard, but forgot about the localisation
message.
Change-Id: I8a7290bb6961a0a397b99427c5da2d4cbbe6f251
I added this in fdb7d36903 when DevelopmentSettings.php was fairly
basic and might have even been harmless to include in production
(unverified at this point).
The use case was easy injection by WMF CI and Travis CI,
but we never ended up using that. Both for CI and for local
development we have converged on the debuggable/non-magical way
of injecting it, which is explicitly placing it in LocalSettings.php
at the point where the developer is in control of it.
It also means it consistently applies no matter which script you
run, including on the web, which makes sense as the site settings
shouldn't change unexpectedly.
An alternative might be to make this configurable and only
available in a special development mode, and not in prod. However
that creates a bit of a paradox. If we require admins to place
something in LocalSettings to make this available, might as well
make that line of code be "require DevelopmentSettings.php",
equally easy to copy/paste and comment out.
Change-Id: Iffc58599581bf20b5880b7c57259e8b37ddf9dcb