Module:OnshokoeseScript
Documentation for this module may be created at Module:OnshokoeseScript/doc
local getArgs = require('Module:Arguments').getArgs
local p = {}
local CharData = mw.loadData( 'Module:OnshokoeseScript/data' )
function p._onshokoese( humanwords, size )
local output_string = {}
local humanwords = string.lower(humanwords)
local span = mw.html.create( 'span' )
if (size == nil or size == '') then size='14' end
local i=1
local j=string.len(humanwords)
while (i <= j) do
local replacement = CharData[humanwords:sub(i,i + 2)]
if replacement ~= nil then
table.insert(output_string,'[[File:'..replacement..'|x'..size..'px|link=]]')
i = i + 3
else
local replacement = CharData[humanwords:sub(i,i + 1)]
if replacement ~= nil then
table.insert(output_string,'[[File:'..replacement..'|x'..size..'px|link=]]')
i = i + 2
else
local replacement = CharData[humanwords:sub(i,i)]
if replacement ~= nil then
table.insert(output_string,'[[File:'..replacement..'|x'..size..'px|link=]]')
else
table.insert(output_string,' ')
i = i + 1
end
end
end
end
span :css( 'font-size', size..'px' )
:wikitext( table.concat(output_string) )
return tostring(span)
end
function p.main(frame)
local string_input = frame.args[1]
local num_input = frame.args[2]
return p._onshokoese(string_input, num_input)
end
function p._main(args)
local first = args[1] or ''
local second = args[2] or ''
return first .. ' ' .. second
end
return p