Module:Key press

From RuneRealm Wiki

This is the current revision of this page, as edited by Alex (talk | contribs) at 00:12, 17 October 2024 (Created page with "-- <pre> local p = {} function p.main(frame) local args = frame:getParent().args local ret = mw.html.create('span') :css('white-space','nowrap') local sep = args.sep or '+' local keys = {} local tblsize = 0 for i, v in ipairs(args) do tblsize = i table.insert(keys,v) end for i, v in ipairs(keys) do ret :tag('kbd') :addClass('keypress') :wikitext(v) :done() if i < tblsize then ret:wikitext(sep) end end return tostring(ret) end..."). The present address (URL) is a permanent link to this version.

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Module documentation
This documentation is transcluded from Template:No documentation/doc. [edit] [history] [purge]
This module does not have any documentation. Please consider adding documentation at Module:Key press/doc. [edit]
Module:Key press's function main is invoked by Template:Key press.

-- <pre>
local p = {}

function p.main(frame)
	local args = frame:getParent().args

	local ret = mw.html.create('span')
				:css('white-space','nowrap')

	local sep = args.sep or '+'
	local keys = {}
	local tblsize = 0

	for i, v in ipairs(args) do
		tblsize = i
		table.insert(keys,v)
	end

	for i, v in ipairs(keys) do
		ret	:tag('kbd')
				:addClass('keypress')
				:wikitext(v)
			:done()

		if i < tblsize then
			ret:wikitext(sep)
		end
	end

	return tostring(ret)
end

return p