Module:Infobox/Widget/Row: Difference between revisions

From TwogPedia
No edit summary
No edit summary
Line 13: Line 13:
return container:node(name):node(value)
return container:node(name):node(value)
end
end
mw.log(frame)
mw.logObject(frame)
if frame then
if frame then
mw.log('on frame')
mw.log('on frame')

Revision as of 20:33, 31 August 2022

Documentation for this module may be created at Module:Infobox/Widget/Row/doc

local Row = {}

function Row.make(rowName, value, frame)
	local container = mw.html.create('div')
		:addClass('ib-row')
	local name = mw.html.create('div')
			:addClass('ib-rowName')
			:wikitext(rowName .. ': ')
	local valueNode = mw.html.create('div')
	
	-- If value is table
	if type(value) ~= 'string' then
		return container:node(name):node(value)
	end
	mw.log(frame)
	mw.logObject(frame)
	if frame then
		mw.log('on frame')
		mw.log('value: ' .. value)
		local pageExists = frame:callParserFunction('#ifexist', value, 'yes', 'no' )
		if ( pageExists == 'yes' ) then 
			valueNode:wikitext('[[' .. value .. '|' .. value.. ']]')
		else
			valueNode:wikitext(value)
		end
	else 
		valueNode:wikitext(value)
	end
	
	return container:node(name):node(valueNode)
end


return Row