Module:GetRels: Difference between revisions

From Bodhicitta
((by SublimeText.Mediawiker))
((by SublimeText.Mediawiker))
Line 8: Line 8:
return 'No relationships!'
return 'No relationships!'
else
else
local output = '<h1>Relationships</h1><table class="smwtable-clean th-top-right th-nowrap">'
local output = '<h1>Relationships</h1><table class="smwtable-clean th-top-right th-nowrap border">'


if type(pdata) == "table" then
if type(pdata) == "table" then

Revision as of 12:39, 3 July 2024

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

local p = {}

function p.main(frame)

	local pdata = mw.loadData('Module:GetData/relationships')
	local pargs = frame:getParent().args
	if not pdata then
		return 'No relationships!'
	else
		local output = '<h1>Relationships</h1><table class="smwtable-clean th-top-right th-nowrap border">'

		if type(pdata) == "table" then
		    for _, data in ipairs( pdata ) do
		    	output = output .. '<tr><th>' .. data.Relationship .. '</th><td>' .. data.RelatedTo .. '</td></tr>'
		    end
		end

		output = output .. '</table>'

		return output
	end
end

return p