PC Gaming Shelter
An archive dedicated to preserving PC Gaming history and more

Module:Link

From PC Gaming Shelter
Revision as of 21:44, 22 March 2026 by WikiVisor (talk | contribs) (Created page with "local utils = require( 'Module:Utils' ) local p = {} local function propertiesPlan() return { ['URL'] = {'Has URL'}, ['Link text'] = {'Has link text'}, ['Link group'] = {'Belongs to group'} } end function p.main(frame) local args = frame:getParent().args local propMap = propertiesPlan() local props = utils.setProperties(propMap, args) or {} mw.smw.subobject(props) local url = args['URL'] or nil local label = args['Link text'] or nil local link = '...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

local utils = require( 'Module:Utils' )

local p = {}

local function propertiesPlan()
	return {
		['URL'] 	   = {'Has URL'},
		['Link text']  = {'Has link text'},
		['Link group'] = {'Belongs to group'}
	}
end

function p.main(frame)
	local args = frame:getParent().args
	local propMap = propertiesPlan()
	local props = utils.setProperties(propMap, args) or {}
	mw.smw.subobject(props)

	local url = args['URL'] or nil
	local label = args['Link text'] or nil
	local link = ''	
	if label and url then
		link = string.format('<li>[%s %s]</li>', url, label)
	end
	
	return link
end

return p