Jump to content

Module:AutoHeader: Difference between revisions

From The Telecommunications Inventory Wiki
No edit summary
No edit summary
Line 9: Line 9:
p.getIntroParagraph = function(frame)
p.getIntroParagraph = function(frame)
local data = p.getJson(frame)
local data = p.getJson(frame)
local title = data[0].title
local first = data[0]
local title = data[0].data.manufacturer
return first
return string.format("The %q was manufactured by %q", title)
-- local title = data[0].title
-- local manufacturer = data[0].data.manufacturer
-- return string.format("The %q was manufactured by %q", manufacturer)
end
end


return p
return p

Revision as of 16:22, 6 January 2025

Documentation for this module may be created at Module:AutoHeader/doc

local p = {}

p.getJson = function(frame)
	-- local ret = mw.visualdata.query( schema ("inventory_item"), query (string), printouts (list or table), params (table)  )
	local ret = mw.visualdata.query( 'Phone', '[[manufacturer::+]]', {'manufacturer'}, {} )
	return mw.text.jsonEncode(ret)
end

p.getIntroParagraph = function(frame)
	local data = p.getJson(frame)
	local first = data[0]
	return first
	-- local title = data[0].title
	-- local manufacturer = data[0].data.manufacturer
	-- return string.format("The %q was manufactured by %q", manufacturer)
end

return p