پودمان:Citation/CS1/en/Identifiers: تفاوت میان نسخه‌ها

جز
۱ نسخه واردشده
جز (۱ نسخه واردشده)
جز (۱ نسخه واردشده)
 
(۳ نسخهٔ میانی ویرایش شده توسط ۳ کاربر نشان داده نشد)
خط ۲۶: خط ۲۶:
local url_string = mw.ustring.gsub (options.id, '%d', cfg.date_names.local_digits); -- Falocalization translate 'local' digits to Western 0-9
local url_string = mw.ustring.gsub (options.id, '%d', cfg.date_names.local_digits); -- Falocalization translate 'local' digits to Western 0-9
local ext_link;
local ext_link;
local this_wiki_code; -- wikipedia subdomain; 'en' for en.wikipedia.org
local this_wiki_code; -- imamatpedia subdomain; 'en' for en.imamatpedia.org
local wd_article; -- article title from wikidata
local wd_article; -- article title from wikidata
خط ۳۸: خط ۳۸:
end
end


this_wiki_code = mw.language.getContentLanguage():getCode(); -- get this wikipedia's language code (subdomain)
this_wiki_code = mw.language.getContentLanguage():getCode(); -- get this imamatpedia's language code (subdomain)
if string.match (mw.site.server, 'wikidata') then
if string.match (mw.site.server, 'wikidata') then
خط ۹۲۱: خط ۹۲۱:
prefix=handler.prefix,id=id,separator=handler.separator, encode=handler.encode}) .. err_cat;
prefix=handler.prefix,id=id,separator=handler.separator, encode=handler.encode}) .. err_cat;
end
end
--[[--------------------------< S 2 C I D >--------------------------------------------------------------------
Format an S2CID, do simple error checking
S2CIDs are sequential numbers beginning at 1 and counting up.  This code checks the S2CID to see that it is only
digits and is less than test_limit; the value in local variable test_limit will need to be updated periodically
as more S2CIDs are issued.
]]
local function s2cid (id, access)
local handler = cfg.id_handlers['S2CID'];
local err_cat = ''; -- presume that S2CID is valid
local id_num;
local text;
id_num = id:match ('^[1-9]%d*$'); -- id must be all digits; must not begin with 0; no open access flag
if is_set (id_num) then -- id_num has a value so test it
id_num = tonumber(id_num); -- convert id_num to a number for range testing
if handler.id_limit < id_num then -- if S2CID is outside test limit boundaries
err_cat = ' ' .. set_message ('bad_s2cid_err'); -- set an error message
end
else -- when id format incorrect
err_cat = ' ' .. set_message ('bad_s2cid_err'); -- set an error message
end
text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id:gsub ('%.%a%a', ''), separator = handler.separator, encode = handler.encode, access = access}) .. err_cat;
return text;
end




خط ۱٬۰۸۸: خط ۱٬۱۲۴:
elseif k == 'PMID' then
elseif k == 'PMID' then
table.insert( new_list, {handler.label, pmid( v ) } );
table.insert( new_list, {handler.label, pmid( v ) } );
elseif k == 'S2CID' then
table.insert( new_list, {handler.label, s2cid( v, handler.access ) } );
elseif k == 'SSRN' then
elseif k == 'SSRN' then
table.insert( new_list, {handler.label, ssrn( v ) } );
table.insert( new_list, {handler.label, ssrn( v ) } );
۴۱۵٬۰۷۸

ویرایش