Content deleted Content added
use require('strict') instead of require('Module:No globals') |
simplifications and early returns, should be a no-op |
||
Line 39:
if arg == "" or arg == nil then
return nil
return mw.text.trim(arg)▼
end
end
local function trimArg2(arg)
if arg == nil then
return nil
return mw.text.trim(arg)▼
end
end
Line 76 ⟶ 74:
if display and ('' ~= display) then
return table.concat ({'[[', link, '|', display, ']]'});
return table.concat ({'[[', link, ']]'});▼
end
end
else -- no_link
if display and ('' ~= display) then -- if there is display text
return display; -- return that
return link or ''; -- return the target article name or empty string▼
end
end
end
Line 176 ⟶ 172:
if format ~= "infobox" then
return mw.getContentLanguage():formatDate (formatFull[df], date)
return mw.getContentLanguage():formatDate (formatInfobox[df], date)▼
end
end
Line 291 ⟶ 286:
if startdate == enddate or cfg.days == "1" then -- single date
return prepend1 .. startdate .. endoutoffset .. cite
return prepend1 .. startdate .. format .. prepend2 .. enddate .. endoutoffset .. cite▼
end
end
Line 334 ⟶ 328:
--- Determine format type
format = trimArg(args.format)
if not format or format ~= "infobox" then
format = "none"
end
Line 399 ⟶ 391:
elseif cfg.source then
cite = frame:preprocess('<ref name="' .. holiday .. ' dates">' .. cfg.source:gsub("YYYY", date) .. '</ref>')
end
else
|