Module:AutoHeader: Difference between revisions
Appearance
Intcreator (talk | contribs) No edit summary |
Intcreator (talk | contribs) No edit summary |
||
Line 20: | Line 20: | ||
local title = obj.title | local title = obj.title | ||
local manufacturer = obj.data.manufacturer | local manufacturer = obj.data.manufacturer | ||
return string.format('The % | return string.format('The %s was manufactured by %s', title, manufacturer) | ||
end | end | ||
return p | return p |
Revision as of 18:51, 6 January 2025
Documentation for this module may be created at Module:AutoHeader/doc
local p = {}
p.getData = function(frame)
-- local ret = mw.visualdata.query( schema ("inventory_item"), query (string), printouts (list or table), params (table) )
local result = mw.visualdata.query( 'Phone', '[[manufacturer::+]]', {'manufacturer'}, {} )
return result
end
p.getJson = function(frame)
local data = p.getData(frame)
return mw.text.jsonEncode(data)
end
p.getIntroParagraph = function(frame)
local data = p.getData(frame)
-- for k in pairs(data) do return k end
-- local first = data[1]
-- return mw.text.jsonEncode(first)
local obj = data[1]
local title = obj.title
local manufacturer = obj.data.manufacturer
return string.format('The %s was manufactured by %s', title, manufacturer)
end
return p