Commit graph

1961 commits

Author SHA1 Message Date
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
Translation updater bot a63d074572 Localisation updates from https://translatewiki.net.
Change-Id: I101ad1c679e8885f125dc67c3b999d947e3423e5
2023-09-25 08:46:56 +02:00
Umherirrender 80198cd635 Use ::class for class name resolution
Change-Id: I92a73fd6eccd3cf963ce1ff50ccf4f7aac6a0e1e
2023-09-21 22:46:00 +02:00
Translation updater bot c81f3aec5f Localisation updates from https://translatewiki.net.
Change-Id: I50d2512cf628fd7c4613b838f358f0d8eee7e48a
2023-09-18 08:44:49 +02:00
Jdlrobson 77286ebc87 Revert "Replace use of ParserOutput::addJsConfigVars(), deprecated since 1.38"
This reverts commit 9f8d16f9c9.

Reason for revert: Causes internal error on certain pages.

Bug: T346094
Change-Id: Ia9ccffbbbe2fe2413b54fb5e16f5cfc53527990e
2023-09-11 20:18:13 +00:00
C. Scott Ananian 9f8d16f9c9 Replace use of ParserOutput::addJsConfigVars(), deprecated since 1.38
Most uses can be replaced with ::setJsConfigVar(); the major semantic
change is that ::setJsConfigVar() is not expected to overwrite
previous values.  That *may* be an issue here, but if so it's not
a change from existing behavior, as the way ::addJsConfigVars() was
being called it would override previous values as well.

Bug: T300307
Bug: T305161
Change-Id: Ibd3fbcbc774491179b0d4fe29ba3b6a128220703
2023-09-11 16:55:54 +00:00
Lucas Werkmeister b39d3589ba Remove Database group again where possible
Override the target language in the parser options, so that it isn’t
looked up from the database; this lets UriLibraryTest avoid database
access. And since the Database group is no longer strictly required,
remove the statement to that effect from the phpdoc again.

Bug: T345372
Change-Id: I79f35257b123eb939d9ab67b16aa56d34586bb67
2023-09-06 11:33:42 +02:00
Daimona Eaytoy 7e54c088ac Avoid DB access in databaseless tests
- Force a content model on the title used by LuaEngineTestBase, so that
  calls to getPageLanguage() won't end up hitting the DB
- Don't actually use SiteStats from SiteLibrary in unit tests. There
  seem to be no test actually using this data.

Bug: T345372
Change-Id: I35884f04b582678982fb5f64d9199bab41cd8bce
2023-08-31 19:12:55 +00:00
Lucas Werkmeister ea0707c437 Add UriLibraryTest to Database group and add advice for others
All LuaEngineTestBase subclasses must be in the Database group, as far
as I can tell it can’t be avoided. (Several already are anyway.) We
can’t centrally do this in the base class anymore (needsDB() can no
longer be overridden), so just add it to the phpdoc here.

Bug: T345372
Change-Id: I47016ec84ed227f755f94a383bee8053975b4c81
2023-08-31 18:08:37 +02:00
Translation updater bot c588e717ab Localisation updates from https://translatewiki.net.
Change-Id: I09b9b5ab0ac82b60850558241cfa2ec3944d6981
2023-08-28 09:30:59 +02:00
Umherirrender a8280e5e5f Use namespaced Title
Bug: T321681
Change-Id: I65940dc6d276f86734ff724d6605facb68dd8e44
2023-08-19 20:18:41 +02:00
gerritbot b7a5e6fadd Replace some moved Title class uses, now MediaWiki\Title\Title
Bug: T321681
Change-Id: I27924141187aef8fe2f6500ec0c4b6360d268c28
2023-08-19 12:22:05 +00:00
James D. Forrester 2248bb8ca5 build: Update MediaWiki requirement to 1.41
All extensions in the MediaWiki tarball are expected to track MediaWiki's release directly.

Change-Id: Ia8e611f53722341fc80a42267452bd14562914d5
2023-08-19 14:05:01 +08:00
Umherirrender a00ce79826 Use HookHandlers for CodeEditor hook
This requires 1.41 for the interface (added in 4d6a470a)

Bug: T271026
Change-Id: I393ba99b7265dac81c7fdaf3d21630386c7c53a9
2023-08-15 13:50:13 +02:00
Umherirrender 648985c981 Use HookHandlers for core hooks
The use of "HookHandlers" attribute in extension.json makes it possible
to inject services into hook handler classes in a future patch.

Bug: T271026
Change-Id: I1583f5075937c4ce71a0d8748700f7012280851c
2023-08-15 13:49:53 +02:00
Translation updater bot f61a523ceb Localisation updates from https://translatewiki.net.
Change-Id: I6415d17e26649092a3d2a7cfaf41eed4c5da93d5
2023-07-31 09:00:53 +02:00
Translation updater bot 4aa17cb80c Localisation updates from https://translatewiki.net.
Change-Id: If270803d71c66c5a986946a2733d932c010ea898
2023-07-24 09:39:36 +02:00
Winston Sung 2af0e991e4 Follow-up of "Localisation updates from https://translatewiki.net."
Change-Id: I0d19c5bb331a8579b0ff0e752251520a724bf497
2023-07-17 09:21:37 +00:00
Translation updater bot 34c83b1158 Localisation updates from https://translatewiki.net.
Change-Id: I0f4ac4e7a9bc2b2d45aa1d67dbdee46d8a78ac84
2023-07-17 10:18:41 +02:00
Anne Haunime b3f55c05e9 Optimize mw.text.trim() with default charset
Using code by David Manura, published at lua-users.org/wiki/StringTrim

Note '\t\r\n\f ' is replaced with '%s', thus '\v' (vertical tab) is added to the characters trimmed by default.

Bug: T338561
Change-Id: I98e2677f1181b88f4cd97cffca3a53ce426ec5cd
2023-07-14 15:59:20 +00:00
Translation updater bot 511fce82db Localisation updates from https://translatewiki.net.
Change-Id: I83de5e66552587771014b7ecae534036be17f7b3
2023-07-03 10:16:16 +02:00
Translation updater bot 7c47ae1344 Localisation updates from https://translatewiki.net.
Change-Id: Idf55d688a1d40c4ca0fcac84cb970c3562022e6b
2023-06-26 12:40:50 +02:00
Umherirrender 622364c437 api: Remove old apihelp i18n description messages
No longer used since 1.33

Automatically removed message keys with "doc-apihelp-description" in qqq

Bug: T340253
Change-Id: Ic533cea25b7ab6b5d390a73c306abd584f5c9c33
2023-06-24 00:20:25 +02:00
Umherirrender 2ee5768ef5 Create HookRunner class and the hook handler interfaces
Bug: T271026
Change-Id: If525e0f950b3a098162b19373edb3b443f559bf2
2023-06-19 21:39:33 +00:00
Translation updater bot 8811ea784e Localisation updates from https://translatewiki.net.
Change-Id: I24a4cd5b6400ccc420a0dfeb04ec83051d38c4aa
2023-06-19 11:08:01 +02:00
Daimona Eaytoy 846495fe45 Replace deprecated MWException
Bug: T328220
Change-Id: I38be06abdabff29276f07c378f3ef434973fb8d6
2023-06-09 14:43:44 +02:00
Translation updater bot c54efd3c6c Localisation updates from https://translatewiki.net.
Change-Id: Ie8f39b55c3890e1555037a42345204e909d525c5
2023-06-02 09:24:45 +02:00
libraryupgrader c6d3b80072 build: Updating npm dependencies
* grunt-banana-checker: 0.10.0 → 0.11.0
* stylelint-config-wikimedia: 0.14.0 → 0.15.0

Change-Id: Id64ab5fb0a594371354ca4a3ca5f90016f397530
2023-06-02 02:13:44 +00:00
Translation updater bot 3cddac5daa Localisation updates from https://translatewiki.net.
Change-Id: Ifa677eb4418dbfa67cdbe04184243d34234f679d
2023-05-31 08:20:57 +02:00