مستخدم مجهول
الفرق بين المراجعتين لصفحة: «وحدة:Message box»
لا يوجد ملخص تحرير
(Replace Module:No globals with require( "strict" )) |
لا ملخص تعديل |
||
| سطر ١: | سطر ١: | ||
require(' | require('Module:No globals') | ||
local getArgs | local getArgs | ||
local yesno = require('Module:Yesno') | local yesno = require('Module:Yesno') | ||
| سطر ٧٤: | سطر ٧٤: | ||
-- use template from DEMOSPACES | -- use template from DEMOSPACES | ||
obj.cfg = cfg[DEMOSPACES[demospace]] | obj.cfg = cfg[DEMOSPACES[demospace]] | ||
elseif string.find( demospace, ' | elseif string.find( demospace, 'نقاش' ) then | ||
-- demo as a talk page | -- demo as a talk page | ||
obj.cfg = cfg.tmbox | obj.cfg = cfg.tmbox | ||
| سطر ١٢٦: | سطر ١٢٦: | ||
end | end | ||
if sort then | if sort then | ||
cat = string.format('[[ | cat = string.format('[[تصنيف:%s|%s]]', cat, sort) | ||
else | else | ||
cat = string.format('[[ | cat = string.format('[[تصنيف:%s]]', cat) | ||
end | end | ||
self.hasCategories = true | self.hasCategories = true | ||
| سطر ١٩٩: | سطر ١٩٩: | ||
local templateName = mw.ustring.match( | local templateName = mw.ustring.match( | ||
self.name, | self.name, | ||
'^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$' | '^([tT][eE][mM][pP][lL][aA][tT][eE]|قالب)[%s_]*:[%s_]*(.*)$' | ||
) or self.name | ) or self.name | ||
templateName = ' | templateName = 'قالب:' .. templateName | ||
self.templateTitle = getTitleObject(templateName) | self.templateTitle = getTitleObject(templateName) | ||
end | end | ||
| سطر ٢١٧: | سطر ٢١٧: | ||
local sect | local sect | ||
if args.sect == '' then | if args.sect == '' then | ||
sect = ' | sect = 'هذه ' .. (cfg.sectionDefault or 'page') | ||
elseif type(args.sect) == 'string' then | elseif type(args.sect) == 'string' then | ||
sect = ' | sect = 'هذه ' .. args.sect | ||
end | end | ||
local issue = args.issue | local issue = args.issue | ||
| سطر ٢٦٤: | سطر ٢٦٤: | ||
if self.isSmall then | if self.isSmall then | ||
local talkLink = talkArgIsTalkPage and talk or (talkTitle.prefixedText .. '#' .. talk) | local talkLink = talkArgIsTalkPage and talk or (talkTitle.prefixedText .. '#' .. talk) | ||
talkText = string.format('([[%s| | talkText = string.format('([[%s|نقاش]])', talkLink) | ||
else | else | ||
talkText = ' | talkText = 'قد يكون هنالك نقاشٌ ذو علاقةٍ في' | ||
if talkArgIsTalkPage then | if talkArgIsTalkPage then | ||
talkText = string.format( | talkText = string.format( | ||
'%s [[%s|%s]].', | '%s [[%s|%s]] %s.', | ||
talkText, | talkText, | ||
talk, | talk, | ||
talkTitle.prefixedText | talkTitle.prefixedText, | ||
'المتعلّقة' | |||
) | ) | ||
else | else | ||
talkText = string.format( | talkText = string.format( | ||
'%s | '%s [[%s#%s|صفحة النقاش]] %s.', | ||
talkText, | talkText, | ||
talkTitle.prefixedText, | talkTitle.prefixedText, | ||
talk | talk, | ||
'المتعلّقة' | |||
) | ) | ||
end | end | ||
| سطر ٣١٩: | سطر ٣٢١: | ||
self.imageEmptyCell = cfg.imageEmptyCell | self.imageEmptyCell = cfg.imageEmptyCell | ||
-- | -- Right image settings. | ||
local | local imageRight = self.isSmall and args.smallimage or args.image | ||
if cfg.imageCheckBlank and | if cfg.imageCheckBlank and imageRight ~= 'blank' and imageRight ~= 'none' and imageRight ~= 'بدون' | ||
or not cfg.imageCheckBlank and | or not cfg.imageCheckBlank and imageRight ~= 'none' and imageRight ~= 'بدون' | ||
then | then | ||
self. | self.imageRight = imageRight | ||
if not | if not imageRight then | ||
local imageSize = self.isSmall | local imageSize = self.isSmall | ||
and (cfg.imageSmallSize or '30x30px') | and (cfg.imageSmallSize or '30x30px') | ||
or '40x40px' | or '40x40px' | ||
self. | self.imageRight = string.format('[[File:%s|%s|link=|alt=]]', self.typeImage | ||
or 'Imbox notice.png', imageSize) | or 'Imbox notice.png', imageSize) | ||
end | end | ||
end | end | ||
-- | -- Left image settings. | ||
local | local imageLeft = self.isSmall and args.smallimageleft or args.imageleft | ||
if not (cfg. | if not (cfg.imageLeftNone and imageLeft == 'none' and imageLeft == 'بدون') then | ||
self. | self.imageLeft = imageLeft | ||
end | end | ||
| سطر ٣٦٢: | سطر ٣٦٤: | ||
local date = args.date | local date = args.date | ||
date = type(date) == 'string' and date | date = type(date) == 'string' and date | ||
local preposition = ' | local preposition = 'منذ' | ||
for _, num in ipairs(nums) do | for _, num in ipairs(nums) do | ||
local mainCat = args['cat' .. tostring(num)] | local mainCat = args['cat' .. tostring(num)] | ||
| سطر ٣٧٤: | سطر ٣٧٦: | ||
catTitle = getTitleObject('Category:' .. catTitle) | catTitle = getTitleObject('Category:' .. catTitle) | ||
if not catTitle or not catTitle.exists then | if not catTitle or not catTitle.exists then | ||
self:addCat(0, ' | self:addCat(0, 'مقالات تستعمل قوالب صيانة غير مؤرخة') | ||
end | end | ||
elseif mainCat and (not date or date == '') then | elseif mainCat and (not date or date == '') then | ||
| سطر ٤٧٣: | سطر ٤٧٥: | ||
:addClass('error') | :addClass('error') | ||
:wikitext(string.format( | :wikitext(string.format( | ||
' | 'قالب <code>%s[[قالب:%s|%s]]%s</code> تم نسخه بشكلٍ خاطئٍ.', | ||
mw.text.nowiki('{{'), self.name, self.name, mw.text.nowiki('}}') | mw.text.nowiki('{{'), self.name, self.name, mw.text.nowiki('}}') | ||
)) | )) | ||
| سطر ٥٠٧: | سطر ٥٠٩: | ||
end | end | ||
-- Add the | -- Add the right-hand image. | ||
local row = boxTable:tag('tr') | local row = boxTable:tag('tr') | ||
if self. | if self.imageRight then | ||
local | local imageRightCell = row:tag('td'):addClass('mbox-image') | ||
if self.imageCellDiv then | if self.imageCellDiv then | ||
-- If we are using a div, redefine | -- If we are using a div, redefine imageRightCell so that the image | ||
-- is inside it. Divs use style="width: | -- is inside it. Divs use style="width: 42px;", which limits the | ||
-- image width to 52px. If any images in a div are wider than that, | -- image width to 52px. If any images in a div are wider than that, | ||
-- they may overlap with the text or cause other display problems. | -- they may overlap with the text or cause other display problems. | ||
imageRightCell = imageRightCell:tag('div'):addClass('mbox-image-div') | |||
end | end | ||
imageRightCell:wikitext(self.imageRight or nil) | |||
elseif self.imageEmptyCell then | elseif self.imageEmptyCell then | ||
-- Some message boxes define an empty cell if no image is specified, and | -- Some message boxes define an empty cell if no image is specified, and | ||
| سطر ٥٥٥: | سطر ٥٥٧: | ||
:addClass('hide-when-compact') | :addClass('hide-when-compact') | ||
:tag('i') | :tag('i') | ||
:wikitext(string.format(" | :wikitext(string.format("%s", self.removalNotice)) | ||
end | end | ||
else | else | ||
| سطر ٥٦٤: | سطر ٥٦٦: | ||
end | end | ||
-- Add the | -- Add the left-hand image. | ||
if self. | if self.imageLeft then | ||
local | local imageLeftCell = row:tag('td'):addClass('mbox-imageleft') | ||
if self.imageCellDiv then | if self.imageCellDiv then | ||
-- If we are using a div, redefine | -- If we are using a div, redefine imageLeftCell so that the image | ||
-- is inside it. | -- is inside it. | ||
imageLeftCell = imageLeftCell:tag('div'):addClass('mbox-image-div') | |||
end | end | ||
imageLeftCell | |||
:wikitext(self. | :wikitext(self.imageLeft or nil) | ||
end | end | ||
| سطر ٥٨٠: | سطر ٥٨٢: | ||
boxTable:tag('tr') | boxTable:tag('tr') | ||
:tag('td') | :tag('td') | ||
:attr('colspan', self. | :attr('colspan', self.imageLeft and '3' or '2') | ||
:addClass('mbox-text') | :addClass('mbox-text') | ||
:cssText(self.textstyle or nil) | :cssText(self.textstyle or nil) | ||
| سطر ٥٩١: | سطر ٥٩٣: | ||
:addClass('mbox-invalid-type') | :addClass('mbox-invalid-type') | ||
:wikitext(string.format( | :wikitext(string.format( | ||
' | 'صندوق الرسالة هذا يستخدم وسيط "type=%s" غير صالح، وينبغي إصلاحه.', | ||
self.type or '' | self.type or '' | ||
)) | )) | ||