١٥٠
تعديل
(أنشأ الصفحة ب'-- Inputs: -- image - Can either be a bare filename (with or without the File:/Image: prefix) or a fully formatted image link -- page - page to display for multipa...') |
لا ملخص تعديل |
||
| سطر ١: | سطر ١: | ||
-- Inputs: | -- Inputs: | ||
-- image - Can either be a bare filename (with or without the File:/Image: prefix) or a fully formatted image link | -- 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 | -- size - size to display the image | ||
-- maxsize - maximum size for image | -- maxsize - maximum size for image | ||
| سطر ٩٣: | سطر ٩٢: | ||
-- change underscores to spaces | -- change underscores to spaces | ||
image = mw.ustring.gsub(image, "_", " "); | image = mw.ustring.gsub(image, "_", " "); | ||
-- if image starts with [[ then remove that and anything after | | -- if image starts with [[ then remove that and anything after | | ||
if mw.ustring.sub(image,1,2) == "[[" then | if mw.ustring.sub(image,1,2) == "[[" then | ||
image = mw.ustring.sub(image,3); | image = mw.ustring.sub(image,3); | ||
image = mw.ustring.gsub(image, "([^|]*)|.*", "%1"); | image = mw.ustring.gsub(image, "([^|]*)|.*", "%1"); | ||
end | end | ||
-- Trim spaces | -- Trim spaces | ||
image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1'); | image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1'); | ||
-- remove prefix if exists | -- remove prefix if exists | ||
local allNames = mw.site.namespaces[6].aliases | local allNames = mw.site.namespaces[6].aliases | ||
| سطر ١٢٨: | سطر ١٢٤: | ||
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 | ||
return ""; | return ""; | ||
| سطر ١٦٢: | سطر ١٥٨: | ||
if mw.ustring.sub(image,1,2) == "[[" then | if mw.ustring.sub(image,1,2) == "[[" then | ||
-- search for thumbnail images and add to tracking cat if found | -- 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*تصغير%s*[|%]]")) then | if mw.title.getCurrentTitle().namespace == 0 and (mw.ustring.find(image, "|%s*thumb%s*[|%]]") or mw.ustring.find(image, "|%s*thumbnail%s*[|%]]") or mw.ustring.find(image, "|%s*تصغير%s*[|%]]")) then | ||
return image .. " | return image .. ""; | ||
else | else | ||
return image; | return image; | ||
| سطر ١٧٦: | سطر ١٧٢: | ||
else | else | ||
local result = ""; | local result = ""; | ||
local size = frame.args["size"]; | local size = frame.args["size"]; | ||
local maxsize = frame.args["maxsize"]; | local maxsize = frame.args["maxsize"]; | ||
| سطر ١٨٧: | سطر ١٨٢: | ||
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 | ||
local allNames = mw.site.namespaces[6].aliases | local allNames = mw.site.namespaces[6].aliases | ||
| سطر ١٩٨: | سطر ١٩٣: | ||
end | end | ||
end | end | ||
if maxsize ~= "" and maxsize ~= nil then | if maxsize ~= "" and maxsize ~= nil then | ||
-- if no sizedefault then set to maxsize | -- if no sizedefault then set to maxsize | ||
| سطر ٢١٧: | سطر ٢١٢: | ||
size = size .. "px"; | size = size .. "px"; | ||
end | end | ||
result = "[[File:" .. image; | result = "[[File:" .. image; | ||
if size ~= "" and size ~= nil then | if size ~= "" and size ~= nil then | ||
result = result .. "|" .. size; | result = result .. "|" .. size; | ||
| سطر ٢٤١: | سطر ٢٣٣: | ||
result = result .. "|border"; | result = result .. "|border"; | ||
end | end | ||
if | if upright ~= "" then | ||
result = result .. "|upright=" .. upright; | result = result .. "|upright=" .. upright; | ||
end | end | ||
| سطر ٢٥٥: | سطر ٢٤٥: | ||
end | end | ||
result = result .. "]]"; | result = result .. "]]"; | ||
return result; | return result; | ||
end | end | ||