Jump to content

Module:Citation/CS1/Identifiers: Difference between revisions

sync from sandbox;
imported>Roza
m (see https://en.wikipedia.org/wiki/Help_talk:Citation_Style_1#Errors_from_imported_CS1_templates_into_third_party_wikis_which_don't_have_wikibase)
(sync from sandbox;)
Line 1: Line 1:
local identifiers = {};


--[[--------------------------< F O R W A R D  D E C L A R A T I O N S >--------------------------------------
--[[--------------------------< F O R W A R D  D E C L A R A T I O N S >--------------------------------------
Line 44: Line 41:
end
end
if is_set (options.q) and mw.wikibase then
if is_set (options.q) and mw.wikibase then -- wikibase test here avoids script errors in third party wikis that aren't using mw.wikibase extension
wd_article = mw.wikibase.getEntity (options.q):getSitelink (this_wiki_code .. 'wiki'); -- fetch article title from wd
wd_article = mw.wikibase.getEntity (options.q):getSitelink (this_wiki_code .. 'wiki'); -- fetch article title from wd
if wd_article then
if wd_article then
Line 66: Line 63:


local function internal_link_id(options)
local function internal_link_id(options)
local id = mw.ustring.gsub (options.id, '%d', cfg.date_names.local_digits); -- translate 'local' digits to Western 0-9


return table.concat (
return table.concat (
Line 75: Line 73:
{
{
options.prefix,
options.prefix,
options.id,
id, -- translated to western digits
options.suffix or ''
options.suffix or ''
}),
}),
mw.text.nowiki (options.id)
substitute (cfg.presentation['bdi'], {'', mw.text.nowiki (options.id)}) -- bdi tags to prevent Latn script identifiers from being reversed at rtl language wikis
);
); -- nowiki because MediaWiki still has magic links for ISBN and the like; TODO: is it really required?
});
});
end
end
Line 396: Line 394:
local inactive_year = inactive:match("%d%d%d%d") or ''; -- try to get the year portion from the inactive date
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
if is_set(inactive_year) then
table.insert( z.error_categories, "Pages with DOIs inactive since " .. inactive_year );
table.insert( z.error_categories, "Pages with DOIs inactive as of " .. inactive_year );
else
else
table.insert( z.error_categories, "Pages with inactive DOIs" ); -- when inactive doesn't contain a recognizable year
table.insert( z.error_categories, "Pages with inactive DOIs" ); -- when inactive doesn't contain a recognizable year
Line 732: Line 730:
--[[--------------------------< O C L C >----------------------------------------------------------------------
--[[--------------------------< O C L C >----------------------------------------------------------------------


Validate and format an oclc id.  https://www.oclc.org/batchload/controlnumber.en.html
Validate and format an oclc id.  https://www.oclc.org/batchload/controlnumber.en.html {{dead link}}
archived at: https://web.archive.org/web/20161228233804/https://www.oclc.org/batchload/controlnumber.en.html


]]
]]
Line 1,161: Line 1,160:
end
end


--[[--------------------------< E X P O R T E D  F U N C T I O N S >------------------------------------------
]]


return {
return {
Cookies help us deliver our services. By using our services, you agree to our use of cookies.