Module:Sandbox/Nihiltres/Testing: Difference between revisions

Content deleted Content added
Update with JSON-import test
m Changed default test class to "unassessed"
 
(3 intermediate revisions by the same user not shown)
Line 2:
 
function p.main (frame)
local foo = 'Result of tested Lua snippet would be here.'
local bar = mw.loadData('Module:Sandbox/NihiltresClass/ImportimportDefinitions')
local foo = barmw.html.textcreate("td")
local dtc = "unassessed" --default test class
return mw.dumpObject(foo)
local class = bar[frame.args[1] or dtc] or bar[dtc]
local styleBasics = "text-align: center; font-weight: bold; "
foo:attr(
"style",
styleBasics .. string.format("background-color: %s;", class.colour)
)
local img = class.icon.default and string.format(
"[[File:%s|16px|%s|link=|alt=]] ",
class.icon.file,
class.labels.full
) or ""
local link = string.format(
"[[:%s|%s]]",
class.category,
class.labels.short
)
foo:wikitext(img, link)
return foo
--return mw.dumpObject(foo)
end