Commit graph

2035 commits

Author SHA1 Message Date
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
jenkins-bot 7c6f9cca5f Merge "Enable subpages" 2013-02-21 22:28:26 +00:00
Translation updater bot 5f8c96aa3d Localisation updates from http://translatewiki.net.
Change-Id: Ia9abe0cf88192dd494b68796214b0f84ce28ba82
2013-02-21 20:20:46 +00:00
Brad Jorsch d20af1dce4 Enable subpages
Subpages should probably be enabled by default for the Module namespace,
considering that we're planning on using /doc subpages for
documentation.

Change-Id: Ie9d192f807e8d5cd04484f6418fd5fa64e0d3117
2013-02-20 21:53:47 -05:00
Translation updater bot 3f575edd66 Localisation updates from http://translatewiki.net.
Change-Id: Ia10472ba3e9b9f0ea770ff8c1596665914f7b71d
2013-02-19 20:39:54 +00:00
Jérémie Roquet 6173f4b92d Add French namespace aliases
Change-Id: I428661ec09b07309ba5e0038598f4693151374c1
2013-02-19 14:37:21 +01:00
Translation updater bot d1c42ed5c7 Localisation updates from http://translatewiki.net.
Change-Id: Ic4eaf1ddbb827df5d2cc6e32f186ad8f7ab2d876
2013-02-18 20:59:06 +00:00
Tim Starling 96615c97b0 Explicitly destroy the loadedLibraries array
Otherwise there is a circular reference and the engine is not destroyed
until the end of the request.

Change-Id: I9c98fe449c19d22e771e11d485e5516059c45329
2013-02-18 10:41:12 +11:00
Brad Jorsch 2d36fbc492 Scribunto language library
Added a language library. Introduced functions which are easy and safe,
most of them already have parser function interfaces.

Change-Id: I4465150f3e16493a15a056f7ddb7787bdf3b0373
2013-02-18 10:41:12 +11:00
Translation updater bot 799440eb4f Localisation updates from http://translatewiki.net.
Change-Id: Ic733b6784390a9bb9b9b6e95a6b97a4d620b05c0
2013-02-17 20:49:33 +00:00
Brad Jorsch 4ff1dbd6a7 Document Scribunto_LuaEngine
Some parts of this that really should be documented aren't. Fix that.

Change-Id: I058f47a08a7529a8d2a70e5b50e4532db7bdb720
2013-02-15 18:42:07 -05:00
Translation updater bot 60949bbfd4 Localisation updates from http://translatewiki.net.
Change-Id: I21f4d1dfe8aaff5d55117bd267a4615bb8544b27
2013-02-15 20:37:00 +00:00
jenkins-bot 2980cf4c11 Merge "Fix mw.ustring.gmatch and patterns with '^'" 2013-02-15 08:22:11 +00:00
Brad Jorsch 1efe182e40 Hide mw.makeProtectedEnvFuncs from modules
Allowing a module to call mw.makeProtectedEnvFuncs() lets it bypass the
allowEnvFuncs setting. It can also be used to manipulate the global
tables that other modules' sandboxes will be copied from.

And for paranoia's sake, let's tighten up what setfenv is allowed to
set. This requires changing a unit test, because it is no longer
sane to do something like

 env.setfenv, env.getfenv = mw.makeProtectedEnvFuncs( { [env] = true }, {} )

Nothing real does this, it was only in the unit test.

Change-Id: I8e0d83bb0980ee869af3ac4413afd211717ca92f
2013-02-14 16:49:15 -05:00
Translation updater bot 14455fec4c Localisation updates from http://translatewiki.net.
Change-Id: I6eaf5f10aa1eacf917aca7a4160e560ee9ed9ce2
2013-02-14 20:32:06 +00:00
Brad Jorsch 4dcac2fcd9 Fix mw.ustring.gmatch and patterns with '^'
The Lua manual says this:

 For this function, a '^' at the start of a pattern does not work as an
 anchor, as this would prevent the iteration.

I had interpreted that to mean that a pattern starting with '^' would
never match in gmatch. But further testing reveals that the '^' is just
treated as a literal character: string.gmatch( "foo ^bar baz", "^%a+" )
will match "^bar".

Change-Id: Id91d6ee2db753ce1d6a4f6ae27764691d9e9fdc4
2013-02-14 14:25:55 -05:00
Chad Horohoe c98cc64545 Allow extensions to add libraries
Wikidata has already requested the ability to add libraries into Lua. We
do this in a simple way: add a $wgScribuntoExtraLibraries global, and
load whatever modules someone puts there.

Change-Id: I460b4e7b968eb02dd86620f1e4b50daf1be9e901
2013-02-14 12:38:03 -05:00
Brad Jorsch e66ccb89b4 Test for leaked global variables
It's easy to forget a 'local' somewhere and accidentally leak a global
variable. Add a unit test to catch that.

Change-Id: I3a8dda22f108d88039f9562a1da7a739850bb14b
2013-02-14 04:02:48 +00:00
Translation updater bot aeb3360bd6 Localisation updates from http://translatewiki.net.
Change-Id: I70aa102b496adf1923058c362ce50dedd2df38dd
2013-02-13 21:46:14 +00:00
Translation updater bot 228dcc45ef Localisation updates from http://translatewiki.net.
Change-Id: Ic4a130e871ced2a18cb1d9eeee74290bdab614f0
2013-02-13 21:05:03 +00:00