Module:Webarchive: திருத்தங்களுக்கு இடையிலான வேறுபாடு
உள்ளடக்கம் நீக்கப்பட்டது உள்ளடக்கம் சேர்க்கப்பட்டது
synch from sandbox; |
imported>Legoktm சி Replacing Module:No globals with require('strict') (more info) #noglobals |
||
| (5 பயனர்களால் செய்யப்பட்ட 12 இடைப்பட்ட திருத்தங்கள் காட்டப்படவில்லை.) | |||
வரிசை 11:
]]
require('
local getArgs = require ('Module:Arguments').getArgs;
வரிசை 234:
t.m = month_num[t.m]; -- replace valid month name with a number
else
return nil, 'iso';
end
வரிசை 595:
local out = {};
local index_date, msg = ulx.url1.date:match ('(index)(.*)'); -- when ulx.url1.date extract 'index' text and message text (if there is a message)
ulx.url1.date = ulx.url1.date:gsub ('index.*', 'index'); -- remove message
வரி 625 ⟶ 622:
end
if ulx.url1.date then
end▼
if 'index' ~= ulx.url1.date then
table.insert (out, ulx.url1.date); -- add date when data is not 'index'
வரி 634 ⟶ 627:
table.insert (out, comma(ulx.url1.date)); -- add ',' if date format is mdy
table.insert (out, ulx.url1.tail); -- add tail text
else -- no date
table.insert (out, ulx.url1.tail); -- add tail text
வரி 642 ⟶ 634:
if 0 < ulx.url1.extraurls then -- For multiple archive URLs
local tot = ulx.url1.extraurls + 1
table.insert (out,
table.insert (out, table.concat ({' ', s_text.addlarchives, ': '})); -- add header text
வரி 713 ⟶ 705:
local new_args = {}; -- a table that holds canonical and translated parameter k/v pairs
local origin = {}; -- a table that maps original (local language) parameter names to their canonical name for local language error messaging
local unnamed_params; -- set true when unsupported positional parameters are detected
for k, v in pairs (args) do -- loop through all of the arguments in the args table
name = k; -- copy of original parameter name
name = mw.ustring.gsub (name, '%d', digits); -- convert this wiki's non-western digits to western digits▼
end▼
if not enum then -- no enumerator so looking for non-enumnerated parameters▼
-- TODO: insert shortcut here? if params[name] then name holds the canonical parameter name; no need to search further▼
for pname, aliases in pairs (params) do -- loop through each parameter the params table▼
for _, alias in ipairs (aliases) do -- loop through each alias in the parameter's aliases table▼
if name == alias then▼
new_args[pname] = v; -- create a new entry in the new_args table▼
origin [pname] = k; -- create an entry to make canonical parameter name to original local language parameter name▼
found = true; -- flag so that we can break out of these nested for loops▼
break; -- no need to search the rest of the aliases table for name so go on to the next k, v pair▼
end▼
end▼
if 'string' == type (k) then
if found then -- true when we found an alias that matched name▼
▲ name = mw.ustring.gsub (name, '%d', digits);
break; -- go do next args k/v pair▼
end▼
end
else -- enumerated parameters▼
for pname, aliases in pairs (enum_params) do -- loop through each parameter the num_params table▼
if name == alias then▼
▲ if name == alias then
▲ end
▲ end
end
end
▲ -- TODO: insert shortcut here? if
▲ found = false; -- reset the flag
break; -- go do next args k/v pair▼
▲ if name == alias then
pname = pname:gsub ('#$', enum); -- replace the '#' place holder with the actual enumerator
▲ origin [pname] = k;
break; -- no need to search the rest of the aliases table for name so go on to the next k, v pair
▲ end
▲ end
if found then -- true when we found an alias that matched name
found = false; -- reset the flag
▲ end
end
end
else
unnamed_params = true; -- flag for unsupported positional parameters
end
end -- for k, v
return new_args, origin, unnamed_params;
end
வரி 795 ⟶ 791:
local origin = {}; -- holds a map of English to local language parameter names used in the current template; not currently used
local unnamed_params; -- boolean set to true when template call has unnamed parameters
args, origin, unnamed_params = parameter_name_xlate (args, data.params, data.enum_params); -- translate parameter names in args to English
local date, format, msg, udate, uri, url;
வரி 802 ⟶ 799:
if args.url and args.url1 then -- URL argument (first)
return inlineError (data.crit_err_msgs.conflicting, {origin.url, origin.url1});
end
வரி 834 ⟶ 830:
good, uri = pcall (mw.uri.new, ulx.url1.url); -- get a table of uri parts from this url; protected mode to prevent lua error when ulx.url1.url is malformed
if not good or nil == uri.host then
return inlineError (data.crit_err_msgs.invalid_url);
end
வரி 954 ⟶ 950:
ulx.url1.date = msg;
end
format = args.format; -- Format argument
வரி 998 ⟶ 994:
end
return rend .. ((unnamed_params and inlineRed (err_warn_msgs.unnamed_params, 'warning')) or '') .. createTracking();
end
| |||