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
It currently inherents from the mw-parser-output div, which sets
it based on the documentation page (content language).
Change-Id: I79847cd8cfe75598c843e96a09d9aa61b00304a9
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
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
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
Some exception messages add tracking categories, which fail when there
is no title context.
Bug: T351045
Change-Id: I47d0160010c9da5a9a9974718a432fd5e79f8286
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
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
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
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
This reverts commit 9f8d16f9c9.
Reason for revert: Causes internal error on certain pages.
Bug: T346094
Change-Id: Ia9ccffbbbe2fe2413b54fb5e16f5cfc53527990e
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
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
- 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
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
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
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
No longer used since 1.33
Automatically removed message keys with "doc-apihelp-description" in qqq
Bug: T340253
Change-Id: Ic533cea25b7ab6b5d390a73c306abd584f5c9c33