Module:Webarchive: திருத்தங்களுக்கு இடையிலான வேறுபாடு

உள்ளடக்கம் நீக்கப்பட்டது உள்ளடக்கம் சேர்க்கப்பட்டது
temp fix for unnamed parameters;
imported>Legoktm
சி Replacing Module:No globals with require('strict') (more info) #noglobals
 
(5 பயனர்களால் செய்யப்பட்ட 11 இடைப்பட்ட திருத்தங்கள் காட்டப்படவில்லை.)
வரிசை 11:
]]
 
require('Module:No globalsstrict');
local getArgs = require ('Module:Arguments').getArgs;
 
வரிசை 234:
t.m = month_num[t.m]; -- replace valid month name with a number
else
return nil, 'iso'; -- not a valid date form because month not valid
end
 
வரிசை 595:
local out = {};
local period1 = ''; -- For backwards compat with {{wayback}}
local period2 = '.';
 
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
if 'wayback' == ulx.url1.service then
period1 = '.';
period2 = '';
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
table.insert (out, period1); -- terminate
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, period2'.'); -- terminate first url
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
local convert_digits = 0 ~= tableLength (digits); -- will we be converting this wiki's digits to western digits? digits table will be filled if we are
for k, v in pairs (args) do -- loop through all of the arguments in the args table
name = k; -- copy of original parameter name
if convert_digits then
name = mw.ustring.gsub (name, '%d', digits); -- convert this wiki's non-western digits to western digits
end
enum = 'string' == type (name) and name:match ('%d+$'); -- TODO: temp fix for unnamed parameters; for named parameters, get parameter enumerator if it exists; nil else
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
foundif =non_western_digits false; then -- resettrue when non-western digits supported at thethis flagwiki
name = mw.ustring.gsub (name, '%d', digits); -- convert this wiki's non-western digits to western digits
break; -- go do next args k/v pair
end
end
else -- enumerated parameters
nameenum = name:gsubmatch ('%d+$', '#'); -- replaceget enumerationparameter digitsenumerator withif placeit holder forexists; tablenil searchelse
-- TODO: insert shortcut here? if num_params[name] then name holds the canonical parameter name; no need to search further
if not enum then -- no enumerator so looking for non-enumnerated parameters
for pname, aliases in pairs (enum_params) do -- loop through each parameter the num_params table
for-- _,TODO: aliasinsert inshortcut ipairshere? (aliases)if do --params[name] loopthen throughname each alias inholds the canonical parameter's aliasesname; no need to search tablefurther
for pname, aliases in pairs (params) do -- loop through each parameter the params table
if name == alias then
pnamefor =_, pname:gsubalias in ipairs ('#$',aliases) enum);do -- replaceloop thethrough '#'each placealias holder within the actualparameter's aliases enumeratortable
if name == alias then
new_args[pname] = v; -- create a new entry in the new_args table
origin new_args[pname] = kv; -- create ana new entry to make canonical parameter name to original localin languagethe parameternew_args nametable
found origin [pname] = truek; -- flagcreate an entry soto thatmake wecanonical canparameter breakname outto oforiginal theselocal nestedlanguage forparameter loopsname
break found = true; -- noflag needso tothat searchwe thecan restbreak out of thethese aliases tablenested for name so go on to the next k, v pairloops
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
break; -- go do next args k/v pair
end
end
else else -- enumerated parameters
 
ifname found= then name:gsub ('%d$', '#'); -- truereplace whenenumeration wedigits foundwith anplace aliasholder thatfor matchedtable namesearch
-- TODO: insert shortcut here? if paramsnum_params[name] then name holds the canonical parameter name; no need to search further
found = false; -- reset the flag
for pname, aliases in pairs (enum_params) do -- loop through each parameter the num_params table
break; -- go do next args k/v pair
for _, alias in ipairs (aliases) do -- loop through each alias in the parameter's aliases table
if name == alias then
pname = pname:gsub ('#$', enum); -- replace the '#' place holder with the actual enumerator
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 found then -- true when we found an alias that matched name
found = false; -- reset the flag
break; -- go do next args k/v pair
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 -- abandon when ulx.url1.url is malformed
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
 
"https://tamilar.wiki/w/Module:Webarchive" இலிருந்து மீள்விக்கப்பட்டது