Module:CustomScript

From Omniversalis

Documentation for this module may be created at Module:CustomScript/doc

--Conworlds Wiki Custom Language Conversion
--http://conworld.wikia.com/
--Initial wikitext implementation by User:Flaicher
--Lua conversion by User:ChickenBar
--Modified for Conworlds Wiki by User:Vivaporius

local p = {}

local CharData = mw.loadData( 'Module:CustomScript/data' )

function p._mikaean( 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
    for i=1, string.len(humanwords) do
        local replacement = CharData["MikaeanChar"][humanwords:sub(i,i)]
        if replacement ~= nil then
            table.insert(output_string,'[[File:'..replacement..'|x'..size..'px|link=]]')
        else
            table.insert(output_string,'  ')
        end
    end
    span    :css( 'font-size', size..'px' )
            :wikitext( table.concat(output_string) )
    return tostring(span)
end

function p.mikaean( frame )
    local string_input = frame.args[1]
    local num_input = frame.args[2]
    return p._mikaean(string_input, num_input)
    
end

function p._erykan( 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
    for i=1, string.len(humanwords) do
        local replacement = CharData["ErykanChar"][humanwords:sub(i,i)]
        if replacement ~= nil then
            table.insert(output_string,'[[File:'..replacement..'|x'..size..'px|link=]]')
        else
            table.insert(output_string,'  ')
        end
    end
    span    :css( 'font-size', size..'px' )
            :wikitext( table.concat(output_string) )
    return tostring(span)
end

function p.erykan( frame )
    local string_input = frame.args[1]
    local num_input = frame.args[2]
    return p._erykan(string_input, num_input)
    
end
    
function p._serran( humanwords, size )
    local output_string = {}
    local humanwords = string.lower(humanwords)
    local span = mw.html.create( 'span' )
    if (size == nil or size == '') then size='10' end
    for i=1, string.len(humanwords) do
        local replacement = CharData["SerranChar"][humanwords:sub(i,i)]
        if replacement ~= nil then
            table.insert(output_string,'[[File:'..replacement..'|x'..size..'px|link=]]')
        else
            table.insert(output_string,'  ')
        end
    end
    span    :css( 'font-size', size..'px' )
            :wikitext( table.concat(output_string) )
    return tostring(span)
end

function p.serran( frame )
    local string_input = frame.args[1]
    local num_input = frame.args[2]
    return p._serran(string_input, num_input)

end

function p._lurberan( 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
    for i=1, string.len(humanwords) do
        local replacement = CharData["LurberanChar"][humanwords:sub(i,i)]
        if replacement ~= nil then
            table.insert(output_string,'[[File:'..replacement..'|x'..size..'px|link=]]')
        else
            table.insert(output_string,'  ')
        end
    end
    span    :css( 'font-size', size..'px' )
            :wikitext( table.concat(output_string) )
    return tostring(span)
end

function p.lurberan( frame )
    local string_input = frame.args[1]
    local num_input = frame.args[2]
    return p._lurberan(string_input, num_input)
    
end

function p._prusian( 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
    for i=1, string.len(humanwords) do
        local replacement = CharData["PrusianChar"][humanwords:sub(i,i)]
        if replacement ~= nil then
            table.insert(output_string,'[[File:'..replacement..'|x'..size..'px|link=]]')
        else
            table.insert(output_string,'  ')
        end
    end
    span    :css( 'font-size', size..'px' )
            :wikitext( table.concat(output_string) )
    return tostring(span)
end

function p.prusian( frame )
    local string_input = frame.args[1]
    local num_input = frame.args[2]
    return p._prusian(string_input, num_input)
end

function p._isokyrian( 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
    for i=1, string.len(humanwords) do
        local replacement = CharData["IsokyrianChar"][humanwords:sub(i,i)]
        if replacement ~= nil then
            table.insert(output_string,'[[File:'..replacement..'|x'..size..'px|link=]]')
        else
            table.insert(output_string,'  ')
        end
    end
    span    :css( 'font-size', size..'px' )
            :wikitext( table.concat(output_string) )
    return tostring(span)
end

function p.isokyrian( frame )
    local string_input = frame.args[1]
    local num_input = frame.args[2]
    return p._isokyrian(string_input, num_input)
    
end

function p._kanian( 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
    for i=1, string.len(humanwords) do
        local replacement = CharData["KanianChar"][humanwords:sub(i,i)]
        if replacement ~= nil then
            table.insert(output_string,'[[File:'..replacement..'|x'..size..'px|link=]]')
        else
            table.insert(output_string,'  ')
        end
    end
    span    :css( 'font-size', size..'px' )
            :wikitext( table.concat(output_string) )
    return tostring(span)
end

function p.kanian( frame )
    local string_input = frame.args[1]
    local num_input = frame.args[2]
    return p._kanian(string_input, num_input)
    
end

function p._vespian( 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
    for i=1, string.len(humanwords) do
        local replacement = CharData["VespianChar"][humanwords:sub(i,i)]
        if replacement ~= nil then
            table.insert(output_string,'[[File:'..replacement..'|x'..size..'px|link=]]')
        else
            table.insert(output_string,'  ')
        end
    end
    span    :css( 'font-size', size..'px' )
            :wikitext( table.concat(output_string) )
    return tostring(span)
end

function p.vespian( frame )
    local string_input = frame.args[1]
    local num_input = frame.args[2]
    return p._vespian(string_input, num_input)
    
end

function p._mikazhi( 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
    for i=1, string.len(humanwords) do
        local replacement = CharData["MikazhiChar"][humanwords:sub(i,i)]
        if replacement ~= nil then
            table.insert(output_string,'[[File:'..replacement..'|x'..size..'px|link=]]')
        else
            table.insert(output_string,'  ')
        end
    end
    span    :css( 'font-size', size..'px' )
            :wikitext( table.concat(output_string) )
    return tostring(span)
end

function p.mikazhi( frame )
    local string_input = frame.args[1]
    local num_input = frame.args[2]
    return p._mikazhi(string_input, num_input)
    
end

function p._kai( humanwords, size )
    local output_string = {}
    local humanwords = string.lower(humanwords)
    local span = mw.html.create( 'span' )
    if (size == nil or size == '') then size='10' end
    for i=1, string.len(humanwords) do
        local replacement = CharData["KaiChar"][humanwords:sub(i,i)]
        if replacement ~= nil then
            table.insert(output_string,'[[File:'..replacement..'|x'..size..'px|link=]]')
        else
            table.insert(output_string,'  ')
        end
    end
    span    :css( 'font-size', size..'px' )
            :wikitext( table.concat(output_string) )
    return tostring(span)
end

function p.kai( frame )
    local string_input = frame.args[1]
    local num_input = frame.args[2]
    return p._kai(string_input, num_input)

end

function p._oldkai( humanwords, size )
    local output_string = {}
    local humanwords = string.lower(humanwords)
    local span = mw.html.create( 'span' )
    if (size == nil or size == '') then size='10' end
    for i=1, string.len(humanwords) do
        local replacement = CharData["OldKaiChar"][humanwords:sub(i,i)]
        if replacement ~= nil then
            table.insert(output_string,'[[File:'..replacement..'|x'..size..'px|link=]]')
        else
            table.insert(output_string,'  ')
        end
    end
    span    :css( 'font-size', size..'px' )
            :wikitext( table.concat(output_string) )
    return tostring(span)
end

function p.oldkai( frame )
    local string_input = frame.args[1]
    local num_input = frame.args[2]
    return p._oldkai(string_input, num_input)

end

function p._eerie( humanwords, size )
    local output_string = {}
    local humanwords = string.lower(humanwords)
    local span = mw.html.create( 'span' )
    if (size == nil or size == '') then size='10' end
    for i=1, string.len(humanwords) do
        local replacement = CharData["EerieChar"][humanwords:sub(i,i)]
        if replacement ~= nil then
            table.insert(output_string,'[[File:'..replacement..'|x'..size..'px|link=]]')
        else
            table.insert(output_string,'  ')
        end
    end
    span    :css( 'font-size', size..'px' )
            :wikitext( table.concat(output_string) )
    return tostring(span)
end

function p.eerie( frame )
    local string_input = frame.args[1]
    local num_input = frame.args[2]
    return p._eerie(string_input, num_input)

end

function p._ohaxa( humanwords, size )
    local output_string = {}
    local humanwords = string.lower(humanwords)
    local span = mw.html.create( 'span' )
    if (size == nil or size == '') then size='10' end
    for i=1, string.len(humanwords) do
        local replacement = CharData["OhaxaChar"][humanwords:sub(i,i)]
        if replacement ~= nil then
            table.insert(output_string,'[[File:'..replacement..'|x'..size..'px|link=]]')
        else
            table.insert(output_string,'  ')
        end
    end
    span    :css( 'font-size', size..'px' )
            :wikitext( table.concat(output_string) )
    return tostring(span)
end

function p.ohaxa( frame )
    local string_input = frame.args[1]
    local num_input = frame.args[2]
    return p._ohaxa(string_input, num_input)

end

function p._oro( humanwords, size )
    local output_string = {}
    local humanwords = string.lower(humanwords)
    local span = mw.html.create( 'span' )
    if (size == nil or size == '') then size='10' end
    for i=1, string.len(humanwords) do
        local replacement = CharData["OroChar"][humanwords:sub(i,i)]
        if replacement ~= nil then
            table.insert(output_string,'[[File:'..replacement..'|x'..size..'px|link=]]')
        else
            table.insert(output_string,'  ')
        end
    end
    span    :css( 'font-size', size..'px' )
            :wikitext( table.concat(output_string) )
    return tostring(span)
end

function p.oro( frame )
    local string_input = frame.args[1]
    local num_input = frame.args[2]
    return p._oro(string_input, num_input)

end

function p._iioouya( humanwords, size )
    local output_string = {}
    local humanwords = string.lower(humanwords)
    local span = mw.html.create( 'span' )
    if (size == nil or size == '') then size='10' end
    for i=1, string.len(humanwords) do
        local replacement = CharData["IioouyaChar"][humanwords:sub(i,i)]
        if replacement ~= nil then
            table.insert(output_string,'[[File:'..replacement..'|x'..size..'px|link=]]')
        else
            table.insert(output_string,'  ')
        end
    end
    span    :css( 'font-size', size..'px' )
            :wikitext( table.concat(output_string) )
    return tostring(span)
end

function p.iioouya( frame )
    local string_input = frame.args[1]
    local num_input = frame.args[2]
    return p._iioouya(string_input, num_input)

end

function p._osiiarn( 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
    for i=1, string.len(humanwords) do
        local replacement = CharData["OsiiarnChar"][humanwords:sub(i,i)]
        if replacement ~= nil then
            table.insert(output_string,'[[File:'..replacement..'|x'..size..'px|link=]]')
        else
            table.insert(output_string,'  ')
        end
    end
    span    :css( 'font-size', size..'px' )
            :wikitext( table.concat(output_string) )
    return tostring(span)
end

function p.osiiarn( frame )
    local string_input = frame.args[1]
    local num_input = frame.args[2]
    return p._osiiarn(string_input, num_input)
    
end

function p._kaiarial( humanwords, size )
    local output_string = {}
    local humanwords = string.lower(humanwords)
    local span = mw.html.create( 'span' )
    if (size == nil or size == '') then size='10' end
    for i=1, string.len(humanwords) do
        local replacement = CharData["KaiArialChar"][humanwords:sub(i,i)]
        if replacement ~= nil then
            table.insert(output_string,'[[File:'..replacement..'|x'..size..'px|link=]]')
        else
            table.insert(output_string,'  ')
        end
    end
    span    :css( 'font-size', size..'px' )
            :wikitext( table.concat(output_string) )
    return tostring(span)
end

function p.kaiarial( frame )
    local string_input = frame.args[1]
    local num_input = frame.args[2]
    return p._kaiarial(string_input, num_input)

end

function p._assai( humanwords, size )
    local output_string = {}
    local humanwords = string.lower(humanwords)
    local span = mw.html.create( 'span' )
    if (size == nil or size == '') then size='10' end
    for i=1, string.len(humanwords) do
        local replacement = CharData["AssaiChar"][humanwords:sub(i,i)]
        if replacement ~= nil then
            table.insert(output_string,'[[File:'..replacement..'|x'..size..'px|link=]]')
        else
            table.insert(output_string,'  ')
        end
    end
    span    :css( 'font-size', size..'px' )
            :wikitext( table.concat(output_string) )
    return tostring(span)
end

function p.assai( frame )
    local string_input = frame.args[1]
    local num_input = frame.args[2]
    return p._assai(string_input, num_input)

end

function p._ohaxan( 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
    for i=1, string.len(humanwords) do
        local replacement = CharData["OhaxanChar"][humanwords:sub(i,i)]
        if replacement ~= nil then
            table.insert(output_string,'[[File:'..replacement..'|x'..size..'px|link=]]')
        else
            table.insert(output_string,'  ')
        end
    end
    span    :css( 'font-size', size..'px' )
            :wikitext( table.concat(output_string) )
    return tostring(span)
end

function p.ohaxan( frame )
    local string_input = frame.args[1]
    local num_input = frame.args[2]
    return p._ohaxan(string_input, num_input)
    
end

function p._surresi( humanwords, size )
    local output_string = {}
    local humanwords = string.lower(humanwords)
    local span = mw.html.create( 'span' )
    if (size == nil or size == '') then size='12' end
    for i=1, string.len(humanwords) do
        local replacement = CharData["SurresiChar"][humanwords:sub(i,i)]
        if replacement ~= nil then
            table.insert(output_string,'[[File:'..replacement..'|x'..size..'px|link=]]')
        else
            table.insert(output_string,'  ')
        end
    end
    span    :css( 'font-size', size..'px' )
            :wikitext( table.concat(output_string) )
    return tostring(span)
end

function p.surresi( frame )
    local string_input = frame.args[1]
    local num_input = frame.args[2]
    return p._surresi(string_input, num_input)
    
end

return p