mediawiki-extensions-Scribunto/includes/engines/LuaCommon/lualib
Kunal Mehta a839ba855d Add mw.loadJsonData()
Backporting this so the LTS release has forwards compatibility with
Wikipedia templates.

mw.loadData() allows for optimizing the loading Lua tables by requiring
only one parse and lookup. However it's often easier for people to
write/maintain bulk data in JSON rather than Lua tables.

mw.loadJsonData() has roughly the same characteristics as mw.loadData()
and it can be used on JSON content model pages in any namespace.

As noted on the linked bug report, it's possible to already implement
this by writing a wrapper Lua module that loads and parses the JSON
content. But that requires a dummy module for each JSON page, which is
just annoying and inconvenient.

Test cases are copied from the mw.loadData() ones, with a few omissions
for syntax not supported in JSON (e.g. NaN, infinity, etc.).

Bug: T217500
Change-Id: I1b35ad27a37b94064707bb8c9b7108c7078ed4d1
(cherry picked from commit 1000d322e5)
2022-11-07 07:34:42 +00:00
..
luabit Minor cleanup 2022-04-16 22:09:10 +01:00
ustring Fix MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment 2022-07-30 18:56:55 +00:00
bit32.lua Move classes into includes/ 2018-04-09 08:54:22 -07:00
libraryUtil.lua Move classes into includes/ 2018-04-09 08:54:22 -07:00
mw.hash.lua Move classes into includes/ 2018-04-09 08:54:22 -07:00
mw.html.lua Move classes into includes/ 2018-04-09 08:54:22 -07:00
mw.language.lua Move classes into includes/ 2018-04-09 08:54:22 -07:00
mw.lua Add mw.loadJsonData() 2022-11-07 07:34:42 +00:00
mw.message.lua Move classes into includes/ 2018-04-09 08:54:22 -07:00
mw.site.lua Move classes into includes/ 2018-04-09 08:54:22 -07:00
mw.text.lua Revert "Namespace LuaCommon" 2022-08-03 10:03:12 +00:00
mw.title.lua Revert "mw.title: Add pageLanguage property" 2022-01-06 22:13:30 +00:00
mw.uri.lua mw.uri: Support IP-Literal syntax 2019-05-19 07:55:29 +00:00
mw.ustring.lua Move classes into includes/ 2018-04-09 08:54:22 -07:00
mwInit.lua Move classes into includes/ 2018-04-09 08:54:22 -07:00
package.lua Move classes into includes/ 2018-04-09 08:54:22 -07:00
strict.lua Add strict.lua to replace "Module:No globals" 2022-11-06 21:58:19 -08:00