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

۱٬۷۸۲ بایت اضافه‌شده ،  ‏۱۸ نوامبر ۲۰۲۲
جز
۱ نسخه واردشده
جز (۱ نسخه واردشده)
 
جز (۱ نسخه واردشده)
 
(۳۲ نسخهٔ میانی ویرایش شده توسط ۱۱ کاربر نشان داده نشد)
خط ۳۵: خط ۳۵:
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)
boxArgs.text = 'از [[ویکی‌پدیا:لوآ|لوآ]] استفاده می‌کند:\n' .. moduleList
local title = mw.title.getCurrentTitle()
if title.subpageText == "doc" or title.subpageText == "توضیحات" then
title = title.basePageTitle
end
if title.contentModel == "Scribunto" then
boxArgs.text = 'این پودمان از پودمان‌های زیر استفاده می‌کند:' .. moduleList
else
boxArgs.text = 'این الگو از [[امامت‌پدیا:لوآ|لوآ]] استفاده می‌کند:\n' .. moduleList
end
end
end
boxArgs.type = 'notice'
boxArgs.type = 'notice'
boxArgs.small = true
boxArgs.small = true
boxArgs.image = '[[پرونده:Lua-logo-nolabel.svg|30px|جایگزین=نماد لوآ|پیوند=ویکی‌پدیا:لوآ]]'
boxArgs.image = '[[پرونده:Lua-logo-nolabel.svg|30px|جایگزین=نماد لوآ|پیوند=امامت‌پدیا:لوآ]]'
return mMessageBox.main('mbox', boxArgs)
return mMessageBox.main('mbox', boxArgs)
end
end
خط ۴۹: خط ۶۱:
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()
خط ۶۳: خط ۷۵:
sandbox = true,
sandbox = true,
sandbox2 = true,
sandbox2 = true,
testcases = true
testcases = true,
['توضیحات'] = true,
['تمرین'] = true,
['آزمایشی'] = true,
}
}
if titleObj.namespace == 10
local subPageName = subpageBlacklist[titleObj.subpageText]
and not subpageBlacklist[titleObj.subpageText]
if not subPageName 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)