"ମଡ୍ୟୁଲ:Message box" ପୃଷ୍ଠାର ସଂସ୍କରଣ‌ଗୁଡ଼ିକ ମଧ୍ୟରେ ତଫାତ

Content deleted Content added
change the smalltext logic to work with collapsible text fields
remove the presentButBlank function, fix bug with blank date values, and trim whitespace from all arguments
୧୩ କ ଧାଡ଼ି:
local tinsert = table.insert
local tconcat = table.concat
local trim = mw.text.trim
 
local box = {}
Line ୨୪ ⟶ ୨୫:
return title
end
end
end
 
local function presentButBlank(s)
if type(s) ~= 'string' then return end
if s and not mw.ustring.find(s, '%S') then
return true
else
return false
end
end
Line ୨୧୯ ⟶ ୨୧୧:
self.issue = args.smalltext
else
local sect = args.sect
if presentButBlank(args.sect) == '' then
sect = 'This ' .. (cfg.sectionDefault or 'page')
elseif type(args.sect) == 'string' then
sect = 'This ' .. sect
else
sect = nil
end
local issue = args.issue
Line ୨୪୦ ⟶ ୨୩୦:
-- Get the self.talk value.
local talk = args.talk
if presentButBlank(talk) == '' and self.isTemplatePage then
talk = '#'
end
Line ୨୬୭ ⟶ ୨୫୭:
-- Get other values.
self.fix = args.fix
localif args.date =and args.date ~= '' then
self.date = date and format(" <small>''(%s)''</small>", args.date)
ifelseif presentButBlank(selfargs.date) == '' and self.isTemplatePage then
self.date = lang:formatDate('F Y')
end
Line ୫୩୬ ⟶ ୫୨୬:
-- assume args are being passed directly in from the debug console
-- or from another Lua module.
local argsorigArgs
if frame == mw.getCurrentFrame() then
argsorigArgs = frame:getParent().args
for k, v in pairs(frame.args) do
argsorigArgs = frame.args
break
end
else
argsorigArgs = frame
end
-- Trim whitespace.
local args = {}
for k, v in pairs(origArgs) do
if type(sv) ~== 'string' then return end
sectv = niltrim(v)
return true end
elseargs[k] = v
end
return makeBox(boxType, args)