Hopp til innhold

Modul:Clickable button 2

Fra Wikipedia, den frie encyklopedi
Sideversjon per 10. jun. 2014 kl. 12:09 av Mr. Stradivarius (diskusjon | bidrag) (start work on a replacement for Template:Clickable button 2)
(diff) ← Eldre sideversjon | Nåværende sideversjon (diff) | Nyere sideversjon → (diff)
Moduldokumentasjon

This module implements the {{clickable button 2}} template.

Usage from wikitext

To use this template from wikitext, you should normally use the {{clickable button 2}} template. However, it can also be used with the syntax {{#invoke:Clickable button 2|main|args}}. Please see the template page for a list of available parameters.

Usage from Lua modules

To use this module from other Lua modules, first load the module.

local mClickableButton2 = require('Module:Clickable button 2')

You can then generate a button using the luaMain function.

mClickableButton2.luaMain(args)

The args variable should be a table containing the arguments to pass to the module. To see the different arguments that can be specified and how they affect the module output, please refer to the {{clickable button 2}} template documentation.


-- This module implements {{clickable button 2}}.

local p = {}

function p.main(frame)
	local args = require('Module:Arguments').getArgs(frame)
	return p.luaMain(args)
end

function p.luaMain(args)
end

function p.renderUrlButton(data)
end

function p.renderWikilinkButton(data)
end

function p.renderDisplaySpan(data)
	local span = mw.html.create('span')
	for i, class in ipairs(data.classes or {}) do
		span:addClass(class)
	end
	span
		:attr('role', 'button')
		:attr('aria-disabled', 'false')
		:css{
			['background-color'] = data.backgroundColor,
			color = data.color
		}
	if data.style then
		span:cssText(style)
	end
	span:wikitext(data.display)
	return tostring(span)
end

return p