Content deleted Content added
m Trappist the monk moved page Module:Sandbox/trappist the monk/month translator to Module:Month translator without leaving a redirect |
Replace Module:No globals with require( "strict" ) |
||
(5 intermediate revisions by one other user not shown) | |||
Line 1:
require
local getArgs = require ('Module:Arguments').getArgs;
local data = mw.loadData ('Module:
--[[--------------------------< _ M O N T H _ X L A T E >
{{#invoke:
]]
local function
local t = {};
local day, month, year;
if 'dump' ==
return mw.dumpObject (data.
end
if not args_t[1] then return nil end
for i, pattern in ipairs (data.patterns) do
local c1, c2, c3; -- captures in the 'pattern' from the pattern table go here
c1, c2, c3 = mw.ustring.match (mw.text.trim (
if c1 then -- c1 always set on match
Line 31 ⟶ 32:
day = t.d or ''; -- translate table contents to named variables;
month = mw.ustring.lower (t.m or ''); -- absent table entries are nil so set unused parts to empty string; lowercase for indexing
month = data.override_names[month] or data.
year= t.y or '';
Line 47 ⟶ 48:
end
end
break; -- and done; if here found pattern match but did not find non-English month name in
end
end
return
end
--[[--------------------------< M O N T H _ X L A T E >--------------------------------------------------------
{{#invoke:Month translator|month_xlate|<date>}}
]]
local function month_xlate (frame)
return _month_xlate (getArgs (frame));
end
Line 57 ⟶ 69:
]]
return {
month_xlate = month_xlate _month_xlate = _month_xlate
};
|