Module:Citation/CS1/Identifiers: Difference between revisions

Synch from sandbox;
m (1 revision imported: cite web)
(Synch from sandbox;)
Line 6:
]]
 
local is_set, in_array, set_error, select_one, add_maint_cat, substitute; -- functions in Module:Citation/CS1/Utilities
 
local z; -- table of tables defined in Module:Citation/CS1/Utilities
Line 21:
local function external_link_id(options)
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
return mw.ustring.format( '[[%s|%s]]%s[%s%s%s %s]',
options ext_link = mw.linkustring.format ('[%s%s%s %s]', options.labelprefix, url_string, options.separatorsuffix or " ", mw.text.nowiki(options.id));
if options.free then
options.prefix, url_string, options.suffix or "",
ext_link = substitute (cfg.presentation['free to read'], ext_link); -- add the free-to-read lock
mw.text.nowiki(options.id)
);end
return mw.ustring.format( '[[%s|%s]]%s%s', options.link, options.label, options.separator or " ", ext_link);
 
-- return mw.ustring.format( '[[%s|%s]]%s[%s%s%s %s]',
-- options.link, options.label, options.separator or " ",
-- options.prefix, url_string, options.suffix or "",
-- mw.text.nowiki(options.id)
-- );
end
 
Line 313 ⟶ 323:
 
text = external_link_id({link = handler.link, label = handler.label,
prefix=handler.prefix,id=id,separator=handler.separator, encode=handler.encode, free=handler.free}) .. err_cat;
 
if is_set (class) then
Line 508 ⟶ 518:
else
text = external_link_id({link = handler.link, label = handler.label, -- no embargo date or embargo has expired, ok to link to article
prefix=handler.prefix,id=id,separator=handler.separator, encode=handler.encode, free=handler.free}) .. err_cat;
end
return text;
Line 693 ⟶ 703:
1–4 must be digits and must represent a year in the range of 1000 – next year
5 must be a letter
6–86 must be letter, ampersand, or dot (ampersand cannot directly precede a dot; &. )
97–8 must be letter, digit, ampersand, or dot (ampersand cannot directly precede a dot; &. )
10–189–18 must be letter, digit, or dot
19 must be a letter or dot
 
Line 711 ⟶ 721:
err_type = 'length';
else
year = id:match ("^(%d%d%d%d)[%a][%a&%.][%a&%.%d][%a&%.][%a%.d][%a%d%.]+[%a%.]$") --
if not year then -- if nil then no pattern match
err_type = 'value'; -- so value error
Line 854 ⟶ 864:
select_one = utilities_page_ptr.select_one;
add_maint_cat = utilities_page_ptr.add_maint_cat;
substitute = utilities_page_ptr.substitute;
 
z = utilities_page_ptr.z; -- table of tables in Module:Citation/CS1/Utilities
Anonymous user