FANDOM


-- <nowiki>
local p = {}
 
local hc = require('Module:Paramtest').has_content
local tooltip = require('Module:Tooltip')
 
local size = 'x11px'
 
local function char2menap(character)
	if character:find('[A-Za-z]') then
		return string.format('[[File:Menaphite %s.svg|%s|link=]]', character:upper(), size)
	else
		return character
	end
end
 
function p.main(frame)
	local args = frame:getParent().args
	if hc(args.size) then
		size = args.size
	end
 
	local txt = args[1]
 
 
	local ret = {}
 
	for _,v in ipairs(mw.text.split(txt, '')) do
		table.insert(ret, char2menap(v))
	end
 
	local tag = 'span'
	if txt:find('\n') then
		tag = 'div'
	end
 
 
	local rettag = mw.html.create(tag)
 
	rettag:addClass('menaphite-script')
			:attr('data-en', txt)
			:wikitext(table.concat(ret, ''))
 
 
	if hc(args.tooltip) then
		local tt_name = string.format('menap-tt-%s-%s-%s', txt:len(), txt:sub(1,6), math.random(100000)) -- try to unique-ify this without just putting the entire text there (mw.hash not available)
 
		local tt_span = tooltip._span({name=tt_name, alt='Text'})
		local tt_div = tooltip._div({name=tt_name, content=txt})
 
		rettag:wikitext(tostring(tt_span))
				:wikitext(tostring(tt_div))
	else
		rettag:attr('title', txt)
	end
 
	return tostring(rettag)
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.