پودمان:InfoboxImage: تفاوت میان نسخه‌ها

۱٬۱۳۶ بایت اضافه‌شده ،  ‏۱۰ نوامبر ۲۰۲۱
جز
۱ نسخه واردشده
imported>Huji
جز پودمان:InfoboxImage» را محافظت کرد: الگوهای حساس ([ویرایش=تنها کاربران تأییدشدهٔ پایدار و مدیران] (بی‌پایان) [انتقال=تنها کاربران تأییدشدهٔ پایدار و مدیران] (بی‌پایان)))
جز (۱ نسخه واردشده)
 
(۵ نسخهٔ میانی ویرایش شده توسط ۴ کاربر نشان داده نشد)
خط ۸۸: خط ۸۸:
"Project Trains no image.png",
"Project Trains no image.png",
"Image-request.png",
"Image-request.png",
"Noimage.gif",
}
}


خط ۱۲۷: خط ۱۲۸:


function i.InfoboxImage(frame)
function i.InfoboxImage(frame)
     local image = frame.args["image"];
     local image = frame.args["image"] or frame.args['تصویر'];
      
      
     if image == "" or image == nil then
     if image == "" or image == nil then
خط ۱۶۲: خط ۱۶۳:
     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
        local cat = "";
         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
         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 .. "[[رده:صفحاتی که از جعبه اطلاعات همراه تصاویر بندانگشتی استفاده می‌کنند]]";
             cat = "[[رده:صفحاتی که از جعبه اطلاعات همراه تصاویر بندانگشتی استفاده می‌کنند]]";
        elseif mw.title.getCurrentTitle().namespace == 0 then
            return image .. "[[رده:مقاله‌ها با نحو منسوخ‌شده تصویر]]";
        else
            return image;
         end
         end
        return image .. cat;
     elseif mw.ustring.sub(image,1,2) == "{{" and mw.ustring.sub(image,1,3) ~= "{{{" then
     elseif mw.ustring.sub(image,1,2) == "{{" and mw.ustring.sub(image,1,3) ~= "{{{" then
         return image;
         return image;
خط ۱۸۱: خط ۱۸۰:
     else
     else
         local result = "";
         local result = "";
         local page = frame.args["page"];
         local page = frame.args["page"] or frame.args['صفحه'];
         local size = frame.args["size"];
         local size = frame.args["size"] or frame.args['اندازه'];
         local maxsize = frame.args["maxsize"];
         local maxsize = frame.args["maxsize"] or frame.args['حداکثر اندازه'];
         local sizedefault = frame.args["sizedefault"];
         local sizedefault = frame.args["sizedefault"] or frame.args['اندازه پیش‌فرض'];
         local alt = frame.args["alt"];
         local alt = frame.args["alt"] or frame.args['جایگزین'];
         local link = frame.args["link"];
         local link = frame.args["link"] or frame.args['پیوند'];
         local title = frame.args["title"];
         local title = frame.args["title"] or frame.args['عنوان'];
         local border = frame.args["border"];
         local border = frame.args["border"] or frame.args['حاشیه'];
         local upright = frame.args["upright"] or "";
         local upright = frame.args["upright"] or frame.args['ایستاده'] or "";
         local thumbtime = frame.args["thumbtime"] or "";
         local thumbtime = frame.args["thumbtime"] or "";
         local center= frame.args["center"];
         local center= frame.args["center"] or frame.args['وسط'];
          
          
         -- remove prefix if exists
         -- remove prefix if exists
خط ۲۲۷: خط ۲۲۶:
         end
         end
          
          
         result = "[[File:" .. image;
         result = "[[پرونده:" .. image;
         if page ~= "" and page ~= nil then
         if page ~= "" and page ~= nil then
             result = result .. "|page=" .. page;
             result = result .. "|صفحه=" .. 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 .. "|frameless";
             result = result .. "|بی‌قاب";
         end
         end
         if center == "yes" then
         if center == "yes" then
             result = result .. "|center"
             result = result .. "|وسط"
         end
         end
         if alt ~= "" and alt ~= nil then
         if alt ~= "" and alt ~= nil then
             result = result .. "|alt=" .. alt;
             result = result .. "|جایگزین=" .. alt;
         end
         end
         if link ~= "" and link ~= nil then
         if link ~= "" and link ~= nil then
             result = result .. "|link=" .. link;
             result = result .. "|پیوند=" .. link;
         end
         end
         if border == "yes" then
         if border == "yes" or border == "بله" then
             result = result .. "|border";
             result = result .. "|حاشیه";
         end
         end
         if upright == "yes" then
         if upright == "yes" or upright == "بله" then
             result = result .. "|upright";
             result = result .. "|ایستاده";
         elseif upright ~= "" then
         elseif upright ~= "" then
             result = result .. "|upright=" .. upright;
             result = result .. "|ایستاده=" .. upright;
         end
         end
         if thumbtime ~= "" then
         if thumbtime ~= "" then
             result = result .. "|thumbtime=" .. thumbtime;
             result = result .. "|thumbtime=" .. thumbtime;
        end
        -- if alt value is a keyword then do not use as a description
        if alt == "thumbnail" or alt == "بندانگشتی" or alt == "thumb" or alt == "انگشتی" or
        alt == "frameless" or alt == "بی‌قاب" or alt == "left" or alt == "چپ" or
        alt == "center" or alt == "وسط" or alt == "right" or alt == "راست" or
        alt == "upright" or alt == "ایستاده" or alt == "border" or alt == "حاشیه" or
        mw.ustring.match(alt or "", '^[0-9۰-۹]*px$', 1) ~= nil then
            alt = nil;
        end
        if title ~= "" and title ~= nil then
            -- does title param contain any templatestyles? If yes then set to blank.
            if mw.ustring.match(frame:preprocess(title), 'UNIQ%-%-templatestyles', 1) ~= nil then
                title = nil;
            end
         end
         end
         if title ~= "" and title ~= nil then
         if title ~= "" and title ~= nil then
۴۱۵٬۰۷۸

ویرایش