۲۱٬۴۶۷
ویرایش
fa.wikipedia.org>Jeeputer ((درجا)) |
جز (۱ نسخه واردشده) |
||
خط ۱۲۸: | خط ۱۲۸: | ||
function i.InfoboxImage(frame) | function i.InfoboxImage(frame) | ||
local image = frame.args["image" | local image = frame.args["image"]; | ||
if image == "" or image == nil then | if image == "" or image == nil then | ||
خط ۱۶۴: | خط ۱۶۴: | ||
-- search for thumbnail images and add to tracking cat if found | -- search for thumbnail images and add to tracking cat if found | ||
local cat = ""; | local cat = ""; | ||
if mw.title.getCurrentTitle().namespace == 0 and (mw.ustring.find(image, "|%s*thumb%s*[|%]]") or mw.ustring.find(image, "|%s*thumbnail | if mw.title.getCurrentTitle().namespace == 0 and (mw.ustring.find(image, "|%s*thumb%s*[|%]]") or mw.ustring.find(image, "|%s*thumbnail%s*[|%]]")) then | ||
cat = "[[ | cat = "[[Category:Pages using infoboxes with thumbnail images]]"; | ||
end | end | ||
return image .. cat; | return image .. cat; | ||
خط ۱۸۰: | خط ۱۸۰: | ||
else | else | ||
local result = ""; | local result = ""; | ||
local page = frame.args["page" | local page = frame.args["page"]; | ||
local size = frame.args["size" | local size = frame.args["size"]; | ||
local maxsize = frame.args["maxsize" | local maxsize = frame.args["maxsize"]; | ||
local sizedefault = frame.args["sizedefault" | local sizedefault = frame.args["sizedefault"]; | ||
local alt = frame.args["alt" | local alt = frame.args["alt"]; | ||
local link = frame.args["link" | local link = frame.args["link"]; | ||
local title = frame.args["title" | local title = frame.args["title"]; | ||
local border = frame.args["border" | local border = frame.args["border"]; | ||
local upright = frame.args["upright" | local upright = frame.args["upright"] or ""; | ||
local thumbtime = frame.args["thumbtime"] or ""; | local thumbtime = frame.args["thumbtime"] or ""; | ||
local center= frame.args["center" | local center= frame.args["center"]; | ||
-- remove prefix if exists | -- remove prefix if exists | ||
خط ۲۲۶: | خط ۲۲۶: | ||
end | end | ||
result = "[[ | result = "[[File:" .. image; | ||
if page ~= "" and page ~= nil then | if page ~= "" and page ~= nil then | ||
result = result .. "| | result = result .. "|page=" .. page; | ||
end | end | ||
if size ~= "" and size ~= nil then | if size ~= "" and size ~= nil then | ||
خط ۲۳۵: | خط ۲۳۵: | ||
result = result .. "|" .. sizedefault; | result = result .. "|" .. sizedefault; | ||
else | else | ||
result = result .. "| | result = result .. "|frameless"; | ||
end | end | ||
if center == "yes" then | if center == "yes" then | ||
result = result .. "| | result = result .. "|center" | ||
end | end | ||
if alt ~= "" and alt ~= nil then | if alt ~= "" and alt ~= nil then | ||
result = result .. "| | result = result .. "|alt=" .. alt; | ||
end | end | ||
if link ~= "" and link ~= nil then | if link ~= "" and link ~= nil then | ||
result = result .. "| | result = result .. "|link=" .. link; | ||
end | end | ||
if border == "yes | if border == "yes" then | ||
result = result .. "| | result = result .. "|border"; | ||
end | end | ||
if upright == "yes | if upright == "yes" then | ||
result = result .. "| | result = result .. "|upright"; | ||
elseif upright ~= "" then | elseif upright ~= "" then | ||
result = result .. "| | result = result .. "|upright=" .. upright; | ||
end | end | ||
if thumbtime ~= "" then | if thumbtime ~= "" then | ||
خط ۲۵۸: | خط ۲۵۸: | ||
end | end | ||
-- if alt value is a keyword then do not use as a description | -- if alt value is a keyword then do not use as a description | ||
if alt == "thumbnail | if alt == "thumbnail" or alt == "thumb" or alt == "frameless" or alt == "left" or alt == "center" or alt == "right" or alt == "upright" or alt == "border" or mw.ustring.match(alt or "", '^[0-9]*px$', 1) ~= nil then | ||
alt = nil; | alt = nil; | ||
end | end | ||
خط ۲۷۳: | خط ۲۶۹: | ||
if title ~= "" and title ~= nil then | if title ~= "" and title ~= nil then | ||
result = result .. "|" .. title; | result = result .. "|" .. title; | ||
end | end | ||
result = result .. "]]"; | result = result .. "]]"; |