Module:Calendar date: Difference between revisions

Content deleted Content added
use require('strict') instead of require('Module:No globals')
m Reverted edit by 213.147.181.177 (talk) to last version by 130.64.64.65
 
(2 intermediate revisions by 2 users not shown)
Line 39:
if arg == "" or arg == nil then
return nil
else
return mw.text.trim(arg)
end
return mw.text.trim(arg)
end
local function trimArg2(arg)
if arg == nil then
return nil
else
return mw.text.trim(arg)
end
return mw.text.trim(arg)
end
 
Line 76 ⟶ 74:
if display and ('' ~= display) then
return table.concat ({'[[', link, '|', display, ']]'});
else
return table.concat ({'[[', link, ']]'});
end
return table.concat ({'[[', link, ']]'});
end
else -- no_link
if display and ('' ~= display) then -- if there is display text
return display; -- return that
else
return link or ''; -- return the target article name or empty string
end
return link or ''; -- return the target article name or empty string
end
end
Line 176 ⟶ 172:
if format ~= "infobox" then
return mw.getContentLanguage():formatDate (formatFull[df], date)
else
return mw.getContentLanguage():formatDate (formatInfobox[df], date)
end
return mw.getContentLanguage():formatDate (formatInfobox[df], date)
end
 
Line 291 ⟶ 286:
if startdate == enddate or cfg.days == "1" then -- single date
return prepend1 .. startdate .. endoutoffset .. cite
else
return prepend1 .. startdate .. format .. prepend2 .. enddate .. endoutoffset .. cite
end
return prepend1 .. startdate .. format .. prepend2 .. enddate .. endoutoffset .. cite
end
 
Line 334 ⟶ 328:
--- Determine format type
format = trimArg(args.format)
if not format or format ~= "infobox" then
format = "none"
elseif 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>')
else
cite = ""
end
else