コンテンツにスキップ

英文维基 | 中文维基 | 日文维基 | 草榴社区

モジュール:サンドボックス/Semi-Brace/HTML4

モジュールの解説[作成]
local p = {}

function p.main(frame)
	local args = frame.args
	local size = {
		["1"] = "xx-small",
		["2"] = "small",
		["3"] = "medium",
		["4"] = "large",
		["5"] = "x-large",
		["6"] = "xx-large",
		["7"] = "3em",
		["-2"] = "xx-small",
		["-1"] = "small",
		["0"] = "medium",
		["+1"] = "large",
		["+2"] = "x-large",
		["+3"] = "xx-large"
	}
	
	local font_size = size[args["size"]]
	local color = args["color"]
	local style = ""
	if color and color ~= "" then
		style = style .. "color: " .. color .. ";"
	end
	
	if font_size then
		style = style .. "font-size: " .. font_size .. ";"
	end
	
	local face = args["face"]
	if face then
		style = style .. "font-family: " .. face .. ";"	
	end
    
    local class = args["class"]
    local output = ""
    output = output .. "<span "
    if class ~= "" and class then
    	output = output .. "class=\"" .. class .. "\""
    end
    output = output .. "style=\"" .. style .. "\">"
    return output
end

return p