Add more information to error messages in mw.html. This includes the
error level, the function name, and the position of the argument in the
argument list. Where possible, use the functions in libraryUtil.lua to
do this.
Some functions in mw.html accept multiple types, so add a checkTypeMulti
function to libraryUtil.lua to make these kinds of functions easy to check.
And while we're at it, add test cases for libraryUtil.lua as well.
Change-Id: If9cf9a52bd4b1bb42cc7f9f1f1096828710cbc52
Just like the other methods, e shouldn't be allowing passing of things
that aren't numbers or strings here.
For that matter, we should just abstract out the whole "arg key and
value validation" into a separate function instead of repeating it in
four places.
Bug: T76609
Change-Id: Id7e512a988ef9b7a5c5a110c8992dd5d649dcbf9
In I019c24d1, an unnecessary variable redefinition was added to
Scribunto_LuaModule, which this removes.
Change-Id: Ib0232a5adcd9ad7ea5c0f4413ba06c42b5506d7b
mw.text.unstrip is too broad, it's allowing for unstripping things that
cause problems when unstripped (e.g. bug 61268). Since the original
request was only for unstripping <nowiki>, let's add a function that
does only that.
We should also add an interface to StripState::killMarkers(), instead of
requiring everyone to roll their own work-alike.
Then, to fix the bug, we can make mw.text.unstrip be the combination of
the two. This is the most like the original behavior of mw.text.unstrip
(removes all strip markers, replacing them with text where applicable)
without causing issues.
Bug: 61268
Change-Id: I3a151fd678b365d629b71b4f1cb0d5d284b98555
MediaWiki core change I04b1a384 added support for i18n of API module
help. This takes advantage of that while still maintaining backwards
compatibility with earlier versions of MediaWiki.
Once support for MediaWiki before 1.25 is dropped, the methods marked
deprecated in this patch may be removed.
Change-Id: I67395aff48185f3e09da31b51a08aa2541fe6a17
There are like a billion things missing in the inline documentation
of this extension. Wow. This is what I can do for now.
Change-Id: I019c24d13cf5cb22dde4d710b86ef8f976e1ec96
Scribunto currently supports libraries with PHP callbacks that are
loaded on startup, and pure-Lua libraries that may be loaded from the
module with require().
This change allows for libraries with PHP callbacks to also be loaded
with require().
Change-Id: Ibdc1f4ef51b1c8644c3d4c98d57755b5c06447a5
This was never really a good idea. If you really want to save incomplete
code, you can put it all in a block comment. Since some modules may still
have errors from before this change, the tracking category for them has
not been removed.
Change-Id: Icb3da00a86b9773287dcd0c9277ad61446ec07ce
Use $title->exists() to see if a title exists, and use
$parser->fetchLatestRevisionOfTitle() when available, so that
TemplateSandbox works with title.exists and title.getContent().
Bug: 70495
Change-Id: I732da9daccdc35b11d726818c3a7c81f5e810a32
If LuaSandboxFunction::call returns false, it's an error on PHP's part.
Throw a "real" exception so that we can see what's causing it in server
logs.
Bug: 71045
Change-Id: I7185e186d3e0af6e467b73ea1ef13417ca96b088