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

پرش به ناوبری پرش به جستجو
۱٬۱۶۱ بایت اضافه‌شده ،  ‏۲۵ فوریهٔ ۲۰۲۳
جز
۱ نسخه واردشده
جز (۱ نسخه واردشده)
جز (۱ نسخه واردشده)
 
(۴ نسخهٔ میانی ویرایش شده توسط ۴ کاربر نشان داده نشد)
خط ۴: خط ۴:
local root
local root
local empty_row_categories = {}
local empty_row_categories = {}
local category_in_empty_row_pattern = '%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*]]'
local category_in_empty_row_pattern = '%[%[%s*[ر][د][ه]%s*:[^]]*]]'
local has_rows = false
local has_rows = false
local lists = {
plainlist_t = {
patterns = {
'^plainlist$',
'%splainlist$',
'^plainlist%s',
'%splainlist%s'
},
found = false,
styles = 'Plainlist/styles.css'
},
hlist_t = {
patterns = {
'^hlist$',
'%shlist$',
'^hlist%s',
'%shlist%s'
},
found = false,
styles = 'Hlist/styles.css'
}
}
local function has_list_class(args_to_check)
for _, list in pairs(lists) do
if not list.found then
for _, arg in pairs(args_to_check) do
for _, pattern in ipairs(list.patterns) do
if mw.ustring.find(arg or '', pattern) then
list.found = true
break
end
end
if list.found then break end
end
end
end
end


local function fixChildBoxes(sval, tt)
local function fixChildBoxes(sval, tt)
خط ۱۷: خط ۵۵:
while slast ~= s do
while slast ~= s do
slast = s
slast = s
s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*%]%])', '%2%1')
s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(%[%[%s*[ر][د][ه]%s*:[^]]*%]%])', '%2%1')
s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(\127[^\127]*UNIQ%-%-templatestyles%-%x+%-QINU[^\127]*\127)', '%2%1')
s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(\127[^\127]*UNIQ%-%-templatestyles%-%x+%-QINU[^\127]*\127)', '%2%1')
end
end
خط ۲۳: خط ۶۱:
s = mw.ustring.gsub(s, '(<%s*[Tt][Rr])', marker .. '%1')
s = mw.ustring.gsub(s, '(<%s*[Tt][Rr])', marker .. '%1')
s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>)', '%1' .. marker)
s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>)', '%1' .. marker)
if s:match(marker) then
if mw.ustring.match(s, marker) then
s = mw.ustring.gsub(s, marker .. '%s*' .. marker, '')
s = mw.ustring.gsub(s, marker .. '%s*' .. marker, '')
s = mw.ustring.gsub(s, '([\r\n]|-[^\r\n]*[\r\n])%s*' .. marker, '%1')
s = mw.ustring.gsub(s, '([\r\n]|-[^\r\n]*[\r\n])%s*' .. marker, '%1')
خط ۹۹: خط ۱۳۷:
local nums = {}
local nums = {}
for k, v in pairs(args) do
for k, v in pairs(args) do
local num = tostring(k):match('^' .. prefix .. '([1-9]%d*)$')
local num = mw.ustring.match(tostring(k), '^' .. prefix .. '([1-9]%d*)$')
if num then table.insert(nums, tonumber(num)) end
if num then table.insert(nums, tonumber(num)) end
end
end
خط ۱۲۷: خط ۱۶۵:
if rowArgs.data then
if rowArgs.data then
root:wikitext(
root:wikitext(
'[[Category:Pages using infobox templates with ignored data cells]]'
'[[رده:صفحه‌هایی که از الگوهای جعبه اطلاعات با سلول‌های داده نادیده گرفته‌شده استفاده می‌کنند]]'
)
)
end
end
خط ۲۵۲: خط ۲۹۰:


has_rows = true
has_rows = true
has_list_class({ imageArgs.rowclass, imageArgs.class })
local row = root:tag('tr')
local row = root:tag('tr')
row:addClass(imageArgs.rowclass)
row:addClass(imageArgs.rowclass)
خط ۳۸۳: خط ۴۲۳:
if args.title then
if args.title then
root:wikitext(
root:wikitext(
'[[Category:Pages using embedded infobox templates with the title parameter]]'
'[[رده:صفحه‌هایی که از الگوهای جعبه اطلاعات جاسازی‌شده با پارامتر عنوان استفاده می‌کنند]]'
)
)
end
end
elseif #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then
elseif #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then
root:wikitext('[[Category:Articles using infobox templates with no data rows]]')
root:wikitext('[[رده:مقاله‌هایی که از الگوهای جعبه اطلاعات بدون ردیف‌های داده استفاده می‌کنند]]')
end
end
end
end
خط ۴۹۱: خط ۵۳۱:
local function preprocessArgs(prefixTable, step)
local function preprocessArgs(prefixTable, step)
if type(prefixTable) ~= 'table' then
if type(prefixTable) ~= 'table' then
error("Non-table value detected for the prefix table", 2)
error("مقدار غیر جدولی برای جدول پیشوند شناسایی شد", 2)
end
end
if type(step) ~= 'number' then
if type(step) ~= 'number' then
error("Invalid step value detected", 2)
error("مقدار نامعتبر برای مرحله شناسایی شد", 2)
end
end


خط ۵۰۱: خط ۵۴۱:
if type(v) ~= 'table' or type(v.prefix) ~= "string" or
if type(v) ~= 'table' or type(v.prefix) ~= "string" or
(v.depend and type(v.depend) ~= 'table') then
(v.depend and type(v.depend) ~= 'table') then
error('Invalid input detected to preprocessArgs prefix table', 2)
error('ورودی نامعتبر برای جدول پیشوند preprocessArgs شناسایی شد', 2)
end
end
preprocessSingleArg(v.prefix)
preprocessSingleArg(v.prefix)
خط ۵۰۹: خط ۵۴۹:
for j, dependValue in ipairs(v.depend) do
for j, dependValue in ipairs(v.depend) do
if type(dependValue) ~= 'string' then
if type(dependValue) ~= 'string' then
error('Invalid "depend" parameter value detected in preprocessArgs')
error('مقدار نامعتبر برای پارامتر «depend» در تابع preprocessArgs شناسایی شد')
end
end
preprocessSingleArg(dependValue)
preprocessSingleArg(dependValue)

منوی ناوبری