Commit graph

1970 commits

Author SHA1 Message Date
Brad Jorsch 85aca87e94 Improve mw.getCurrentFrame handling
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
2014-07-07 13:11:20 -04:00
Translation updater bot 2f4b3c28ad Localisation updates from https://translatewiki.net.
Change-Id: I98c2938bf8d8afa5a7e9a0e1fd33e64b4bc276ed
2014-07-03 19:21:15 +00:00
Brad Jorsch c44d576b78 Update GeSHi integration
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
2014-07-03 14:50:50 -04:00
jenkins-bot 8a8a268066 Merge "Allow for skipping Lua tests" 2014-07-01 18:45:58 +00:00
Brad Jorsch ebc737db91 Fix whitespace in i18n/en.json
Change-Id: I6f250deb1873d0b805cf941b9d67c9850fd6eb9c
2014-07-01 11:43:26 -04:00
Brad Jorsch 631feb8a3d Allow for skipping Lua tests
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
2014-07-01 10:48:36 -04:00
Jackmcbarn e65638777a Show blanknamespace in content language
This is cached with the page.

Change-Id: I62335dd37c411dc5dc77ac7564c6fa6361679ac3
2014-06-30 11:44:47 -04:00
Jackmcbarn ec42679913 Show ScribuntoExceptions in content language
Messages from ScribuntoException are cached and stored with the page, so
they need to be output in the content language.

Change-Id: Ic8bd5cef2c49118ccb258592ca515c0e71f210e3
2014-06-28 17:59:05 -04:00
Jackmcbarn 8d1d5ac84c Fix strange mw.html errors with numeric arguments
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
2014-06-27 14:41:42 -04:00
Brad Jorsch bf39827980 mw.ustring functions should accept numbers where string functions do
Lua's string functions tend to auto-convert numbers to strings. We
should do the same in mw.ustring.

Bug: 67201
Change-Id: Icd3c5e93bac19dafd78d737ec9b315daba9f1729
2014-06-27 12:31:04 -04:00
Brad Jorsch ccab415701 Don't cache volatile wikitext
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
2014-06-26 22:03:35 -04:00
Jackmcbarn 780d8e1ec7 Set TTLs on outputs containing times
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
2014-06-23 15:52:17 +00:00
Translation updater bot 34ff6f5683 Localisation updates from https://translatewiki.net.
Change-Id: I458eb93b21a0ade3cc06224bb48fde3117f80f68
2014-06-22 19:31:10 +00:00
Translation updater bot 192ab4faff Localisation updates from https://translatewiki.net.
Change-Id: I4ac01d0a68bf239d30d762f3d6e96b5bd42f6dc4
2014-06-20 19:51:03 +00:00
jenkins-bot 996a48e42c Merge "Remove dead code" 2014-06-19 18:45:14 +00:00
jenkins-bot 8d7d5f35ed Merge "Allow passing nils to mw.html" 2014-06-19 16:57:02 +00:00
Jackmcbarn d1030989bc Allow passing nils to mw.html
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
2014-06-19 11:40:39 -04:00
Marius Hoch 9e6b67c723 Remove dead code
Just confusing...

Change-Id: I8b6e3d290c8ae75159e86835a0d359a4dcaa7a0e
2014-06-18 19:56:39 +02:00
Reedy 4d0665dbd8 Parameter type hints
Change-Id: I3d578ab6fb65917ef0fa65767089b01ca7c4e96d
2014-06-18 18:19:07 +01:00
Marius Hoch 186212cfe6 Fix return doc for ScribuntoEngineBase::fetchModuleFromParser
Change-Id: I5c16c18ee4667adcb76fd647f55713ef227466e8
2014-06-18 18:51:09 +02:00
Brad Jorsch ec7472a0e5 Sanity check $wgNamespaceAliases
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
2014-06-17 14:23:26 -04:00
Translation updater bot ee21d14c4a Localisation updates from https://translatewiki.net.
Change-Id: I9dca99dcce20918d3a9fa9fe4a24f6f2a3552634
2014-06-12 21:38:57 +00:00
Translation updater bot 0a78d90f12 Localisation updates from https://translatewiki.net.
Change-Id: I8ac65c189f8f4230b7b4a240150feb2ac2d84007
2014-06-11 20:39:55 +00:00
Translation updater bot 3f74fcb195 Localisation updates from https://translatewiki.net.
Change-Id: Ibe797954d8c95bda9f146567eaeb7505e5bc8518
2014-06-06 21:47:35 +00:00
Translation updater bot 29a1ad0b75 Localisation updates from https://translatewiki.net.
Change-Id: I1949aa76660127be481121b953dcb5d2767fe259
2014-06-05 20:46:28 +00:00
Translation updater bot b41a32d6f4 Localisation updates from https://translatewiki.net.
Change-Id: I7fc4c1cb2f4f93f7a2a5a1564f39b836f16fe969
2014-06-03 19:51:48 +00:00
Translation updater bot 0e600c5891 Localisation updates from https://translatewiki.net.
Change-Id: Ib96f0adfd51f83344b1ffb25e2fd76632ddc621f
2014-06-02 20:59:52 +00:00
Translation updater bot a55fcbc938 Localisation updates from https://translatewiki.net.
Change-Id: Ie3e15fa3c43502e13b030d443c25aded915e4d02
2014-06-01 19:41:34 +00:00
Translation updater bot ff22c710c6 Localisation updates from https://translatewiki.net.
Change-Id: I24775541d08ac7ba2e61c45869b0162a9386f735
2014-05-31 19:01:51 +00:00
Translation updater bot 3356a3da10 Localisation updates from https://translatewiki.net.
Change-Id: I4ed4fe2bf8b6c0027f93872a5c61dd8161ae61c6
2014-05-30 18:49:50 +00:00
Translation updater bot 63bb20ee18 Localisation updates from https://translatewiki.net.
Change-Id: Ic4f0a355e4c83a0b66f1ede7c65c20e75284e333
2014-05-28 19:34:51 +00:00
Translation updater bot b5adf6efa7 Localisation updates from https://translatewiki.net.
Change-Id: Ib41ead796a684aae7c1f95e451487186f4e4b778
2014-05-27 20:28:28 +00:00
Jackmcbarn 1201618b7d Keep modules' export tables inside Lua
When tables are passed from Lua to PHP, their metatables are lost. Because
of this, they need to be kept inside of Lua to allow the __index
metamethod to return a method to be called by #invoke.

Bug: 64141
Change-Id: I0840bc12b25dee72828ec97d2b205812e4929f2b
2014-05-26 20:01:18 -04:00
Translation updater bot e133ca10c2 Localisation updates from https://translatewiki.net.
Change-Id: I938ab0852da197d400e7d3b7352db12f54c564b8
2014-05-22 19:55:53 +00:00
Translation updater bot 77c90c04bf Localisation updates from https://translatewiki.net.
Change-Id: I4397752c3206e3dd3df99fe7960d79a0cd24dc75
2014-05-21 20:25:07 +00:00
Jackmcbarn 1492ac3d68 Avoid running all of mw.lua twice
LuaStandalone only uses 2 functions from mw.lua, so move them to their own
file to avoid running the whole thing twice.

Change-Id: Ia4d58f44be17f7a71666dbe750e66d9d90cb5c2f
2014-05-15 14:15:08 -04:00
Jackmcbarn e19a1404f4 Use do...end to restrict scope
Creating and calling an anonymous function to create a scope is prone to
breakage, and only works because the last token before it is a numeric
literal. Do...end is designed for this purpose, so use it instead.

Change-Id: Ic33321086d5469bf97301b434c5a660f04120662
2014-05-14 13:43:13 -04:00
Brad Jorsch 35ee461a0b Improve frame:callParserFunction argument validation
From wikitext, $parser->callParserFunction() will always get an array of
strings with at least an element [0]. Let's match this from Scribunto:
stringify numbers, and require that [0] (although in Lua it'll be [1]).

Also fix an old broken unit test.

Bug: 63597
Change-Id: Ie7ac34ae4bce70cec455d90c3f02a658644f6866
2014-05-13 05:14:07 +00:00
Translation updater bot caef690cd1 Localisation updates from https://translatewiki.net.
Change-Id: Ic0076267d64c3c174da9d7aa1475af26f0929fef
2014-05-11 19:09:04 +00:00
Derk-Jan Hartman fd295c3b71 Convert Scribunto to use fillParserOutput
Followup-to: Idf4ad4397101a4d19be2ac773cd4bad52188d903
Change-Id: I7e18d57f231716127028dafe44e61cee7d89d4d9
2014-05-10 17:31:26 +02:00
Translation updater bot 0f53973f67 Localisation updates from https://translatewiki.net.
Change-Id: Id38d802e2e4a9d5b18125be1c05e33920d5d3b4e
2014-05-09 22:22:00 +00:00
Translation updater bot dd30fa97ee Localisation updates from https://translatewiki.net.
Change-Id: Ic0cda88bebcd69372ba8715902e48b18eeba733c
2014-05-08 20:48:50 +00:00
jenkins-bot e9fe95b451 Merge "Show module doc with the correct direction formatting" 2014-05-08 19:14:25 +00:00
Amir E. Aharoni a8a17a8bb0 Show module doc with the correct direction formatting
* Add mw-content-(ltr|ltr) class to the documentation <div>.
* Rewrite the div code as Html::rawElement instead of
  concatenating a string.

Done in pairing with Niklas Laxström.

Change-Id: I4d68d53df9dcf3556885552b738f2c327aaa8607
2014-05-08 17:48:14 +02:00
aude bb0f10b751 Make LuaEngineTestBase compatible with phpunit 4.1
PHPUnit_Framework_TestSuite::isPublicTestMethod has
been removed from phpunit 4.1.

Change-Id: I191b5f460fbef122d8e916c8f661f09083b33970
2014-05-08 07:11:14 +02:00
Translation updater bot 64360099b4 Localisation updates from https://translatewiki.net.
Change-Id: I82e206d8a65c8f7608b917aeaeb8c7d662d7d9a0
2014-05-06 19:53:37 +00:00
Translation updater bot 3e716c6488 Localisation updates from https://translatewiki.net.
Change-Id: I16dece095aa2c78f6fe9ab26f158f33a2c09194c
2014-05-02 19:52:14 +00:00
Translation updater bot f768b95013 Localisation updates from https://translatewiki.net.
Change-Id: If8ef2efd7c1eda6a74fa085270364b73a59041c5
2014-04-25 19:44:03 +00:00
Translation updater bot 354c8095f1 Localisation updates from https://translatewiki.net.
Change-Id: I4b2b460f0eaf3a568343e2bdc2ed51fdbf473fd4
2014-04-23 19:56:38 +00:00
jenkins-bot 116cc4f560 Merge "Use correct variable in require()" 2014-04-22 14:23:04 +00:00