Difference between revisions of "Module:Sandbox/Was a bee/Dump"
Jump to navigation
Jump to search
blackwiki>Was a bee (←Replaced content with '-- Copied from Module:Wikidata. Main developer is User:RexxS. local p = {} -- internationalisation local i18n = { ["warnDump"] = "[[Category:Calle...') |
blackwiki>Was a bee |
||
| Line 20: | Line 20: | ||
overflowY = "" | overflowY = "" | ||
end | end | ||
| − | mw.logObject(height) | + | --mw.logObject(height) |
| − | mw.logObject(overflowY) | + | --mw.logObject(overflowY) |
if not data then | if not data then | ||
return i18n.warnDump | return i18n.warnDump | ||
end | end | ||
| + | local pathText = f.args.id .. " > " | ||
local i = 1 | local i = 1 | ||
while true do | while true do | ||
local index = f.args[i] | local index = f.args[i] | ||
if (not index) or (index == "") then | if (not index) or (index == "") then | ||
| − | return f:extensionTag{ name = 'syntaxhighlight', content = mw.dumpObject(data), args = {lang = "javascript", style = "width: " .. width .. ";" .. "height: " .. height .. ";" .. "overflow-y: " .. overflowY .. ";" .. "overflow-x: hidden;" } } .. i18n.warnDump | + | return pathText .. f:extensionTag{ name = 'syntaxhighlight', content = mw.dumpObject(data), args = {lang = "javascript", style = "width: " .. width .. ";" .. "height: " .. height .. ";" .. "overflow-y: " .. overflowY .. ";" .. "overflow-x: hidden;" } } .. i18n.warnDump |
end | end | ||
| + | pathText = pathText .. index .. " > " | ||
data = data[index] or data[tonumber(index)] | data = data[index] or data[tonumber(index)] | ||
if not data then | if not data then | ||
Revision as of 13:13, 11 June 2018
| File:Alpha lowercase.svg | This module is rated as alpha. It is ready for third-party input, and may be used on a few pages to see if problems arise, but should be watched. Suggestions for new features or changes in their input and output mechanisms are welcome. |
→ See Template:Dump.
-- Copied from [[Module:Wikidata]]. Main developer is [[User:RexxS]].
local p = {}
-- internationalisation
local i18n =
{
["warnDump"] = "[[Category:Called function 'Dump' from module Wikidata]]",
}
function p.Dump(frame)
local f = (frame.args[1] or frame.args.id) and frame or frame:getParent()
local data = mw.wikibase.getEntityObject(f.args.id)
local width = f.args.width or "100%"
local height = f.args.height or ""
local overflowY
if (height ~= nil) and (height ~= "") then
overflowY = "scroll"
else
overflowY = ""
end
--mw.logObject(height)
--mw.logObject(overflowY)
if not data then
return i18n.warnDump
end
local pathText = f.args.id .. " > "
local i = 1
while true do
local index = f.args[i]
if (not index) or (index == "") then
return pathText .. f:extensionTag{ name = 'syntaxhighlight', content = mw.dumpObject(data), args = {lang = "javascript", style = "width: " .. width .. ";" .. "height: " .. height .. ";" .. "overflow-y: " .. overflowY .. ";" .. "overflow-x: hidden;" } } .. i18n.warnDump
end
pathText = pathText .. index .. " > "
data = data[index] or data[tonumber(index)]
if not data then
return i18n.warnDump
end
i = i + 1
end
end
return p