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

۱٬۴۷۸ بایت اضافه‌شده ،  ‏۱ سپتامبر ۲۰۲۱
جز
یک به‌روزرسانی دیگر از ویکی انگلیسی برای تابع renderBox که پیوند به صفحهٔ تمرین پودمان‌ها را هم در صورت وجود درج می‌کند
جز (۱ نسخه واردشده)
جز (یک به‌روزرسانی دیگر از ویکی انگلیسی برای تابع renderBox که پیوند به صفحهٔ تمرین پودمان‌ها را هم در صورت وجود درج می‌کند)
خط ۳۵: خط ۳۵:
for i, module in ipairs(modules) do
for i, module in ipairs(modules) do
moduleLinks[i] = string.format('[[:%s]]', module)
moduleLinks[i] = string.format('[[:%s]]', module)
local maybeSandbox = mw.title.new(module .. '/تمرین')
if maybeSandbox.exists then
moduleLinks[i] = moduleLinks[i] .. string.format(' ([[:%s|تمرین]])', maybeSandbox.fullText)
end
end
end
local moduleList = mList.makeList('bulleted', moduleLinks)
local moduleList = mList.makeList('bulleted', moduleLinks)
خط ۵۷: خط ۶۱:
return ''
return ''
end
end
 
local cats = {}
local cats = {}
 
-- Error category
-- Error category
if #modules < 1 then
if #modules < 1 then
cats[#cats + 1] = 'الگو:لوآ همراه خطا'
cats[#cats + 1] = 'الگو:لوآ همراه خطا'
end
end
 
-- Lua templates category
-- Lua templates category
titleObj = titleObj or mw.title.getCurrentTitle()
titleObj = titleObj or mw.title.getCurrentTitle()
خط ۷۳: خط ۷۷:
testcases = true
testcases = true
}
}
if titleObj.namespace == 10
local subPageName = subpageBlacklist[titleObj.subpageText]
and not subpageBlacklist[titleObj.subpageText]
if not subPageName or (titleObj.subpageText ~= 'توضیحات') or (titleObj.subpageText ~= 'تمرین') or (titleObj.subpageText ~= 'آزمایشی') then
then
local protCatName
local category = args.category
if titleObj.namespace == 10 then
if not category then
local category = args.category
local categories = {
if not category then
['Module:String'] = 'الگو:مبتنی بر لوآ رشته',
local categories = {
['Module:Math'] = 'الگو:مبتنی بر لوآ ریاضی',
['Module:String'] = 'الگو:مبتنی بر لوآ رشته',
['Module:BaseConvert'] = 'الگو:مبتنی بر لوآ تبدیل مبنا',
['Module:Math'] = 'الگو:مبتنی بر لوآ ریاضی',
['Module:Citation'] = 'الگو:ارجاع‌دهی مبتنی بر لوآ'
['Module:BaseConvert'] = 'الگو:مبتنی بر لوآ تبدیل مبنا',
['Module:Citation'] = 'الگو:ارجاع‌دهی مبتنی بر لوآ'
}
categories['Module:Citation/CS1'] = categories['Module:Citation']
category = modules[1] and categories[modules[1]]
category = category or 'الگو:مبتنی بر لوآ'
end
cats[#cats + 1] = category
protCatName = "الگو:مبتنی بر لوآ با سطح محافظت پایین‌تر"
elseif titleObj.namespace == 828 then
protCatName = "پودمان‌های وابسته به پودمان‌های دیگر با سطح محافظت پایین‌تر"
end
if not args.noprotcat and protCatName then
local protLevels = {
autoconfirmed = 1,
extendedconfirmed = 2,
templateeditor = 3,
sysop = 4
}
}
categories['Module:Citation/CS1'] = categories['Module:Citation']
local currentProt
category = modules[1] and categories[modules[1]]
if titleObj.id ~= 0 then
category = category or 'الگو:مبتنی بر لوآ'
-- id is 0 (page does not exist) if am previewing before creating a template.
currentProt = titleObj.protectionLevels["edit"][1]
end
if currentProt == nil then currentProt = 0 else currentProt = protLevels[currentProt] end
for i, module in ipairs(modules) do
if module ~= "WP:libraryUtil" then
local moduleProt = mw.title.new(module).protectionLevels["edit"][1]
if moduleProt == nil then moduleProt = 0 else moduleProt = protLevels[moduleProt] end
if moduleProt < currentProt then
cats[#cats + 1] = protCatName
break
end
end
end
end
end
cats[#cats + 1] = category
end
end
for i, cat in ipairs(cats) do
for i, cat in ipairs(cats) do
cats[i] = string.format('[[رده:%s]]', cat)
cats[i] = string.format('[[رده:%s]]', cat)
کاربر ناشناس