Commit graph

825 commits

Author SHA1 Message Date
Brad Jorsch 0db3d7c6d2 Add text module
This exists for some common text-processing functions that aren't
included in string (and therefore also aren't in mw.ustring), as well as
a logical place for the "unstrip" function requested in bug 45085.

Bug: 45085
Change-Id: I47356215fcc8ddeed5f901cd933a30021394bd78
2013-03-20 10:10:15 -04:00
jenkins-bot 1745176df6 Merge "(bug 41769) Add frame:callParserFunction() and frame::extensionTag()" 2013-03-20 03:38:45 +00:00
Brad Jorsch 0dc45ff2f8 Improve caching in fetchModuleFromParser
On my test system, ScriuntoHooks::invokeHook takes about 4 seconds of
CPU time during the parse of a page containing 1000 #invokes of a module
containing a single do-nothing function. And about 2.3 of those seconds
appear to be spent in ScribuntoEngineBase::fetchModuleFromParser.

ScribuntoEngineBase::fetchModuleFromParser already assumes that if
Parser::fetchTemplateAndTitle returns the same $finalTitle then $text is
also the same and we can reuse the same module. But it seems just as
likely that the same input $title is always going to give the same
$finalTitle, so we may as well skip calling
Parser::fetchTemplateAndTitle entirely if we've seen the input $title
before.

This change takes the CPU time spent in ScriuntoHooks::invokeHook in the
test described above down to about 1.5 seconds. And since it's very
likely that $title and $finalTitle are the same (Modules don't support
redirects, so it's basically TemplateSandbox that would cause that), it
probably doesn't even increase the size of the module cache.

Change-Id: I87ad8b85d0f82791f49158d62effa6dc7c20f058
2013-03-20 02:13:33 +00:00
Translation updater bot 5e930029e7 Localisation updates from http://translatewiki.net.
Change-Id: I805dc4c37b58aa5ad14f8511bf1e54e9ca0d3af2
2013-03-19 21:44:02 +00:00
Translation updater bot 300fc07ff0 Localisation updates from http://translatewiki.net.
Change-Id: I3d1c6ddbd23c90c88b7068fcd3c3dee2bc9286fb
2013-03-18 21:07:57 +00:00
Brad Jorsch 541e61a1c4 (bug 41769) Add frame:callParserFunction() and frame::extensionTag()
Requires change I339b882010dedd714e7965e25ad650ed8b8cd48f to
mediawiki/core.

Bug: 41769
Change-Id: I0138836654b0e34c5c23daaedcdf5d4f9d1c7ab2
2013-03-18 13:46:26 -04:00
jenkins-bot 13f27fdfa2 Merge "Don't record self-link from mw.title" 2013-03-18 00:37:07 +00:00
Translation updater bot 1c7d72809c Localisation updates from http://translatewiki.net.
Change-Id: Ib0c5d00a229104882fb9e4ac5267163d2b4bcde6
2013-03-17 20:57:06 +00:00
Brad Jorsch 53c46561ab Don't record self-link from mw.title
Every Lua-using page loads the "self" title for mw.title. But we don't
want to record this self-link in the links table, because that confuses
people.

Change-Id: I1ef57daa615c176b7789f5f09bd15ee5b292ad0c
2013-03-17 14:55:04 -04:00
Translation updater bot 850320573e Localisation updates from http://translatewiki.net.
Change-Id: I3cae8cb00516da8831b40396f3b73aca12c17642
2013-03-16 21:30:35 +00:00
mxn c31b728996 (bug 45189) Added Vietnamese translations for Module namespaces
Change-Id: I7040cf1e247b1cc682a30fbda4533e1213d7fa57
2013-03-16 06:30:01 -07:00
Niklas Laxström b5015a2d8e (bug 45550) Add Portuguese translations for Module namespaces
Bug: 45550
Change-Id: I5ab549b77443990fd6614d97d20fe0cbcbfdae99
2013-03-16 08:18:48 +00:00
Translation updater bot fb5ac6492b Localisation updates from http://translatewiki.net.
Change-Id: I31fe8a7647fdf54314d3e05cc3dcdb40ee274cb0
2013-03-15 20:03:25 +00:00
Translation updater bot 198829a006 Localisation updates from http://translatewiki.net.
Change-Id: I417641df59d0535a593b3712d2772de0f5c0f628
2013-03-14 20:48:51 +00:00
jenkins-bot b59117fbdd Merge "Portable DIRECTORY_SEPARATOR :)" 2013-03-14 14:35:13 +00:00
Jens Ohlig 8fd450269c Portable DIRECTORY_SEPARATOR :)
Change-Id: I61d2ddc5367c2ffacd68c12bf9b6037cfc39d487
2013-03-14 15:09:45 +01:00
Demon 7fca5c1dbe Merge "(bug 45845) Allow for docs at non-subpages" 2013-03-13 22:37:16 +00:00
Translation updater bot fef33ba6db Localisation updates from http://translatewiki.net.
Change-Id: I128c1f7f8a33d2f68be6f91153ea0c2f0cefb0c0
2013-03-13 21:15:34 +00:00
Translation updater bot d892725a98 Localisation updates from http://translatewiki.net.
Change-Id: I034d644ee7e49951763bb61d4ca6086dd65d9ce1
2013-03-12 21:17:52 +00:00
Brad Jorsch ded331ddc9 (bug 45845) Allow for docs at non-subpages
It has been claimed that some wiki might want to place module
documentation at a location other than as a subpage of the module, for
example under "Project:Module documentation/$1". It's possible to
support this, so we may as well.

This also involves renaming the "scribunto-doc-subpage-*" messages to
"scribunto-doc-page-*", since the interpretation of
scribunto-doc-subpage-name would be drastically changed.

Note that any wiki that has customized scribunto-doc-subpage-name will
need to re-customize scribunto-doc-page-name, the old value will not be
transferred.

Bug: 45845
Change-Id: Ic453561691e04b5250d219cc7d871c17e60b9912
2013-03-12 14:33:40 -04:00
Brad Jorsch 7617f25a8b (bug 46031) scribunto-doc-subpage-name needs to be in the content language
Bug: 46031
Change-Id: I6e3c2c244f85258838774491d3bcc6ebd6a2c8c3
2013-03-12 14:18:28 -04:00
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