"ಮಾಡ್ಯೂಲ್:Footnotes" ಆವೃತ್ತಿಗಳ ಮಧ್ಯದ ಬದಲಾವಣೆಗಳು

ಚು
copy from en.wiki; +i18n support;
ಚು (೪ revisions imported from en:Module:Footnotes)
ಚು (copy from en.wiki; +i18n support;)
 
}
};
 
-- this table holds local language digits. core() will use local language year when rendering but will use Western digits [0-9] in the
-- CITEREF link so that short refs using this Module properly link to anchors produced by cs1|2 templates and Module:Citation/CS1
local local_digits = {['೦'] = '0', ['೧'] = '1', ['೨'] = '2', ['೩'] = '3', ['೪'] = '4', ['೫'] = '5', ['೬'] = '6', ['೭'] = '7', ['೮'] = '8', ['೯'] = '9'};
 
 
function trim( str )
return str:match( "^%s*(.-)%s*$");
end
 
 
local function is_year (param)
return mw.ustring.match (param, '^%d%d%d%d?%l?$') or param:match ('^n%.d%.%l?$') or param:match ('^nd%l?$') or param:match ('^c%. %d%d%d%d?%l?$') or param:match ('^%d%d%d%d–%d%d%d%d%l?$');
end
 
 
function core( args )
local result;
 
--TODO: evaluate to make sure that the following if correctly handles the parameter set when there is no year
if args.P5 ~= "" then
if is_year (args.P5) then
result = args.P1 .. ' et al. ' .. args.bracket_year_left .. args.P5 ..
result = table.concat ({args.P1, ' et al. ', args.bracket_year_left, args.P5, args.bracket_year_right});
args.P5 = mw.ustring.gsub (args.P5, '%d', local_digits); -- convert local language digits to [0-9] for CITEREF link
else
args.P5 = ''; -- when P5 not a year don't include in anchor
result = table.concat ({args.P1, ' et al.'}); -- and don't render it
end
 
elseif args.P4 ~= "" then
if is_year (args.P4) then
result = args.P1 .. ', ' .. args.P2 .. ' & ' .. args.P3 .. ' ' ..
result = table.concat ({args.bracket_year_leftP1, ', ', args.P2, ' & ', args.P3, ' ', args.P4bracket_year_left, args..P4, args.bracket_year_right}); -- three names and a year
args.P4 = mw.ustring.gsub (args.P4, '%d', local_digits); -- convert local language digits to [0-9] for CITEREF link
else
result = table.concat ({args.P1, ' et al.'}); -- four names
end
 
elseif args.P3 ~= "" then
if is_year (args.P3) then
result = args.P1 .. ' & ' .. args.P2 .. ' ' .. args.bracket_year_left ..
result = table.concat ({args.P3P1, ' & ', args.P2, ' ', args.bracket_year_left, args.P3, args.bracket_year_right}); -- two names and a year
args.P3 = mw.ustring.gsub (args.P3, '%d', local_digits); -- convert local language digits to [0-9] for CITEREF link
else
result = table.concat ({args.P1 .., ', ' .., args.P2, ..' ', ' & ' .., args.P3}); -- .. ' ' ..three names
end
elseif args.P2 ~= "" then
if is_year (args.P2) then
if not args.P2:match ('%d%d%d%d') and not args.P2:match ('n%.d%.') and not args.P2:match ('nd') and not args.P2:match ('c%. %d%d%d%d?%c?') then
result = table.concat ({args.P1 .., ' & ', args.bracket_year_left, args.P2, args.P2bracket_year_right}); -- for the case where the last numbered parameter is aone name and not a year and not no-date
args.P2 = mw.ustring.gsub (args.P2, '%d', local_digits); -- convert local language digits to [0-9] for CITEREF link
else
result = table.concat ({args.P1 .., ' & ' .. args.bracket_year_left .., args.P2}); -- ..two args.bracket_year_right;names
end
else
result = trim( args.P1; -- .. ' ' .. args.bracket_year_left .. args.P2 ..one name
args.bracket_year_right )
end
 
೩೫

edits

"https://kn.wikipedia.org/wiki/ವಿಶೇಷ:MobileDiff/808353" ಇಂದ ಪಡೆಯಲ್ಪಟ್ಟಿದೆ