local getArgs = require('Module:Arguments').getArgs
local p = {}
function p.main(frame)
local args = getArgs(frame)
local text = args[1] or ''
local size = args[2] or ''
local chars = {}
local mappedChars = {}
local out = {}
if text == '' then
return ''
end
for char in mw.ustring.gmatch(text, '.') do
table.insert(chars, char)
end
for _, char in ipairs(chars) do
local mappedChar = frame:expandTemplate{ title = '宇宙语字母', args = { char, size } }
table.insert(mappedChars, mappedChar)
end
table.insert(out, '<span class="uchuugo-str" title="' .. mw.ustring.gsub(text, '_', ' ') .. '" style="display:inline-block">')
table.insert(out, table.concat(mappedChars))
table.insert(out, '</span>')
return table.concat(out)
end
return p