Title: Module:Citation/CS1/Identifiers - freem URL Source: https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers Markdown Content: [](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#) - [x] * [Home](https://freemwiki.com/wiki/Main_Page) * [Random](https://freemwiki.com/wiki/Special:Random) * [Log in](https://freemwiki.com/index.php?title=Special:UserLogin&returnto=Module%3ACitation%2FCS1%2FIdentifiers&returntoquery=mobileaction%3Dtoggle_view_mobile) * [Settings](https://freemwiki.com/index.php?title=Special:MobileOptions&returnto=Module%3ACitation%2FCS1%2FIdentifiers) * [About](https://freemwiki.com/wiki/About) * [Terms of Service](https://freemwiki.com/wiki/Terms_of_Service) [freem](https://freemwiki.com/wiki/Main_Page) Search # Module:Citation/CS1/Identifiers * [Language](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#p-lang "Language") * [Watch](https://freemwiki.com/index.php?title=Special:UserLogin&returnto=Module%3ACitation%2FCS1%2FIdentifiers) * [Edit](https://freemwiki.com/index.php?title=Module:Citation/CS1/Identifiers&action=edit) <[Module:Citation/CS1](https://freemwiki.com/wiki/Module:Citation/CS1 "Module:Citation/CS1") _Documentation for this module may be created at [Module:Citation/CS1/Identifiers/doc](https://freemwiki.com/index.php?title=Module:Citation/CS1/Identifiers/doc&action=edit&redlink=1 "Module:Citation/CS1/Identifiers/doc (page does not exist)")_ [](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-1)--[[--------------------------< F O R W A R D D E C L A R A T I O N S >--------------------------------------[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-2)]][](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-3)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-4)local has_accept_as_written, is_set, in_array, set_message, select_one,-- functions in Module:Citation/CS1/Utilities[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-5)substitute, make_wikilink;[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-6)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-7)local z;-- table of tables defined in Module:Citation/CS1/Utilities[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-8)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-9)local cfg;-- table of configuration tables that are defined in Module:Citation/CS1/Configuration[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-10)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-11)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-12)--[[--------------------------< P A G E S C O P E V A R I A B L E S >--------------------------------------[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-13)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-14)declare variables here that have page-wide scope that are not brought in from other modules; that are created here and used here[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-15)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-16)]][](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-17)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-18)local auto_link_urls = {};-- holds identifier URLs for those identifiers that can auto-link |title=[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-19)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-20)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-21)--============================<< H E L P E R F U N C T I O N S >>============================================[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-22)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-23)--[[--------------------------< W I K I D A T A _ A R T I C L E _ N A M E _ G E T >----------------------------[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-24)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-25)as an aid to internationalizing identifier-label wikilinks, gets identifier article names from Wikidata.[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-26)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-27)returns w::
when has an
for ; nil else. 'w:'[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-28)ensures that sister project (like wiktionary) will link to the .wikipedia article.[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-29)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-30)for identifiers that do not have , returns nil[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-31)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-32)for wikis that do not have mw.wikibase installed, returns nil[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-33)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-34)]][](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-35)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-36)local function wikidata_article_name_get (q)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-37)if not is_set (q) or (q and not mw.wikibase) then-- when no q number or when a q number but mw.wikibase not installed on this wiki[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-38)return nil;-- abandon[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-39)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-40)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-41)local wd_article;[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-42)local this_wiki_code = cfg.this_wiki_code;-- Wikipedia subdomain; 'en' for en.wikipedia.org[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-43)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-44)wd_article = mw.wikibase.getSitelink (q, this_wiki_code .. 'wiki');-- fetch article title from WD; nil when no title available at this wiki[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-45)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-46)if wd_article then[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-47)wd_article = table.concat ({'w:', this_wiki_code, ':', wd_article});-- interwiki-style link without brackets if taken from WD; leading 'w:' required[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-48)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-49)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-50)return wd_article;-- article title from WD; nil else[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-51)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-52)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-53)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-54)--[[--------------------------< L A B E L _ L I N K _ M A K E >------------------------------------------------[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-55)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-56)common function to create a link for an identifier label from handler table or from Wikidata[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-57)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-58)returns the first available of:[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-59) 1. redirect from local wiki's handler table (if enabled)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-60) 2. Wikidata sitelink to the local language wikipedia article (if there is a Wikidata entry for this identifier in the local language)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-61) 3. link to wikipedia article specified in the local wiki's handler table[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-62)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-63)]][](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-64)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-65)local function label_link_make (handler)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-66)local wd_article;[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-67)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-68)if not (cfg.use_identifier_redirects and is_set (handler.redirect)) then-- redirect has priority so if enabled and available don't fetch from Wikidata because expensive[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-69)wd_article = wikidata_article_name_get (handler.q);-- if Wikidata has an article title for this wiki, get it;[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-70)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-71)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-72)return (cfg.use_identifier_redirects and is_set (handler.redirect) and handler.redirect) or wd_article or handler.link;[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-73)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-74)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-75)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-76)--[[--------------------------< E X T E R N A L _ L I N K _ I D >----------------------------------------------[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-77)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-78)Formats a wiki-style external link[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-79)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-80)]][](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-81)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-82)local function external_link_id (options)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-83)local url_string = options.id;[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-84)local ext_link;[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-85)local this_wiki_code = cfg.this_wiki_code;-- Wikipedia subdomain; 'en' for en.wikipedia.org[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-86)local wd_article;-- article title from Wikidata[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-87)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-88)if options.encode == true or options.encode == nil then[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-89)url_string = mw.uri.encode (url_string, 'PATH');[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-90)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-91)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-92)if options.auto_link and is_set (options.access) then[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-93)auto_link_urls[options.auto_link] = table.concat ({options.prefix, url_string, options.suffix});[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-94)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-95)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-96)ext_link = mw.ustring.format ('[%s%s%s %s]', options.prefix, url_string, options.suffix or "", mw.text.nowiki (options.id));[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-97)if is_set (options.access) then[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-98)ext_link = substitute (cfg.presentation['ext-link-access-signal'], {cfg.presentation[options.access].class, cfg.presentation[options.access].title, ext_link});-- add the free-to-read / paywall lock[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-99)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-100)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-101)return table.concat({[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-102)make_wikilink (label_link_make (options), options.label),-- redirect, Wikidata link, or locally specified link (in that order)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-103)options.separator or ' ',[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-104)ext_link[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-105)});[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-106)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-107)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-108)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-109)--[[--------------------------< I N T E R N A L _ L I N K _ I D >----------------------------------------------[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-110)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-111)Formats a wiki-style internal link[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-112)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-113)TODO: Does not currently need to support options.access, options.encode, auto-linking and COinS (as in external_link_id),[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-114)but may be needed in the future for :m:Interwiki_map custom-prefixes like :arxiv:, :bibcode:, :DOI:, :hdl:, :ISSN:,[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-115):JSTOR:, :Openlibrary:, :PMID:, :RFC:.[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-116)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-117)]][](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-118)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-119)local function internal_link_id (options)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-120)local id = mw.ustring.gsub (options.id, '%d', cfg.date_names.local_digits);-- translate 'local' digits to Western 0-9[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-121)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-122)return table.concat ([](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-123){[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-124)make_wikilink (label_link_make (options), options.label),-- wiki-link the identifier label[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-125)options.separator or ' ',-- add the separator[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-126)make_wikilink ([](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-127)table.concat ([](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-128){[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-129)options.prefix,[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-130)id,-- translated to Western digits[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-131)options.suffix or ''[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-132)}),[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-133)substitute (cfg.presentation['bdi'], {'', mw.text.nowiki (options.id)})-- bdi tags to prevent Latin script identifiers from being reversed at RTL language wikis[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-134));-- nowiki because MediaWiki still has magic links for ISBN and the like; TODO: is it really required?[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-135)});[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-136)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-137)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-138)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-139)--[[--------------------------< I S _ E M B A R G O E D >------------------------------------------------------[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-140)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-141)Determines if a PMC identifier's online version is embargoed. Compares the date in |pmc-embargo-date= against[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-142)today's date. If embargo date is in the future, returns the content of |pmc-embargo-date=; otherwise, returns[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-143)an empty string because the embargo has expired or because |pmc-embargo-date= was not set in this cite.[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-144)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-145)]][](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-146)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-147)local function is_embargoed (embargo)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-148)if is_set (embargo) then[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-149)local lang = mw.getContentLanguage();[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-150)local good1, embargo_date, todays_date;[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-151)good1, embargo_date = pcall (lang.formatDate, lang, 'U', embargo);[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-152)todays_date = lang:formatDate ('U');[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-153)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-154)if good1 then-- if embargo date is a good date[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-155)if tonumber (embargo_date) >= tonumber (todays_date) then-- is embargo date is in the future?[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-156)return embargo;-- still embargoed[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-157)else[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-158)set_message ('maint_pmc_embargo');-- embargo has expired; add main cat[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-159)return '';-- unset because embargo has expired[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-160)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-161)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-162)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-163)return '';-- |pmc-embargo-date= not set return empty string[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-164)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-165)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-166)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-167)--[=[-------------------------< I S _ V A L I D _ R X I V _ D A T E >------------------------------------------[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-168)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-169)for biorxiv, returns true if:[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-170) 2019-12-11T00:00Z <= biorxiv_date < today + 2 days[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-171)for medrxiv, returns true if:[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-172) 2020-01-01T00:00Z <= medrxiv_date < today + 2 days[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-173)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-174)The dated form of biorxiv identifier has a start date of 2019-12-11. The Unix timestamp for that date is {{#time:U|2019-12-11}} = 1576022400[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-175)The medrxiv identifier has a start date of 2020-01-01. The Unix timestamp for that date is {{#time:U|2020-01-01}} = 1577836800[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-176)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-177) is the date provided in those |biorxiv= parameter values that are dated and in |medrxiv= parameter values at time 00:00:00 UTC[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-178) is the current date at time 00:00:00 UTC plus 48 hours[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-179) if today's date is 2023-01-01T00:00:00 then[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-180) adding 24 hours gives 2023-01-02T00:00:00 – one second more than today[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-181) adding 24 hours gives 2023-01-03T00:00:00 – one second more than tomorrow[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-182)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-183)inputs:[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-184), , – year, month, day parts of the date from the birxiv or medrxiv identifier[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACitation%2FCS1%2FIdentifiers#L-185)