FANDOM


-- <pre>
local p = {}
 
local hasc = require('Module:Paramtest').has_content
 
function p.main(frame)
	local args = frame:getParent().args
	local items = {}
 
	local i = 1
	while hasc(args[i]) do
		local item = mw.text.trim(args[i])
		local key
		local tooltip
 
		if item:lower() == 'accept' then
			key = '&#x2713;'
			tooltip = '[Accept Quest]'
		elseif item:lower() == 'any' or item == '#' or item == '~' then
			key = '~'
			tooltip = '[Any option]'
		else -- Match first case-insensitive, alphanumeric character
			key = item:match('^[A-Za-z0-9]')
			if key then
				tooltip = mw.text.trim(mw.ustring.sub(item, 2))
			end
		end
 
		table.insert(items, { key, tooltip })
		i = i + 1
	end
 
	return p._main(items)
end
 
function p._main(items)
	local element = mw.html.create('span')
 
	element:addClass('chat-options')
		:wikitext('(<i title="Chat options">[[File:Quick chat button.png|alt=Chat|link=]]</i> ')
 
	local k,t,kspan
	local keys = {}
	for i,v in ipairs(items) do
		k = mw.text.trim(v[1])
		t = mw.text.trim(v[2])
		kspan = mw.html.create('span')
		kspan:wikitext(k)
 
		if hasc(t) then
			kspan	:addClass('chat-options-underline')
					:attr('title', t)
		end
 
		table.insert(keys, tostring(kspan))
	end
 
	element:wikitext(table.concat(keys, '&bull;')):wikitext(')')
 
	return tostring(element)
end
 
return p

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.