en:Module:InfoboxImage 2014年8月10日 (日) 07:38 より
template>What here area team 細 (カテゴリ名の日本語化) |
template>Fryed-peach (en:Module:InfoboxImage 2014年8月10日 (日) 07:38 より) |
||
10行目: | 10行目: | ||
-- upright - upright image param | -- upright - upright image param | ||
-- suppressplaceholder - if yes then checks to see if image is a placeholder and suppresses it | -- suppressplaceholder - if yes then checks to see if image is a placeholder and suppresses it | ||
-- link - page to visit when clicking on image | |||
-- Outputs: | -- Outputs: | ||
-- Formatted image. | -- Formatted image. | ||
42行目: | 43行目: | ||
"Silver - Replace this image female.svg", | "Silver - Replace this image female.svg", | ||
"Silver - Replace this image male.svg", | "Silver - Replace this image male.svg", | ||
"Replace this image.svg", | |||
"Cricket no pic.png", | |||
"CarersLogo.gif", | |||
"Diagram Needed.svg", | |||
"Example.jpg", | |||
"Image placeholder.png", | |||
"No male portrait.svg", | |||
"Nocover-upload.png", | |||
"NoDVDcover copy.png", | |||
"Noribbon.svg", | |||
"No portrait-BFD-test.svg", | |||
"Placeholder barnstar ribbon.png", | |||
"Project Trains no image.png", | |||
"Image-request.png", | |||
"Sin bandera.svg", | |||
"Sin escudo.svg", | |||
"Replace this image - temple.png", | |||
"Replace this image butterfly.png", | |||
"Replace this image.svg", | |||
"Replace this image1.svg", | |||
"Resolution angle.png", | |||
"Image-No portrait-text-BFD-test.svg", | |||
"Insert image here.svg", | |||
"No image available.png", | |||
"NO IMAGE YET square.png", | |||
"NO IMAGE YET.png", | |||
"No Photo Available.svg", | |||
"No Screenshot.svg", | |||
"No-image-available.jpg", | |||
"Null.png", | |||
"PictureNeeded.gif", | |||
"Place holder.jpg", | |||
"Unbenannt.JPG", | |||
"UploadACopyrightFreeImage.svg", | |||
"UploadAnImage.gif", | |||
"UploadAnImage.svg", | |||
"UploadAnImageShort.svg", | |||
"CarersLogo.gif", | |||
"Diagram Needed.svg", | |||
"No male portrait.svg", | |||
"NoDVDcover copy.png", | |||
"Placeholder barnstar ribbon.png", | |||
"Project Trains no image.png", | |||
"Image-request.png", | |||
} | } | ||
54行目: | 99行目: | ||
-- Trim spaces | -- Trim spaces | ||
image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1'); | image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1'); | ||
-- remove | -- remove prefix if exists | ||
local allNames = mw.site.namespaces[6].aliases | |||
allNames[#allNames + 1] = mw.site.namespaces[6].name | |||
allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName | |||
for i, name in ipairs(allNames) do | |||
if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then | |||
image = mw.ustring.sub(image, mw.ustring.len(name) + 2); | |||
break | |||
end | |||
end | end | ||
-- Trim spaces | -- Trim spaces | ||
83行目: | 131行目: | ||
return image; | return image; | ||
end | end | ||
if frame.args["suppressplaceholder"] | if frame.args["suppressplaceholder"] ~= "no" then | ||
if i.IsPlaceholder(image) == true then | if i.IsPlaceholder(image) == true then | ||
return ""; | return ""; | ||
128行目: | 176行目: | ||
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 title = frame.args["title"]; | local title = frame.args["title"]; | ||
local border = frame.args["border"]; | local border = frame.args["border"]; | ||
local upright = frame.args["upright"] or ""; | local upright = frame.args["upright"] or ""; | ||
local thumbtime = frame.args["thumbtime"] or ""; | |||
local center= frame.args["center"]; | local center= frame.args["center"]; | ||
-- remove | -- remove prefix if exists | ||
local allNames = mw.site.namespaces[6].aliases | |||
allNames[#allNames + 1] = mw.site.namespaces[6].name | |||
allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName | |||
for i, name in ipairs(allNames) do | |||
if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then | |||
image = mw.ustring.sub(image, mw.ustring.len(name) + 2); | |||
break | |||
end | |||
end | end | ||
149行目: | 202行目: | ||
if size ~= "" and size ~= nil then | if size ~= "" and size ~= nil then | ||
local sizenumber = tonumber(mw.ustring.match(size,"%d*")) or 0; | local sizenumber = tonumber(mw.ustring.match(size,"%d*")) or 0; | ||
local maxsizenumber = tonumber(mw.ustring.match(maxsize,"%d*")); | local maxsizenumber = tonumber(mw.ustring.match(maxsize,"%d*")) or 0; | ||
if sizenumber>maxsizenumber and maxsizenumber>0 then | if sizenumber>maxsizenumber and maxsizenumber>0 then | ||
size = maxsize; | size = maxsize; | ||
170行目: | 223行目: | ||
if center == "yes" then | if center == "yes" then | ||
result = result .. "|center" | result = result .. "|center" | ||
end | end | ||
if alt ~= "" and alt ~= nil then | if alt ~= "" and alt ~= nil then | ||
result = result .. "|alt=" .. alt; | result = result .. "|alt=" .. alt; | ||
end | |||
if link ~= "" and link ~= nil then | |||
result = result .. "|link=" .. link; | |||
end | end | ||
if border == "yes" then | if border == "yes" then | ||
179行目: | 235行目: | ||
if upright ~= "" then | if upright ~= "" then | ||
result = result .. "|upright=" .. upright; | result = result .. "|upright=" .. upright; | ||
end | |||
if thumbtime ~= "" then | |||
result = result .. "|thumbtime=" .. thumbtime; | |||
end | end | ||
if title ~= "" and title ~= nil then | if title ~= "" and title ~= nil then |