Модуль:InfoboxImage: юрамалар арасында аерма
Контент бетерелгән Контент өстәлгән
Marat-avgust (бәхәс | кертем) Төзәтмә аңлатмасы юк |
кТөзәтмә аңлатмасы юк |
||
Юл номеры - 1:
-- Inputs:
-- image - Can either be a bare filename (with or without the File:/Image: prefix) or a fully formatted image link
-- size - size to display the image
-- maxsize - maximum size for image
Строка 11 ⟶ 10 :
-- upright - upright image param
-- suppressplaceholder - if yes then checks to see if image is a placeholder and suppresses it
-- Outputs:
-- Formatted image.
Строка 44 ⟶ 42 :
"Silver - Replace this image female.svg",
"Silver - Replace this image male.svg",
}
Строка 93 ⟶ 47 :
-- change underscores to spaces
image = mw.ustring.gsub(image, "_", " ");
-- if image starts with [[ then remove that and anything after |
if mw.ustring.sub(image,1,2) == "[[" then
image = mw.ustring.sub(image,3);
image = mw.ustring.gsub(image, "([^|]*)|.*", "%1");
end
-- Trim spaces
image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1');
-- remove file: or image: prefix if exists▼
▲ -- remove prefix if exists
▲ 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
-- Trim spaces
Строка 135 ⟶ 83 :
return image;
end
if frame.args["suppressplaceholder"]
if i.IsPlaceholder(image) == true then
return "";
Строка 163 ⟶ 111 :
-- search for thumbnail images and add to tracking cat if found
if mw.title.getCurrentTitle().namespace == 0 and (mw.ustring.find(image, "|%s*thumb%s*[|%]]") or mw.ustring.find(image, "|%s*thumbnail%s*[|%]]")) then
return image --.. "[[
else
return image;
Строка 172 ⟶ 120 :
return image;
elseif mw.ustring.sub(image,1,5) == mw.ustring.char(127).."UNIQ" then
▲ elseif mw.ustring.sub(image,4,9) == "`UNIQ-" then
-- Found strip marker at begining, so pass don't process at all
return image;
else
local result = "";
local size = frame.args["size"];
local maxsize = frame.args["maxsize"];
local sizedefault = frame.args["sizedefault"];
local alt = frame.args["alt"];
local title = frame.args["title"];
local border = frame.args["border"];
local upright = frame.args["upright"] or "";
local center= frame.args["center"];
-- remove file: or image: prefix if exists
if mw.ustring.lower(mw.ustring.sub(image,1,5)) == "file:" then
if mw.ustring.lower(mw.ustring.sub(image,1,6)) == "image:" then
end
Строка 210 ⟶ 149 :
if size ~= "" and size ~= nil then
local sizenumber = tonumber(mw.ustring.match(size,"%d*")) or 0;
local maxsizenumber = tonumber(mw.ustring.match(maxsize,"%d*"))
if sizenumber>maxsizenumber and maxsizenumber>0 then
size = maxsize;
Строка 222 ⟶ 161 :
result = "[[File:" .. image;
if size ~= "" and size ~= nil then
result = result .. "|" .. size;
Строка 234 ⟶ 170 :
if center == "yes" then
result = result .. "|center"
end
if alt ~= "" and alt ~= nil then
result = result .. "|alt=" .. alt;
end
if border == "yes" then
result = result .. "|border";
end
if upright
result = result .. "|upright=" .. upright;
end
if title ~= "" and title ~= nil then
|