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

-- <nowiki>
-- DISCLAIMER: Don't use this as lua example, it is my first script so it probably is very bad.

local p = {}

local doublelut = {
	["aa"] = true,
	["ah"] = true,
	["ei"] = true,
	["ey"] = true,
	["ii"] = true,
	["ir"] = true,
	["oo"] = true,
	["uu"] = true,
	["ur"] = true,
}

local singlelut = {
    ["a"] = true,
    ["b"] = true,
    ["d"] = true,
    ["e"] = true,
    ["f"] = true,
    ["g"] = true,
    ["h"] = true,
    ["i"] = true,
    ["j"] = true,
    ["k"] = true,
    ["l"] = true,
    ["m"] = true,
    ["n"] = true,
    ["o"] = true,
    ["p"] = true,
    ["q"] = true,
    ["r"] = true,
    ["s"] = true,
    ["t"] = true,
    ["u"] = true,
    ["v"] = true,
    ["w"] = true,
    ["x"] = true,
    ["y"] = true,
    ["z"] = true,
}

function parse(s, size, result)
	if string.len(s) == 0 then
		return result
	end
	if string.sub(s, 1, 1) == "_" then
		result = result .. "[[File:Spacer.png|" .. size .."]]"
		return parse(string.sub(s, 2), size, result)
	end
	if  doublelut[string.sub(s, 1, 2)] then
		result = result .. "[[File:" .. string.sub(s, 1, 2) .. ".svg|" .. size .."|link=]]"
		return parse(string.sub(s, 3), size, result)
	end
	if  singlelut[string.sub(s, 1, 1)] then
		result = result .. "[[File:" .. string.sub(s, 1, 1) .. ".svg|" .. size .."|link=]]"
	return parse(string.sub(s, 2), size, result)
	end
	return parse(string.sub(s, 2), size, result)
end

function p.transcribe(frame)
	local result = ''
	if(frame.args[2]) then
		size = frame.args[2]
	else
		size = "16px"
	end
	return parse (frame.args[1]:lower(), size, result)
end

return p

--</nowiki>
*Disclosure: Some of the links above are affiliate links, meaning, at no additional cost to you, Fandom will earn a commission if you click through and make a purchase. Community content is available under CC-BY-SA unless otherwise noted.