Simplify the logic in mw.text.listToText so that we don't need to add or
remove anything from the original table we were passed.
Change-Id: I3efcbba1b9adc9a9e32e366e355cb742376cd91b
The pattern used by cssEncode is unnecessarily complicated. Simplify it by
using a negating pattern.
Change-Id: I5dc7169efea63473e9e23a1450d2941e434a00d8
Add an mw.dumpObject() method, which converts an object in the same manner
as mw.logObject(), but returns it instead of adding it to the log buffer.
Change-Id: Ie9fbd24d9d8d13ee2ddf8052679010892f61e1e0
People have been complaining that they can't find the log data anywhere.
The new parser limit report seems a good place to show this information.
Change-Id: If2abf27f7779d92ff7c7a1f32b2a54a5de521678
Clean up trailing whitespace from all of our code, and add comments
indicating that apparently unused variables are ScopedCallbacks.
Change-Id: I8e5997797cc7b1c64c5351ec112a18f30edc8fef
Two similar bugs are handled here:
* mw.getCurrentFrame() doesn't work when the module is loaded (only when
a function is called), which breaks os.date and os.time at module
scope since I59ad364d.
* mw.getCurrentFrame() gives access to frame args from inside
mw.loadData, which allows for data leakage between #invokes.
Bug: 67498
Bug: 65687
Change-Id: I82dde43e2601b59c03c6ed4b9365829c40a953a5
Idf4ad439 deprecated SyntaxHighlight_GeSHi::buildHeadItem in favor of
ResourceLoader. We may as well follow along.
To avoid breaking things if people don't update their
SyntaxHighlight_GeSHi in sync with Scribunto, test for the RL class used
in GeSHi's ResourceLoader integration and continue using buildHeadItem
if it's not found.
Change-Id: Id93530dce7c8c5a70a98fca58844adf9b5c6a23f
From the PHP subclass of Scribunto_LuaEngineTestBase, Lua tests run by
Scribunto_LuaEngineTestBase::testLua() may be skipped by adding an entry
for the test name to $this->skipTests.
From the Lua code run by Scribunto_LuaEngineTestBase::testLua(), tests
may be skipped by calling the "markTestSkipped" function exported by the
TestFramework module.
Also, use this new mechanism to skip certain mw.language tests if
Extension:CLDR or a similar extension is not available.
Bug: 67343
Change-Id: I4f0b15073a84bf2f9d8a5d905c3c960941dd2b71
Messages from ScribuntoException are cached and stored with the page, so
they need to be output in the content language.
Change-Id: Ic8bd5cef2c49118ccb258592ca515c0e71f210e3
Some functions in mw.html accept numbers as arguments, but later fail when
constructing the string. This disallows numbers in attribute names, since
they aren't valid anyway, and fixes the remainder of the cases to properly
build the string.
Bug: 67201
Change-Id: Ie7bcbb9d8df580dd8793681f78a8b0719d8a287a
Lua's string functions tend to auto-convert numbers to strings. We
should do the same in mw.ustring.
Bug: 67201
Change-Id: Icd3c5e93bac19dafd78d737ec9b315daba9f1729
Certain wikitext, such as that containing Cite.php <ref> or <references>
or the #tag versions of the same, should not be cached. This uses the
isVolatile method added to PPFrame in I95b3cf87 to avoid caching the
preprocessed output of such wikitext from frame:preprocess and similar
methods.
Bug: 46815
Change-Id: I1084f87fd863eb22f2f3f3d3ff308b24e20a08ef
When os.date, os.time, or mw.language:formatDate are called, set the
appropriate TTL on the output. This needs I412febf3 in core to function at
all, and I3f5a80aa in core to function with formatDate.
Change-Id: I59ad364d502fc247500d94c5606516ad9f98a24d
Rather than calling error() when nils get passed to mw.html methods,
either remove whatever it was that the nil would go to (if that makes
sense), or just do nothing. The seemingly inconsistent use of "not x" and
"x ~= nil" is to allow any falsey value where it wouldn't be ambiguous
(such as class names), but not where it could be (such as attribute values).
Bug: 62982
Change-Id: I76773abbb4394aa9bb8c8a08445e019cade3b2bf
If someone goes and adds aliases for namespaces that don't actually
exist (as was done in I94c34799, for example), Scribunto will run into
issues when trying to create its mw.site.namespace objects.
Let's ignore those bogus aliases so we don't go breaking everything just
because someone did something stupid.
Change-Id: I16acd97f587de320cf61becb829cc66794cbb119