Commit graph

504 commits

Author SHA1 Message Date
Brad Jorsch b6ea64f132 Make mw.getCurrentFrame() work in console, add frame:newChild()
It would be helpful for debugging if a frame object could be gotten in
the console. To that end, add an empty frame when running in the console
and allow it to be returned by mw.getCurrentFrame().

It would also be helpful to be able to create frames with arbitrary
arguments, again for testing. Fortunately support for creating child
frames with arbitrary arguments already exists in core, so we can just
use it.

And for good measure, be sure to restore the $engine->currentFrames
array even if the Lua code throws an exception.

Change-Id: I1dc8602d63af75424f267c42a3743fabbc1827f7
2013-03-12 14:42:36 +11:00
Brad Jorsch 5faa00150c (bug 45684) Don't count argument parsing time towards Lua limit
Currently, the time taken to parse the arguments passed to a Lua
function from #invoke will be counted against Lua's 10-second limit.
This is counterintuitive, and can remove incentive for users to convert
templates to Lua since they may have to convert a whole stack at once.

Note this requires change I11881232 to mediawiki/php/luasandbox to
actually have any effect.

Bug: 45684
Change-Id: I773950e4c399b8a1cfa6d1cde781a069d286b3bd
2013-03-12 03:18:05 +00:00
jenkins-bot a890c91bce Merge "Add namespace translations for dsb, eo, hsb" 2013-03-11 21:48:43 +00:00
Chad Horohoe 3ac6904790 Missing global
Change-Id: I78fc2acd31dd2969971e23239d5c820d867a204c
2013-03-11 14:55:23 -04:00
Translation updater bot 4822d97ec4 Localisation updates from http://translatewiki.net.
Change-Id: I05fefa28e6a00068ce8d525f0059c34ee91b737c
2013-03-10 21:40:17 +00:00
jenkins-bot df568c6a32 Merge "(bug 45774) Add title.fileExists, improve title.exists" 2013-03-08 23:38:31 +00:00
jenkins-bot 2cbaae6673 Merge "(bug 45887) Improve error popup discoverability" 2013-03-08 18:25:37 +00:00
Translation updater bot a40f72300d Localisation updates from http://translatewiki.net.
Change-Id: Ie9f43f06af1f3e55501525e3973e7b1d1ba6c50e
2013-03-08 17:08:59 +00:00
Brad Jorsch 6d1c1e63ec (bug 45887) Improve error popup discoverability
The Scribunto "Script error" can be clicked, which is indicated by a CSS
cursor:pointer style. To make it more discoverable, also have it show an
underline on hover (as links do by default).

And while we're messing with it, let's remove that "style" attribute and
use the already-existing CSS class to assign the styles.

Bug: 45887
Change-Id: Ibbbf0ed268efd78e4b7844cc2639fe154ee3ab8a
2013-03-08 11:16:26 -05:00
Brad Jorsch 466ba8668e (bug 45774) Add title.fileExists, improve title.exists
People sometimes want to know if the actual file exists, not just the
file description page. Support that.

Also alias .exists to .fileExists for the Media namespace, since that's
what the Media namespace is for.

And while we're at it, fix .exists for special pages too.

Bug: 45774
Change-Id: I019adc89858a1d32995a38d5e8eef32577fd32d6
2013-03-08 10:33:35 -05:00
Translation updater bot b65adb78f5 Localisation updates from http://translatewiki.net.
Change-Id: Ib3da3c433918dd58ccae7d57d262191bd8ba3917
2013-03-07 21:56:02 +00:00
jenkins-bot ec86b161cd Merge "Fix unit test engine↔parser assignment" 2013-03-07 19:44:54 +00:00
Brad Jorsch b926846a7a mw.title:getContent() should record in templatelinks
Since the content of a page is being loaded, this should be recorded in
templatelinks so things can be updated properly when that page is
edited.

Change-Id: I3e720fee2705f6c08ac0456c3cab0ed4ede84536
2013-03-07 13:02:41 -05:00
Brad Jorsch 981ea4c39f Fix unit test engine↔parser assignment
In the unit tests, the engine is given a parser, but the parser is not
being associated back with the engine. So in some cases, that could lead
to *another*, default engine being created for certain operations.

Fix that.

Change-Id: I79995c2635d9e470931b84dc1854dae26772bbe3
2013-03-07 01:42:19 +00:00
Brad Jorsch 201bf237b3 Fix Title library breaking other unit tests
Apparently assigning to $wgHooks at the top of the file breaks every
other hook, somehow. So we need to set it in setUp(), but prevent the
interwiki prefix from being queried beforehand when the dataProvider is
run. Fun.

Change-Id: I8535942e3a0e47d9a5b2ea11c1b0b63c5acf2cc5
2013-03-06 20:39:08 -05:00
jenkins-bot efe2def71a Merge "Add language functions" 2013-03-07 00:05:54 +00:00
Translation updater bot 337a752022 Localisation updates from http://translatewiki.net.
Change-Id: Ice25093fe23f55308bd20dd27553787251af254a
2013-03-06 21:56:46 +00:00
raymond e865a252bd Add namespace translations for dsb, eo, hsb
Per talk on https://de.wikipedia.org/w/index.php?title=Benutzer_Diskussion:Raymond&oldid=115044733#Lua_in_weiteren_Wikipedien

Change-Id: I161dc93c95bc6657352198c04e3d58698344ba77
2013-03-06 17:09:10 +01:00
Brad Jorsch e004b415d6 (bug 45512) Add mw.title:getContent()
Bug: 45512
Change-Id: I630033d367a47f7f80809a0918d3e6feede3fe41
2013-03-05 19:05:00 +00:00
jenkins-bot 61a4dccabd Merge "Clean up argument lists" 2013-03-05 18:49:53 +00:00
jenkins-bot fc766f205a Merge "Fix mw.uri error with empty fragment or query string" 2013-03-05 18:49:06 +00:00
Brad Jorsch fcef54e9d9 Fix ustring errors
* mw.ustring.sub( '', 1 ) errors in LuaStandalone
* Default value for ustring.maxStringLength and ustring.maxPatternLength
  should be infinity, not nil
* mw.ustring.find() returns one value instead of two in "plain" mode.

Change-Id: I5e65c4ec3a05f0e6930ce7ab7fd4ac72bea95e7f
2013-03-05 12:22:15 -05:00
Brad Jorsch 328680ed96 Add language functions
RTL support, duration formatting.

Change-Id: I78db53976abfe04fd6529b36c9434e33a3bc90c7
2013-03-04 21:14:34 -05:00
Brad Jorsch 580cda00d0 Fix mw.uri error with empty fragment or query string
Off-by-one error.

Bug: 45655
Change-Id: Ic6e0dfe8dbf392b1fe9e225f7906b4dd84f4febf
2013-03-05 01:44:10 +00:00
Brad Jorsch 5e548e769a Add requirable bit32 library
Following the interface of the Lua 5.2 bit32 library.

Change-Id: I4bc9edc549dbc2d5fdca15ec3a326397a1212a8a
2013-03-05 01:36:17 +00:00
Translation updater bot 6313cb5765 Localisation updates from http://translatewiki.net.
Change-Id: I8edf3090f2d7dd02b614ca3e415caafc63e2d11f
2013-03-04 21:34:57 +00:00
Brad Jorsch e995922bf4 Clean up argument lists
Remove unused parameters from the require() argument lists of two
modules, left over from an earlier phase of development.

Change-Id: Ib55d19fb9adffed2153a9cb3788533c4b70b5e26
2013-03-04 14:55:46 -05:00
tgr 7d7b0683b1 Add Hungarian namespace aliases
Change-Id: Ifd82050fec8f689337d493fc4629af10ee1482f2
2013-03-04 00:10:31 +01:00
Translation updater bot a36e8969e1 Localisation updates from http://translatewiki.net.
Change-Id: I94257ca5c3821040ae4a8e763a0d20a3e3b6d272
2013-03-02 20:36:31 +00:00
jenkins-bot b243204697 Merge "Update i18n" 2013-03-01 22:18:43 +00:00
Translation updater bot ee30a05228 Localisation updates from http://translatewiki.net.
Change-Id: If27797e0bb96d69a313fc848274fdb515df20d8a
2013-03-01 21:26:29 +00:00
Brad Jorsch 69a717c5ba Fix title library saving
getParser() sometimes returns null (eg: on saving edits). In that case,
don't try injecting link information into the (non-existent)
ParserOutput object.

Change-Id: Ief544922228615fbf674305bff95f874d56b7866
2013-03-01 11:07:45 -08:00
Brad Jorsch 233ff6640b Update i18n
Add missing /qqq messages, and remove an unused message.

Bug: 39125
Change-Id: Ib1c21cc4eb334b42408e24051809ab3c0d8da796
2013-03-01 10:54:16 -08:00
Brad Jorsch 307a5b1be8 Clean up lualibs
Clean up the modules in engines/LuaCommon/lualib:
* Fix luabit/bit.lua to return its table instead of trying to set the
  global directly.
* Fix luabit/hex.lua to return its table instead of trying to set the
  global directly.
* luabit/noki.lua is useless for our purposes
* luabit/utf8.lua is redundant to mw.ustring
* stringtools uses coroutines, which we don't support

Also fix a parser test that has apparently been broken for a long time.

Change-Id: I1284cddb6e9b94327964cb1077d8dbdf7def6d06
2013-02-28 18:39:16 -08:00
Translation updater bot 31ee3b1e4b Localisation updates from http://translatewiki.net.
Change-Id: Ic2e4bffe181a71e67e8b9e1d59ede11567e73224
2013-02-28 20:51:37 +00:00
Brad Jorsch 04a0a580e3 Add mw.title library
Note that fetching any title besides the one for the current page is
considered "expensive". It also records the title fetched in the
ParserOutput so it will be listed in pagelinks, just like #ifexists.

This also moves the ToString test formatter into TestFramework.lua, so
TitleLibraryTests.lua can use it too.

Change-Id: I799f3289a37fe1349b6bca5758829acf82cb718f
2013-02-28 11:57:11 -08:00
Pavel Selitskas f25b5771c5 Added be-tarask NS translations
Change-Id: I7479e33655b1993c39a4761ff2e5366c45e23f26
2013-02-28 17:24:52 +03:00
Siebrand Mazeland e982ecc472 Add Dutch namespace names
Also add a standard header.

Change-Id: Ib2bc381e859ef527e03da9680a462755bcc35a4d
2013-02-28 08:01:13 +01:00
Liangent cb09e3e20c Add Chinese namespace names
Change-Id: I0165d3f9a518334b716f57923346ce743bbdbfcc
2013-02-28 14:51:59 +08:00
umherirrender c8163a5fe7 Add german namespace aliases
Change-Id: Ife87f6959d25b6ed5749cb4c58c75a17a5a2d542
2013-02-27 21:07:16 +01:00
Brad Jorsch ba09ba3fde Add mw.message library
Change-Id: I12ca84f848c34f1227ee8acdc8bc04bdfd0b2d97
2013-02-26 22:20:04 -08:00
Translation updater bot 07d6ed437a Localisation updates from http://translatewiki.net.
Change-Id: I9347f23807bc0ae76633cb3e17b8733b7be72b2a
2013-02-26 20:52:32 +00:00
Brad Jorsch 2b08f5a5c0 Fix NaN unit test in phpunit 3.7.14
In phpunit 3.6.10, assertEquals considered two NaNs to be equivalent.
Somewhere between that and phpunit 3.7.14, this behavior changed so NaNs
are no longer considered equivalent.

Change-Id: I2c664498eb34cf5119a2eaaa96a6be57b821ab94
2013-02-25 16:56:15 -08:00
jenkins-bot bf689b7758 Merge "Add French namespace aliases" 2013-02-25 22:58:13 +00:00
Translation updater bot 36eb8c0fb6 Localisation updates from http://translatewiki.net.
Change-Id: I0c8512ce296944d93c46ce4351de60a1478e810a
2013-02-24 20:44:10 +00:00
Siebrand Mazeland cd43c9ffb5 Use XHTML <hr /> tag
Change-Id: Ia818d24e1070087c6571556172213307dfb9a723
2013-02-24 16:28:09 +01:00
Translation updater bot 1bbfcf3fcb Localisation updates from http://translatewiki.net.
Change-Id: I645cf954e5d17d940c765642de3cdb2957a00d79
2013-02-23 20:40:46 +00:00
Translation updater bot 8adf901706 Localisation updates from http://translatewiki.net.
Change-Id: I9724ddf2213914c5da262352a18307231cdc8bee
2013-02-22 20:13:41 +00:00
Brad Jorsch 30a75fb0f1 Add module documentation support
Add the ability for modules to be documented using a /doc subpage, which
is automatically transcluded onto the module page.

To get the transcluding to work right, I wound up having to change from
the deprecated-in-1.21 ArticleViewCustom hook to ContentHandler, as
there didn't seem to be any other way to get the ParserOutput into the
links tables. Which means Scribunto now needs MediaWiki 1.21 rather
than 1.20.

Change-Id: Id487097c2a505c11f92a3404f5d3ee98beb2570c
2013-02-22 05:01:29 +00:00
Brad Jorsch 00d4b711ed Add mw.loadData, for static data loading
People sometimes want to load large tables of constant data from a
module. Using require(), this has to be reparsed every time, which can
be slow.

mw.loadData() will load the just data once, and return a table with a
metatable cleverly designed to give read-only access to the loaded data.

Change-Id: Icec192bdbe6cfca7902fd5cb5d0e217bd8399637
2013-02-21 23:03:53 +00:00