Commit graph

1989 commits

Author SHA1 Message Date
Fomafix 70605bf630 Replace global configuration variables
Use overrideConfigValues instead of setMwGlobals in tests.

Change-Id: Icaf7d8d9bb3a4c1eb981ef83a12719c2619039fa
2024-03-18 04:40:44 +00:00
Translation updater bot 076bcb2711 Localisation updates from https://translatewiki.net.
Change-Id: Iff42fe808157a18b87b3ac95f0691392ad75ee52
2024-03-11 08:27:59 +01:00
Umherirrender 09f2905ae6 build: Upgrade mediawiki/mediawiki-codesniffer to v43.0.0
Change-Id: Idf24dd1742439d80aaecc308eda386a1afbb0bdc
2024-03-10 23:46:30 +01:00
Translation updater bot c03d734c06 Localisation updates from https://translatewiki.net.
Change-Id: Iac5c367637c2791dcb1331e58db181e4d20c7d6f
2024-03-08 08:23:37 +01:00
Translation updater bot 64ed675207 Localisation updates from https://translatewiki.net.
Change-Id: I28fee3c666762fa985e8a9e44aff65f17a2ad1cb
2024-03-06 08:20:15 +01:00
Translation updater bot 45bbb57fa2 Localisation updates from https://translatewiki.net.
Change-Id: I83ff75f88411608b1f09745f5e9c28a4c737afc4
2024-03-05 08:28:20 +01:00
Translation updater bot 5e57c5478a Localisation updates from https://translatewiki.net.
Change-Id: I042970d541bf263c343be99420553a36950a0e00
2024-03-04 08:24:09 +01:00
Siddharth VP e6cf6bb161 Allow localising content model name
Define the content-model-$model message which is used by
ContentHandler::getLocalizedName.

Bug: T358341
Depends-On: I0f090f21ce2b0f6d92790ae9f2b755dabb2e7082
Change-Id: I221f98cbb7d06dc667fdacedcdbe77d5781b025b
2024-03-04 06:34:16 +00:00
Translation updater bot 6c87302e6a Localisation updates from https://translatewiki.net.
Change-Id: I59495da82120e3d443034bf1e350ad9c65169348
2024-02-26 08:36:57 +01:00
Translation updater bot b9e2934294 Localisation updates from https://translatewiki.net.
Change-Id: I9051f3e2cf4dd0af5f29b3eb5b225aa657166db6
2024-02-23 08:45:13 +01:00
C. Scott Ananian d00b6aa0ea ParserOutput::setText() has been renamed to ::setRawText()
Depends-On: I3ef34814ab9473cc70d0a6806e8c5a4a02b73491
Change-Id: Iaf220266c8544ab2f1969af4c2b4ec16aca1e46d
2024-02-21 17:13:48 +00:00
vlakoff 6c340bff8d Synchronize mw.text.nowiki() with wfEscapeWikiText in core
Added escapes for "!" and ";" as well as additional escapes
at beginning and end of string.

Bug: T168763
Co-Authored-By: vlakoff <vlakoff@gmail.com>
Co-Authored-By: C. Scott Ananian <cananian@wikimedia.org>
Depends-On: I34f2fa8c329e6f6771453b2f94dc4afbec31dac8
Change-Id: I6c9dcfdbbb2c6eff9414e24d3f2693ebe576505a
2024-02-15 05:29:36 +00:00
Translation updater bot bce8a82d66 Localisation updates from https://translatewiki.net.
Change-Id: Ic5bf9a5fb3a597b9d0338bd7f288ffabdf22636c
2024-02-14 08:19:20 +01:00
Translation updater bot ddf71f2904 Localisation updates from https://translatewiki.net.
Change-Id: I96fbf5743e546f236ea9c8bb01faaa03439dd87d
2024-02-12 14:50:28 +01:00
libraryupgrader ac6ea01347 build: Updating dependencies
composer:
* mediawiki/mediawiki-phan-config: 0.12.1 → 0.14.0

npm:
* grunt-banana-checker: 0.11.0 → 0.11.1

Change-Id: I5409769b09c1985b18d7b81809c549522236c949
2024-02-10 13:38:43 +00:00
libraryupgrader e98e902b6a build: Updating eslint-config-wikimedia to 0.26.0
Change-Id: Ic8210e28563e6f4406b9e56b807ed421e19f4d5e
2024-02-09 12:48:10 +00:00
libraryupgrader 53a238cfd9 build: Updating npm dependencies
* grunt-eslint: 24.0.1 → 24.3.0
* grunt-stylelint: 0.18.0 → 0.19.0
* stylelint-config-wikimedia: 0.15.0 → 0.16.1

Change-Id: Ifddfc3787981fbb90a6c69171996ce21c8b5605c
2024-02-07 22:31:14 +00:00
Translation updater bot 7ea29b4e40 Localisation updates from https://translatewiki.net.
Change-Id: I5413f3636881262fbbf736f79bb181e475231b1c
2024-02-07 08:27:33 +01:00
libraryupgrader d68d6b4b68 build: Updating npm dependencies
* eslint-plugin-compat: 4.1.2 → 4.2.0
  * https://github.com/advisories/GHSA-c2qf-rxjj-qqgw
  * https://github.com/advisories/GHSA-c2qf-rxjj-qqgw
  * https://github.com/advisories/GHSA-c2qf-rxjj-qqgw
* postcss: 8.4.19 → 8.4.33
  * https://github.com/advisories/GHSA-7fh5-64p2-3v2j
* semver: 7.3.8 → 7.5.4
  * https://github.com/advisories/GHSA-c2qf-rxjj-qqgw
  * https://github.com/advisories/GHSA-c2qf-rxjj-qqgw
  * https://github.com/advisories/GHSA-c2qf-rxjj-qqgw
* word-wrap: 1.2.3 → 1.2.5
  * https://github.com/advisories/GHSA-j8xg-fqg3-53r7

Change-Id: If86dce502162f9c6bf0e382b724643ab71a8fc29
2024-02-04 10:31:12 +00:00
C. Scott Ananian f89e892a06 Fix parsoid parserTests
These errors weren't being flagged because of a bug in how
`parsoid-compatible` was handled in the parser test file options.
See Ifca13393c3bbec27c23cbdc311d4550fbccf21ca.

Change-Id: Ib65dd0adb472da53823c07af5991a140374501e4
2024-02-01 16:45:12 -05:00
Translation updater bot 6ca710aa80 Localisation updates from https://translatewiki.net.
Change-Id: I33007c74019d64c84cfffc503bf5647068f73ba7
2024-01-31 08:29:37 +01:00
Translation updater bot b88cc58f28 Localisation updates from https://translatewiki.net.
Change-Id: I4d5f6882b221f07df9845cf83ed4b21c4dc57ea5
2024-01-18 09:27:10 +01:00
Reedy d07d4039e6 mw.title: add pageLang property
Bug: T321239
Bug: T161976
Change-Id: I0f7c80a4bd2339c3cce34030b862e29d984aa714
2024-01-17 18:20:06 +00:00
C. Scott Ananian f5f4355633 Set some title properties to nil for interwiki links
In order to avoid misleading the caller, set some title properties to
nil for interwiki links. That value should still be falsey, but can
prevent making unwarranted assumptions about the destination of
interwiki links.

Split from I847ac4b7587b98be06b25fe14765e9efdc7b774d because this
could possibly have effects on existing modules.

Change-Id: I06efea9b264ba0f09bfb36e6bf1bb04f1cdd03e4
2024-01-16 20:49:42 +00:00
vlakoff e1bd4911bd Add a property "talkNsText" to mw.title objects
Bug: T180911
Change-Id: I847ac4b7587b98be06b25fe14765e9efdc7b774d
2024-01-16 20:36:22 +00:00
Translation updater bot d75dd9fc0c Localisation updates from https://translatewiki.net.
Change-Id: I57370a09a4fcf7e7bbf343c0e25ee16edaac2617
2024-01-09 09:00:31 +01:00
Umherirrender 68aebf853c Use namespaced classes
This requires 1.42 for some new names

Done automatically via script

Change-Id: I6f6899981eab571cabb57534d7d98ce546a30a75
2024-01-05 19:24:06 +01:00
Dringsim bab08d831e
Add test for mw.site.stylePath and mw.site.currentVersion
Change-Id: I3828928f65d6b1bbe4c2ab69bc680a753c64c04b
2023-12-29 23:23:21 +08:00
Translation updater bot f585b7cef6 Localisation updates from https://translatewiki.net.
Change-Id: Ifb46badc29dd16d9f75316addd9292bb516de388
2023-12-22 17:46:47 +01:00
Reedy 836baa7142 LuaBit: Minor cleanup
Bug: T353678
Change-Id: I19527eb162c20b5a6017dc3c4dd2b98bf5cad5d9
2023-12-18 23:46:16 +00:00
Reedy 54e9dd05be LuaBit: Save files with unix EOL
Change-Id: Ia757198e32e2beb060ccee9577012bf3c91d49e5
2023-12-18 23:46:09 +00:00
C. Scott Ananian 9694e8f543 mw.language: add :toBcp47Code() method
This allows conversion of MediaWiki-internal codes to standardized
codes suitable for inclusion in HTML.

Change-Id: I5d2102ca57cc6861b8ec144a90f9c17b630f38ce
2023-12-15 00:18:54 +00:00
DannyS712 e30641e439 Add redirects for modules
ScribuntoContent now supports content being redirects, if the underlying
ScribuntoEngine does so. For Lua, a redirect looks like:

    return require [[Module:Foo]]

which also happens to be perfectly valid Lua. There is intentionally no
`#REDIRECT`-style token (like in wikitext/JavaScript/CSS) because no one
will create a page with this content except for the purposes of a
redirect.

Bug: T120794
Co-Authored-By: DannyS712 <DannyS712.enwiki@gmail.com>
Co-Authored-By: C. Scott Ananian <cscott@cscott.net>
Co-Authored-By: Jackmcbarn <jackmcbarn@gmail.com>
Change-Id: I405e7953d00af8a34d5e8addc61a245732c71e8e
2023-12-13 17:34:30 -05:00
Timo Tijhof 8e0684da7a ScribuntoContentHandler: Add lang="en" to fallback <pre>
It currently inherents from the mw-parser-output div, which sets
it based on the documentation page (content language).

Change-Id: I79847cd8cfe75598c843e96a09d9aa61b00304a9
2023-12-12 12:31:10 -05:00
Bartosz Dziewoński ae8c68b051 ScribuntoContentHandler: Fix Phan suppressions
Title::castFromPageReference() and similar methods can return null
instead of Title when the parameter is null. Although that could not
happen in this code, there is no way to tell that to Phan, so
suppressions were required to avoid its warnings about possible nulls.

Instead, since MW 1.41, we can just use Title::newFromPageReference(),
which can't return null (and doesn't accept null as the parameter).
See also Ida4da75953cf3bca372a40dc88022443109ca0cb in MediaWiki core.

Change-Id: Ia3c415cdd68fe4b19869aa8eb8e816e707bb5ad6
2023-12-01 22:37:57 +00:00
Timo Tijhof 09f92105ed ScribuntoContentHandler: Remove redundant Title::getPageViewLanguage use
When OutputPage/Skin call ParserOutput->getText(), this already takes
care of the appropriate attributes. This redundancy is non-obvious
however, because in this code $parserOutput is re-purposed in an odd
way that makes it seem like it has to mark its own language, so as to
separate it from the appended portions for validation error and
syntax highlighted code.

However, at least the way the code has been in recent years, this
has always been a redundant wrapper since OutputPage/Skin already
set the same attributes on the resulting container. With T341244
closed, this is more obvious now that it is located in
ParserOutput::getText, but even before I worked on T341244, the Skin
will have already been doing the same thing as this code was doing,
setting the same redundant attributes.

Bug: T350806
Change-Id: Idb8471eec5d5ac39b7a347c70f3a618eba18a57b
2023-12-01 22:35:41 +00:00
Timo Tijhof 61874ca30e ScribuntoContentHandler: Refactor fillParserOutput()
The ParserOutput object used here starts life as the ParserOutput for
parsing the docpage (wrapped via an interface message). In order to
remove use of the Title::getPageViewLanguage method there, we need to
re-arrange some logic such that we parse the doc page first, and see
what language it was rendered in, instead of currently where
Title::getPageViewLanguage tries to "guess" what Parser and
LanguageConverter will do.

As prep for that stop reading/writing the HTML text of this
ParserOutput object in favour of being more like the Parser itself,
which accumulates metadata in ParserOutput and calls setText only
once at the end.

* Refactor highlight() to return standalone HTML instead.
* Refactor validation error to append to $html instead.

Other improvements while at it:

* Document how stuff works today.
* Clarify variable names.
* Separate concerns better by moving responsibility of `<pre>`
  fallback to highlight(), and limiting knowledge of
  ScribuntoEngineBase to the caller.

Bug: T350806
Change-Id: I9fe6d93727f29c284ea21db6edd6a2b1663e8e06
2023-12-01 22:25:51 +00:00
C. Scott Ananian d97ce9851c Ensure that Scribunto exceptions have a page context set
Some exception messages add tracking categories, which fail when there
is no title context.

Bug: T351045
Change-Id: I47d0160010c9da5a9a9974718a432fd5e79f8286
2023-11-27 14:08:12 +00:00
Translation updater bot 42212c1172 Localisation updates from https://translatewiki.net.
Change-Id: I17442022206e37ce5f82a9422747418013538d3b
2023-11-27 08:33:11 +01:00
Daimona Eaytoy 83d0f76301 Update tests for PHPUnit 9.6
- Avoid defining abstract test classes (ending in "Test")

Bug: T342110
Change-Id: I729df8d3cd5071826b5e035813102148a0f47520
2023-11-22 15:18:47 +00:00
Translation updater bot b70dcd048f Localisation updates from https://translatewiki.net.
Change-Id: Ieb03e75bb8bab598f2b2c4cd9c526719d1c8ce81
2023-11-22 08:20:42 +01:00
Translation updater bot 8d69dc173e Localisation updates from https://translatewiki.net.
Change-Id: Ib127ed069c38a3c3b5ad5ed078dc13d5ccd82dbc
2023-10-25 09:02:49 +02:00
Translation updater bot c02d2b662f Localisation updates from https://translatewiki.net.
Change-Id: Iea05ceea5d5d8b382eed72b5f75d5203421fc369
2023-10-24 09:38:36 +02:00
Umherirrender 8f6ead1f82 Replace empty() with falsy check
empty() should only be used to suppress errors
When the type of the variable is array,
a falsy check is the same (checks for null, false and empty array)
Found by a new phan plugin (T234237)

Change-Id: Id855be9dd25a27d9e46e3065dacbd268177b073d
2023-10-21 23:30:25 +02:00
Umherirrender 945a7871cd Replace empty() with isset()
The property is set to true or is unset,
isset is easier to understand in that case

Change-Id: Ib98e387ae1a2352556f57aee93da92bdf5453633
2023-10-21 20:38:47 +02:00
C. Scott Ananian 1eea8281c9 Assign UUIDs to Scribunto errors independent of page parse order
This replaces the use of ParserOutput::addJsConfigVars(), deprecated
since 1.38, and ensures that the IDs used for error messages are
independent of page parse order. (See T300979.)

This is an improved replacement for Ibd3fbcbc774491179b0d4fe29ba3b6a128220703
which was reverted (T346094).

Bug: T300307
Bug: T305161
Bug: T346094
Change-Id: I2c660972b289bbad730ceee1325d70d5ba75d27e
2023-10-13 15:23:22 +00:00
Translation updater bot 92391de076 Localisation updates from https://translatewiki.net.
Change-Id: Id1343263d50aec533005c91f45cda055c8e6f3d3
2023-10-12 09:29:53 +02:00
Umherirrender 29a9a8aec6 build: Change phan suppression to @phan-var for proc_get_status return
phan under php8.1 also detects PhanImpossibleTypeComparisonInLoop here,
but that cannot suppressed under php7.4,
so use @phan-var to set to the correct type, but keep the comment.
The suppression was added with 8328acb9 for a update of phan

According to the doc proc_get_status can only return array
(at least under php8.1)

Change-Id: Ieda5abc30126eed2e3a9f5fc283d36e64180f496
2023-10-06 19:37:10 +00:00
Umherirrender d734759316 tests: Declare class properties in LuaEngineTestHelper
Dynamic properties are deprecated under php8.2

Change-Id: I062f034295bf951d5761571e20d3e6d45df85ac3
2023-10-06 20:19:22 +02:00
Umherirrender e126de6a78 Rethrow TimeoutException when using mw.language.formatDate function
timeout while converting timestamps should be a timeout for the whole
parse of that wikitext and not hidden by a invalid time.
Just let the exception bubble up to the caller
See ca71e69f for more information

Change-Id: I1f44e45dcc9b052717814990a3f5ce3a1bdf9d26
2023-10-02 21:03:02 +02:00