Modul:Citation/CS1/Identifiers: Pabidaan ralatan
Konten dihapus Konten ditambahkan
avoid bumping expensive count |
sKadada kasimpulan babakan |
||
Baris 1:
local identifiers = {};
--[[--------------------------< F O R W A R D D E C L A R A T I O N S >--------------------------------------
Baris 8 ⟶ 11:
local cfg; -- table of configuration tables that are defined in Module:Citation/CS1/Configuration
Baris 23 ⟶ 24:
local url_string = options.id;
local ext_link;
if options.encode == true or options.encode == nil then
url_string = mw.uri.encode( url_string );
end
ext_link = mw.ustring.format ('[%s%s%s %s]', options.prefix, url_string, options.suffix or "", mw.text.nowiki(options.id));
if is_set(options.access) then
ext_link = substitute (cfg.presentation['
end
return table.concat ({
make_wikilink (
options.separator or ' ',
ext_link
Baris 63 ⟶ 49:
local function internal_link_id(options)
return table.concat (
Baris 73 ⟶ 58:
{
options.prefix,
options.id,
options.suffix or ''
}),
mw.text.nowiki (options.id)
);
});
end
Baris 198 ⟶ 183:
where:
<archive> is a string of alpha characters - may be hyphenated; no other punctuation
<class> is a string of alpha characters - may be hyphenated; no other punctuation
<date code> is four digits in the form YYMM where YY is the last two digits of the four-digit year and MM is the month number January = 01
first digit of YY for this form can only 9 and 0
Baris 221 ⟶ 206:
local handler = cfg.id_handlers['ARXIV'];
local year, month, version;
local err_cat =
local text;
if id:match("^%a[%a%.%-]+/[90]%d[01]%d%d%d%d$") or id:match("^%a[%a%.%-]+/[90]%d[01]%d%d%d%dv%d+$") then -- test for the 9108-0703 format w/ & w/o version
Baris 230 ⟶ 215:
if ((not (90 < year or 8 > year)) or (1 > month or 12 < month)) or -- if invalid year or invalid month
((91 == year and 7 > month) or (7 == year and 3 < month)) then -- if years ok, are starting and ending months ok?
err_cat =
end
elseif id:match("^%d%d[01]%d%.%d%d%d%d$") or id:match("^%d%d[01]%d%.%d%d%d%dv%d+$") then -- test for the 0704-1412 w/ & w/o version
year, month = id:match("^(%d%d)([01]%d)%.%d%d%d%d[v%d]*$");
Baris 239 ⟶ 223:
if ((7 > year) or (14 < year) or (1 > month or 12 < month)) or -- is year invalid or is month invalid? (doesn't test for future years)
((7 == year) and (4 > month)) then --or -- when year is 07, is month invalid (before April)?
err_cat =
end
elseif id:match("^%d%d[01]%d%.%d%d%d%d%d$") or id:match("^%d%d[01]%d%.%d%d%d%d%dv%d+$") then -- test for the 1501- format w/ & w/o version
year, month = id:match("^(%d%d)([01]%d)%.%d%d%d%d%d[v%d]*$");
Baris 247 ⟶ 230:
month = tonumber(month);
if ((15 > year) or (1 > month or 12 < month)) then -- is year invalid or is month invalid? (doesn't test for future years)
end
else
err_cat =
end
▲ text = external_link_id({link = handler.link, label = handler.label, q = handler.q,
prefix=handler.prefix,id=id,separator=handler.separator, encode=handler.encode, access=handler.access}) .. err_cat;
if is_set (class) then
▲ text = table.concat ({text, ' [[//arxiv.org/archive/', class, ' ', class, ']]'}); -- external link within square brackets, not wikilink
class = ''; -- empty string for concatenation
▲ else
end
return text .. class;
end
Baris 295 ⟶ 273:
local year;
local text = external_link_id({link=handler.link, label=handler.label
prefix=handler.prefix, id=id, separator=handler.separator, encode=handler.encode,
access=access});
Baris 340 ⟶ 318:
end
return external_link_id({link = handler.link, label = handler.label
prefix=handler.prefix,id=id,separator=handler.separator,
encode=handler.encode, access=handler.access}) .. err_cat;
Baris 357 ⟶ 335:
local matched;
local text = external_link_id({link=handler.link, label=handler.label
prefix=handler.prefix, id=id, separator=handler.separator, encode=handler.encode,
access=handler.access});
Baris 394 ⟶ 372:
local inactive_year = inactive:match("%d%d%d%d") or ''; -- try to get the year portion from the inactive date
if is_set(inactive_year) then
table.insert( z.error_categories, "Pages with DOIs inactive
else
table.insert( z.error_categories, "Pages with inactive DOIs" ); -- when inactive doesn't contain a recognizable year
Baris 400 ⟶ 378:
inactive = " (" .. cfg.messages['inactive'] .. " " .. inactive .. ")"
end
text = external_link_id({link = handler.link, label = handler.label
prefix=handler.prefix,id=id,separator=handler.separator, encode=handler.encode, access=access}) .. (inactive or '')
Baris 431 ⟶ 409:
local handler = cfg.id_handlers['HDL'];
local text = external_link_id({link = handler.link, label = handler.label
prefix=handler.prefix,id=id,separator=handler.separator, encode=handler.encode, access=access})
Baris 511 ⟶ 489:
local handler = cfg.id_handlers['ASIN'];
return external_link_id({link=handler.link,
label=handler.label
id=id, encode=handler.encode, separator = handler.separator}) .. err_cat;
end
Baris 598 ⟶ 576:
end
text = external_link_id({link = handler.link, label = handler.label
prefix=handler.prefix,id=id,separator=handler.separator, encode=handler.encode})
Baris 634 ⟶ 612:
end
return external_link_id({link = handler.link, label = handler.label
prefix=handler.prefix,id=id,separator=handler.separator, encode=handler.encode}) .. err_cat;
end
Baris 691 ⟶ 669:
end
return external_link_id({link = handler.link, label = handler.label
prefix=handler.prefix,id=lccn,separator=handler.separator, encode=handler.encode}) .. err_cat;
end
Baris 723 ⟶ 701:
end
return external_link_id({link = handler.link, label = handler.label
prefix=handler.prefix,id=id,separator=handler.separator, encode=handler.encode}) .. err_cat;
end
Baris 730 ⟶ 708:
--[[--------------------------< O C L C >----------------------------------------------------------------------
Validate and format an oclc id. https://www.oclc.org/batchload/controlnumber.en.html
]]
Baris 764 ⟶ 741:
end
local text = external_link_id({link=handler.link, label=handler.label
prefix=handler.prefix, id=id, separator=handler.separator, encode=handler.encode}) .. err_msg;
Baris 785 ⟶ 762:
if not is_set (ident) then -- if malformed return an error
return external_link_id({link=handler.link, label=handler.label
prefix=handler.prefix .. 'OL',
id=id, separator=handler.separator, encode = handler.encode,
Baris 794 ⟶ 771:
if ( code == "A" ) then
return external_link_id({link=handler.link, label=handler.label
prefix=handler.prefix .. 'authors/OL',
id=id, separator=handler.separator, encode = handler.encode,
Baris 801 ⟶ 778:
if ( code == "M" ) then
return external_link_id({link=handler.link, label=handler.label
prefix=handler.prefix .. 'books/OL',
id=id, separator=handler.separator, encode = handler.encode,
Baris 808 ⟶ 785:
if ( code == "W" ) then
return external_link_id({link=handler.link, label=handler.label
prefix=handler.prefix .. 'works/OL',
id=id, separator=handler.separator, encode = handler.encode,
Baris 834 ⟶ 811:
local function pmc(id, embargo)
local test_limit =
local handler = cfg.id_handlers['PMC'];
local err_cat = ''; -- presume that PMC is valid
Baris 868 ⟶ 845:
});
else
text = external_link_id({link = handler.link, label = handler.label
prefix=handler.prefix,id=id,separator=handler.separator, encode=handler.encode, access=handler.access}) .. err_cat;
end
Baris 884 ⟶ 861:
local function pmid(id)
local test_limit =
local handler = cfg.id_handlers['PMID'];
local err_cat = ''; -- presume that PMID is valid
Baris 897 ⟶ 874:
end
return external_link_id({link = handler.link, label = handler.label
prefix=handler.prefix,id=id,separator=handler.separator, encode=handler.encode}) .. err_cat;
end
Baris 930 ⟶ 907:
end
text = external_link_id({link = handler.link, label = handler.label
prefix=handler.prefix,id=id,separator=handler.separator, encode=handler.encode, access=handler.access}) .. err_cat;
Baris 947 ⟶ 924:
local handler = cfg.id_handlers['USENETID'];
local text = external_link_id({link = handler.link, label = handler.label
prefix=handler.prefix,id=id,separator=handler.separator, encode=handler.encode})
Baris 983 ⟶ 960:
end
return external_link_id({link = handler.link, label = handler.label
prefix=handler.prefix,id=id,separator=handler.separator, encode=handler.encode}) .. err_cat;
end
Baris 1.160 ⟶ 1.137:
end
return {
|