Module:Infobox/Widget/Row: Difference between revisions

From TwogPedia
(Created page with "local Row = {} function Row.make(rowName, value, checkIfExists) mw.log('VALUE TYPEEE') mw.log(type(value)) 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 checkIfExists then local pageExists = frame:callParserFunction('#ifexist', value, 'yes', 'no' ) if ( pageExists == 'yes' ) then valueNode:wikitext('[[' .....")
 
No edit summary
Line 22: Line 22:
end
end
return container
return container:node(name):node(valueNode)
end
end




return Row
return Row

Revision as of 17:26, 30 August 2022

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

local Row = {}

function Row.make(rowName, value, checkIfExists)
	mw.log('VALUE TYPEEE')
	mw.log(type(value))
	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 checkIfExists then
		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