| Line 12: |
Line 12: |
| | local z ={}; -- tables in Module:Citation/CS1/Utilities | | local z ={}; -- tables in Module:Citation/CS1/Utilities |
| | | | |
| − | local extract_ids, extract_id_access_levels, build_id_list, is_embargoed; -- functions in Module:Citation/CS1/Identifiers | + | local extract_ids, extract_id_access_levels, build_id_list, is_embargoed; -- functions in Module:Citation/CS1/Identifiers |
| | | | |
| | local make_coins_title, get_coins_pages, COinS; -- functions in Module:Citation/CS1/COinS | | local make_coins_title, get_coins_pages, COinS; -- functions in Module:Citation/CS1/COinS |
| Line 407: |
Line 407: |
| | end | | end |
| | | | |
| − | base_url = table.concat({ "[", URL, " ", safe_for_url( label ), "]" }); | + | if is_set (access) then -- access level (subscription, registration, limited) |
| − |
| + | local label_head = ''; |
| − | if is_set(access) then -- access level (free, paywalled, ...)
| + | local label_tail; |
| − | base_url = substitute(cfg.presentation[access], base_url); | + | local markup = ''; -- can't start a span inside italic markup and end it outside the italic markup |
| | + | |
| | + | label = safe_for_url (label); -- replace square brackets and newlines (is this necessary? already done above?) |
| | + | if label:match ("(.*)%s+(.+)('''?)$") then -- for italicized titles (cite book, etc) |
| | + | label_head, label_tail, markup = label:match ("(.*)%s+(.+)('''?)$"); -- split the label at the right-most space; separate the markup |
| | + | elseif label:match ("(.*)%s+(.+)$") then -- for upright titles (journal, news, magazine, etc) |
| | + | label_head, label_tail = label:match ("(.*)%s+(.+)$"); -- split the label at the right-most space; no markup |
| | + | elseif label:match ("(.+)('''?)$") then -- single word label with markup |
| | + | label_tail, markup = label:match ("(.+)('''?)$"); -- save label text as label tail; separate the markup |
| | + | else |
| | + | label_tail = label; |
| | + | end |
| | + | |
| | + | base_url = table.concat ( |
| | + | { |
| | + | '<span class="plainlinks">[', -- opening css |
| | + | URL, -- the url |
| | + | ' ', -- the required space |
| | + | label_head, -- all but the last word of the label |
| | + | ' <span class="nowrap">', -- nowrap css for the last word and the signal icon |
| | + | label_tail, -- last (or only) word of the label inside the span |
| | + | '<span style="padding-left:0.15em">', -- signal spacing css |
| | + | cfg.presentation[access], -- the appropriate icon |
| | + | '</span></span>', -- close signal spacing and nowrap spans |
| | + | markup, -- insert italic markup if any |
| | + | ']</span>' -- close the plain links span |
| | + | }); |
| | + | else |
| | + | base_url = table.concat({ "[", URL, " ", safe_for_url( label ), "]" }); -- no signal markup |
| | end | | end |
| | | | |
| Line 452: |
Line 480: |
| | local cap2=''; | | local cap2=''; |
| | -- TODO: move this elswhere so that all title-holding elements get these quote marks replaced? | | -- TODO: move this elswhere so that all title-holding elements get these quote marks replaced? |
| − | str= mw.ustring.gsub (str, '[“”]', '\"'); -- replace “” (U+201C & U+201D) with " (typewriter double quote mark)
| + | -- str= mw.ustring.gsub (str, '[“”]', '\"'); -- replace “” (U+201C & U+201D) with " (typewriter double quote mark) |
| − | str= mw.ustring.gsub (str, '[‘’]', '\''); -- replace ‘’ (U+2018 & U+2019) with ' (typewriter single quote mark)
| + | -- str= mw.ustring.gsub (str, '[‘’]', '\''); -- replace ‘’ (U+2018 & U+2019) with ' (typewriter single quote mark) |
| | | | |
| | cap, cap2 = str:match ("^([\"\'])([^\'].+)"); -- match leading double or single quote but not double single quotes | | cap, cap2 = str:match ("^([\"\'])([^\'].+)"); -- match leading double or single quote but not double single quotes |
| Line 704: |
Line 732: |
| | | | |
| | --[[--------------------------< V A L I D A T E >-------------------------------------------------------------- | | --[[--------------------------< V A L I D A T E >-------------------------------------------------------------- |
| − | Looks for a parameter's name in the whitelist. | + | |
| | + | Looks for a parameter's name in one of several whitelists. |
| | | | |
| | Parameters in the whitelist can have three values: | | Parameters in the whitelist can have three values: |
| Line 713: |
Line 742: |
| | ]] | | ]] |
| | | | |
| − | local function validate( name ) | + | --local function validate( name ) |
| | + | local function validate( name, cite_class ) |
| | local name = tostring( name ); | | local name = tostring( name ); |
| − | local state = whitelist.basic_arguments[ name ]; | + | local state; |
| | | | |
| − | -- Normal arguments | + | if in_array (cite_class, {'arxiv', 'biorxiv', 'citeseerx'}) then -- limited parameter sets allowed for these templates |
| − | if true == state then return true; end -- valid actively supported parameter | + | state = whitelist.limited_basic_arguments[ name ]; |
| | + | if true == state then return true; end -- valid actively supported parameter |
| | + | if false == state then |
| | + | deprecated_parameter (name); -- parameter is deprecated but still supported |
| | + | return true; |
| | + | end |
| | + | |
| | + | if 'arxiv' == cite_class then -- basic parameters unique to these templates |
| | + | state = whitelist.arxiv_basic_arguments[name]; |
| | + | end |
| | + | if 'biorxiv' == cite_class then |
| | + | state = whitelist.biorxiv_basic_arguments[name]; |
| | + | end |
| | + | if 'citeseerx' == cite_class then |
| | + | state = whitelist.citeseerx_basic_arguments[name]; |
| | + | end |
| | + | |
| | + | if true == state then return true; end -- valid actively supported parameter |
| | + | if false == state then |
| | + | deprecated_parameter (name); -- parameter is deprecated but still supported |
| | + | return true; |
| | + | end |
| | + | -- limited enumerated parameters list |
| | + | name = name:gsub( "%d+", "#" ); -- replace digit(s) with # (last25 becomes last#) |
| | + | state = whitelist.limited_numbered_arguments[ name ]; |
| | + | if true == state then return true; end -- valid actively supported parameter |
| | + | if false == state then |
| | + | deprecated_parameter (name); -- parameter is deprecated but still supported |
| | + | return true; |
| | + | end |
| | + | |
| | + | return false; -- not supported because not found or name is set to nil |
| | + | end -- end limited parameter-set templates |
| | + | |
| | + | state = whitelist.basic_arguments[ name ]; -- all other templates; all normal parameters allowed |
| | + | |
| | + | if true == state then return true; end -- valid actively supported parameter |
| | if false == state then | | if false == state then |
| − | deprecated_parameter (name); -- parameter is deprecated but still supported | + | deprecated_parameter (name); -- parameter is deprecated but still supported |
| | return true; | | return true; |
| | end | | end |
| − |
| + | -- all enumerated parameters allowed |
| − | -- Arguments with numbers in them
| + | name = name:gsub( "%d+", "#" ); -- replace digit(s) with # (last25 becomes last# |
| − | name = name:gsub( "%d+", "#" ); -- replace digit(s) with # (last25 becomes last# | |
| | state = whitelist.numbered_arguments[ name ]; | | state = whitelist.numbered_arguments[ name ]; |
| − | if true == state then return true; end -- valid actively supported parameter | + | |
| | + | if true == state then return true; end -- valid actively supported parameter |
| | if false == state then | | if false == state then |
| − | deprecated_parameter (name); -- parameter is deprecated but still supported | + | deprecated_parameter (name); -- parameter is deprecated but still supported |
| | return true; | | return true; |
| | end | | end |
| | | | |
| − | return false; -- Not supported because not found or name is set to nil | + | return false; -- not supported because not found or name is set to nil |
| | end | | end |
| | | | |
| Line 953: |
Line 1,019: |
| | | | |
| | if name then -- if first is initials with or without suffix | | if name then -- if first is initials with or without suffix |
| − | if 3 > name:len() then -- if one or two initials | + | if 3 > mw.ustring.len (name) then -- if one or two initials |
| | if suffix then -- if there is a suffix | | if suffix then -- if there is a suffix |
| | if is_suffix (suffix) then -- is it legitimate? | | if is_suffix (suffix) then -- is it legitimate? |
| Line 1,139: |
Line 1,205: |
| | end | | end |
| | | | |
| − | --[[--------------------------< N A M E _ H A S _ M U L T _ N A M E S >----------------------------------------
| |
| | | | |
| − | Evaluates the content of author and editor (surnames only) parameters for multiple names. Multiple names are | + | --[[--------------------------< N A M E _ H A S _ E D _ M A R K U P >------------------------------------------ |
| − | indicated if there is more than one comma and or semicolon. If found, the function adds the multiple name
| + | |
| − | (author or editor) maintenance category.
| + | Evaluates the content of author and editor parameters for extranious editor annotations: ed, ed., eds, (Ed.), etc. |
| | + | These annotation do not belong in author parameters and are redundant in editor parameters. If found, the function |
| | + | adds the editor markup maintenance category. |
| | | | |
| | ]] | | ]] |
| | | | |
| − | local function name_has_mult_names (name, list_name) | + | local function name_has_ed_markup (name, list_name) |
| − | local count, _; | + | local _, pattern; |
| | + | local patterns = { -- these patterns match annotations at end of name |
| | + | '%f[%(%[][%(%[]%s*[Ee][Dd][Ss]?%.?%s*[%)%]]?$', -- (ed) or (eds): leading '(', case insensitive 'ed', optional 's', '.' and/or ')' |
| | + | '[,%.%s]%f[e]eds?%.?$', -- ed or eds: without '('or ')'; case sensitive (ED could be initials Ed could be name) |
| | + | '%f[%(%[][%(%[]%s*[Ee][Dd][Ii][Tt][Oo][Rr][Ss]?%.?%s*[%)%]]?$', -- (editor) or (editors): leading '(', case insensitive, optional '.' and/or ')' |
| | + | '[,%.%s]%f[Ee][Ee][Dd][Ii][Tt][Oo][Rr][Ss]?%.?$', -- editor or editors: without '('or ')'; case insensitive |
| | + | |
| | + | -- these patterns match annotations at beginning of name |
| | + | '^eds?[%.,;]', -- ed. or eds.: lower case only, optional 's', requires '.' |
| | + | '^[%(%[]%s*[Ee][Dd][Ss]?%.?%s*[%)%]]', -- (ed) or (eds): also sqare brackets, case insensitive, optional 's', '.' |
| | + | '^[%(%[]?%s*[Ee][Dd][Ii][Tt][Oo][Rr][Ss]?%A', -- (editor or (editors: also sq brackets, case insensitive, optional brackets, 's' |
| | + | '^[%(%[]?%s*[Ee][Dd][Ii][Tt][Ee][Dd]%A', -- (edited: also sq brackets, case insensitive, optional brackets |
| | + | |
| | + | } |
| | + | |
| | if is_set (name) then | | if is_set (name) then |
| − | if name:match ('^%(%(.*%)%)$') then -- if wrapped in doubled parentheses, ignore | + | for _, pattern in ipairs (patterns) do -- spin through patterns table and |
| − | name = name:match ('^%(%((.*)%)%)$'); -- strip parens | + | if name:match (pattern) then |
| − | else
| + | add_maint_cat ('extra_text_names', cfg.special_case_translation [list_name]); -- add a maint cat for this template |
| − | _, count = name:gsub ('[;,]', ''); -- count the number of separator-like characters
| + | break; |
| − |
| |
| − | if 1 < count then -- param could be |author= or |editor= so one separactor character is acceptable
| |
| − | add_maint_cat ('mult_names', cfg.special_case_translation [list_name]); -- more than one separator indicates multiple names so add a maint cat for this template | |
| | end | | end |
| | end | | end |
| Line 1,163: |
Line 1,241: |
| | end | | end |
| | | | |
| − | --[[--------------------------< E X T R A C T _ N A M E S >----------------------------------------------------
| |
| − | Gets name list from the input arguments
| |
| | | | |
| − | Searches through args in sequential order to find |lastn= and |firstn= parameters (or their aliases), and their matching link and mask parameters. | + | --[[--------------------------< N A M E _ H A S _ M U L T _ N A M E S >---------------------------------------- |
| − | Stops searching when both |lastn= and |firstn= are not found in args after two sequential attempts: found |last1=, |last2=, and |last3= but doesn't | + | |
| − | find |last4= and |last5= then the search is done. | + | Evaluates the content of author and editor (surnames only) parameters for multiple names. Multiple names are |
| | + | indicated if there is more than one comma and or semicolon. If found, the function adds the multiple name |
| | + | (author or editor) maintenance category. |
| | + | |
| | + | ]] |
| | + | |
| | + | local function name_has_mult_names (name, list_name) |
| | + | local count, _; |
| | + | if is_set (name) then |
| | + | _, count = name:gsub ('[;,]', ''); -- count the number of separator-like characters |
| | + | |
| | + | if 1 < count then -- param could be |author= or |editor= so one separator character is acceptable |
| | + | add_maint_cat ('mult_names', cfg.special_case_translation [list_name]); -- more than one separator indicates multiple names so add a maint cat for this template |
| | + | end |
| | + | end |
| | + | return name; -- and done |
| | + | end |
| | + | |
| | + | |
| | + | --[[--------------------------< N A M E _ C H E C K S >-------------------------------------------------------- |
| | + | This function calls various name checking functions used to validate the content of the various name-holding |
| | + | parameters. |
| | + | |
| | + | ]] |
| | + | |
| | + | local function name_checks (last, first, list_name) |
| | + | if is_set (last) then |
| | + | if last:match ('^%(%(.*%)%)$') then -- if wrapped in doubled parentheses, accept as written |
| | + | last = last:match ('^%(%((.*)%)%)$'); -- strip parens |
| | + | else |
| | + | last = name_has_mult_names (last, list_name); -- check for multiple names in the parameter (last only) |
| | + | last = name_has_ed_markup (last, list_name); -- check for extraneous 'editor' annotation |
| | + | end |
| | + | end |
| | + | if is_set (first) then |
| | + | if first:match ('^%(%(.*%)%)$') then -- if wrapped in doubled parentheses, accept as written |
| | + | first = first:match ('^%(%((.*)%)%)$'); -- strip parens |
| | + | else |
| | + | first = name_has_ed_markup (first, list_name); -- check for extraneous 'editor' annotation |
| | + | end |
| | + | end |
| | + | return last, first; -- done |
| | + | end |
| | + | |
| | + | |
| | + | --[[--------------------------< E X T R A C T _ N A M E S >---------------------------------------------------- |
| | + | Gets name list from the input arguments |
| | + | |
| | + | Searches through args in sequential order to find |lastn= and |firstn= parameters (or their aliases), and their matching link and mask parameters. |
| | + | Stops searching when both |lastn= and |firstn= are not found in args after two sequential attempts: found |last1=, |last2=, and |last3= but doesn't |
| | + | find |last4= and |last5= then the search is done. |
| | | | |
| | This function emits an error message when there is a |firstn= without a matching |lastn=. When there are 'holes' in the list of last names, |last1= and |last3= | | This function emits an error message when there is a |firstn= without a matching |lastn=. When there are 'holes' in the list of last names, |last1= and |last3= |
| Line 1,199: |
Line 1,325: |
| | last, etal = name_has_etal (last, etal, false); -- find and remove variations on et al. | | last, etal = name_has_etal (last, etal, false); -- find and remove variations on et al. |
| | first, etal = name_has_etal (first, etal, false); -- find and remove variations on et al. | | first, etal = name_has_etal (first, etal, false); -- find and remove variations on et al. |
| − | -- last = name_has_mult_names (last, err_msg_list_name); -- check for multiple names in last and its aliases
| + | last, first= name_checks (last, first, list_name); -- multiple names, extraneous annotation, etc checks |
| − | last = name_has_mult_names (last, list_name); -- check for multiple names in last and its aliases
| |
| | | | |
| | if first and not last then -- if there is a firstn without a matching lastn | | if first and not last then -- if there is a firstn without a matching lastn |
| Line 1,247: |
Line 1,372: |
| | | | |
| | local function get_iso639_code (lang, this_wiki_code) | | local function get_iso639_code (lang, this_wiki_code) |
| | + | if 'bangla' == lang:lower() then -- special case related to Wikimedia remap of code 'bn' at mw:Extension:CLDR |
| | + | return 'Bengali', 'bn'; -- make sure rendered version is properly capitalized |
| | + | end |
| | + | |
| | local languages = mw.language.fetchLanguageNames(this_wiki_code, 'all') -- get a list of language names known to Wikimedia | | local languages = mw.language.fetchLanguageNames(this_wiki_code, 'all') -- get a list of language names known to Wikimedia |
| | -- ('all' is required for North Ndebele, South Ndebele, and Ojibwa) | | -- ('all' is required for North Ndebele, South Ndebele, and Ojibwa) |
| Line 1,261: |
Line 1,390: |
| | return lang; -- not valid language; return language in original case and nil for the code | | return lang; -- not valid language; return language in original case and nil for the code |
| | end | | end |
| | + | |
| | | | |
| | --[[--------------------------< L A N G U A G E _ P A R A M E T E R >------------------------------------------ | | --[[--------------------------< L A N G U A G E _ P A R A M E T E R >------------------------------------------ |
| Line 1,307: |
Line 1,437: |
| | | | |
| | if is_set (code) then -- only 2- or 3-character codes | | if is_set (code) then -- only 2- or 3-character codes |
| | + | if 'bn' == code then name = 'Bengali' end; -- override wikimedia when code is 'bn' |
| | if this_wiki_code ~= code then -- when the language is not the same as this wiki's language | | if this_wiki_code ~= code then -- when the language is not the same as this wiki's language |
| | if 2 == code:len() then -- and is a two-character code | | if 2 == code:len() then -- and is a two-character code |
| Line 1,714: |
Line 1,845: |
| | | | |
| | local function terminate_name_list (name_list, sepc) | | local function terminate_name_list (name_list, sepc) |
| − | if (string.sub (name_list,-1,-1) == sepc) or (string.sub (name_list,-3,-1) == sepc .. ']]') then -- if last name in list ends with sepc char | + | if (string.sub (name_list,-3,-1) == sepc .. '. ') then -- if already properly terminated |
| | + | return name_list; -- just return the name list |
| | + | elseif (string.sub (name_list,-1,-1) == sepc) or (string.sub (name_list,-3,-1) == sepc .. ']]') then -- if last name in list ends with sepc char |
| | return name_list .. " "; -- don't add another | | return name_list .. " "; -- don't add another |
| | else | | else |
| Line 1,884: |
Line 2,017: |
| | local path, timestamp, flag; -- portions of the archive.or url | | local path, timestamp, flag; -- portions of the archive.or url |
| | | | |
| − | if not url:match('//web%.archive%.org/') then | + | if (not url:match('//web%.archive%.org/')) and (not url:match('//liveweb%.archive%.org/')) then -- also deprecated liveweb Wayback machine url |
| | return url, date; -- not an archive.org archive, return ArchiveURL and ArchiveDate | | return url, date; -- not an archive.org archive, return ArchiveURL and ArchiveDate |
| | end | | end |
| Line 1,891: |
Line 2,024: |
| | err_msg = 'save command'; | | err_msg = 'save command'; |
| | url = url:gsub ('(//web%.archive%.org)/save/', '%1/*/', 1); -- for preview mode: modify ArchiveURL | | url = url:gsub ('(//web%.archive%.org)/save/', '%1/*/', 1); -- for preview mode: modify ArchiveURL |
| | + | elseif url:match('//liveweb%.archive%.org/') then |
| | + | err_msg = 'liveweb'; |
| | else | | else |
| | path, timestamp, flag = url:match('//web%.archive%.org/([^%d]*)(%d+)([^/]*)/'); -- split out some of the url parts for evaluation | | path, timestamp, flag = url:match('//web%.archive%.org/([^%d]*)(%d+)([^/]*)/'); -- split out some of the url parts for evaluation |
| Line 1,991: |
Line 2,126: |
| | end | | end |
| | | | |
| − | local Coauthors = A['Coauthors'];
| |
| | local Others = A['Others']; | | local Others = A['Others']; |
| | | | |
| Line 2,015: |
Line 2,149: |
| | t = extract_names (args, 'TranslatorList'); -- fetch translator list from |translatorn= / |translator-lastn=, -firstn=, -linkn=, -maskn= | | t = extract_names (args, 'TranslatorList'); -- fetch translator list from |translatorn= / |translator-lastn=, -firstn=, -linkn=, -maskn= |
| | | | |
| | + | |
| | + | local interviewers_list = {}; |
| | local Interviewers = A['Interviewers'] | | local Interviewers = A['Interviewers'] |
| − | | + | if is_set (Interviewers) then -- add a maint cat if the |interviewers= is used |
| | + | add_maint_cat ('interviewers'); -- because use of this parameter is discouraged |
| | + | else |
| | + | interviewers_list = extract_names (args, 'InterviewerList'); -- else, process preferred interviewers parameters |
| | + | end |
| | + | |
| | local c = {}; -- contributors list from |contributor-lastn= / contributor-firstn= pairs | | local c = {}; -- contributors list from |contributor-lastn= / contributor-firstn= pairs |
| | local Contributors; -- assembled contributors name list | | local Contributors; -- assembled contributors name list |
| Line 2,184: |
Line 2,325: |
| | no_tracking_cats = nil; -- set to empty string | | no_tracking_cats = nil; -- set to empty string |
| | end | | end |
| − |
| |
| − | --these deprecated parameters are used by cite interview
| |
| − | local Callsign = A['Callsign'];
| |
| − | local City = A['City'];
| |
| − | local Program = A['Program'];
| |
| | | | |
| | --local variables that are not cs1 parameters | | --local variables that are not cs1 parameters |
| Line 2,302: |
Line 2,438: |
| | end | | end |
| | end | | end |
| − | end
| |
| − |
| |
| − | -- special case for cite interview
| |
| − | -- TODO: make cite interview not need any special cases
| |
| − | --[[
| |
| − | Program, Callsign, City deprecated, so avoid using /Configuration
| |
| − | for reassignment, which would allow these parameters' use outside interview
| |
| − | ]]
| |
| − | if (config.CitationClass == "interview") then
| |
| − | if is_set(Program) then
| |
| − | if not is_set(Periodical) then
| |
| − | Periodical = Program;
| |
| − | end
| |
| − | end
| |
| − | if is_set(Callsign) then
| |
| − | if not is_set(PublisherName) then
| |
| − | PublisherName = Callsign;
| |
| − | end
| |
| − | end
| |
| − | if is_set(City) then
| |
| − | if not is_set(PublicationPlace) then
| |
| − | PublicationPlace = City;
| |
| − | end
| |
| − | end
| |
| | end | | end |
| | | | |
| Line 2,441: |
Line 2,553: |
| | -- end of {{cite episode}} stuff | | -- end of {{cite episode}} stuff |
| | | | |
| − | -- Account for the oddities that are {{cite arxiv}}, before generation of COinS data. | + | -- Account for the oddities that are {{cite arxiv}}, {{cite biorxiv}}, {{cite citeseerx}}, before generation of COinS data. |
| − | if 'arxiv' == config.CitationClass then | + | do |
| − | if not is_set (ID_list['ARXIV']) then -- |arxiv= or |eprint= required for cite arxiv
| + | if in_array (config.CitationClass, {'arxiv', 'biorxiv', 'citeseerx'}) then |
| − | table.insert( z.message_tail, { set_error( 'arxiv_missing', {}, true ) } ); -- add error message
| + | if not is_set (ID_list[config.CitationClass:upper()]) then -- |arxiv= or |eprint= required for cite arxiv; |biorxiv= & |citeseerx= required for their templates |
| − | elseif is_set (Series) then -- series is an alias of version
| + | table.insert( z.message_tail, { set_error( config.CitationClass .. '_missing', {}, true ) } ); -- add error message |
| − | ID_list['ARXIV'] = ID_list['ARXIV'] .. Series; -- concatenate version onto the end of the arxiv identifier | + | end |
| − | Series = ''; -- unset
| + | |
| − | deprecated_parameter ('version'); -- deprecated parameter but only for cite arxiv
| + | if 'arxiv' == config.CitationClass then |
| − | end
| + | Periodical = 'arXiv'; -- set to arXiv for COinS; after that, must be set to empty string |
| − |
| + | end |
| − | if first_set ({AccessDate, At, Authors, Chapter, Format, Page, Pages, Periodical, PublisherName, URL, -- a crude list of parameters that are not supported by cite arxiv
| + | if 'biorxiv' == config.CitationClass then |
| − | ID_list['ASIN'], ID_list['BIBCODE'], ID_list['DOI'], ID_list['ISBN'], ID_list['ISSN'], -- TODO: find a better way to do this
| + | Periodical = 'bioRxiv'; -- set to bioRxiv for COinS; after that, must be set to empty string |
| − | ID_list['JFM'], ID_list['JSTOR'], ID_list['LCCN'], ID_list['MR'], ID_list['OCLC'], ID_list['OL'], | + | end |
| − | ID_list['OSTI'], ID_list['PMC'], ID_list['PMID'], ID_list['RFC'], ID_list['SSRN'], ID_list['USENETID'], ID_list['ZBL']},27) then | + | if 'citeseerx' == config.CitationClass then |
| − | table.insert( z.message_tail, { set_error( 'arxiv_params_not_supported', {}, true ) } ); -- add error message | + | Periodical = 'CiteSeerX'; -- set to CiteSeerX for COinS; after that, must be set to empty string |
| − | | + | end |
| − | AccessDate = ''; -- set these to empty string; not supported in cite arXiv
| |
| − | Authors = '';
| |
| − | PublisherName = ''; -- (if the article has been published, use cite journal, or other)
| |
| − | Chapter = '';
| |
| − | URL = '';
| |
| − | Format = '';
| |
| − | Page = ''; Pages = ''; At = ''; | |
| | end | | end |
| − | Periodical = 'arXiv'; -- set to arXiv for COinS; after that, must be set to empty string
| |
| | end | | end |
| | | | |
| Line 2,625: |
Line 2,729: |
| | | | |
| | -- Account for the oddities that are {{cite arxiv}}, AFTER generation of COinS data. | | -- Account for the oddities that are {{cite arxiv}}, AFTER generation of COinS data. |
| − | if 'arxiv' == config.CitationClass then -- we have set rft.jtitle in COinS to arXiv, now unset so it isn't displayed
| + | -- if 'arxiv' == config.CitationClass then -- we have set rft.jtitle in COinS to arXiv, now unset so it isn't displayed |
| − | Periodical = ''; -- periodical not allowed in cite arxiv; if article has been published, use cite journal | + | if in_array (config.CitationClass, {'arxiv', 'biorxiv', 'citeseerx'}) then -- we have set rft.jtitle in COinS to arXiv, bioRxiv, or CiteSeerX now unset so it isn't displayed |
| | + | Periodical = ''; -- periodical not allowed in these templates; if article has been published, use cite journal |
| | end | | end |
| | | | |
| Line 2,652: |
Line 2,757: |
| | }; | | }; |
| | | | |
| − | do -- do editor name list first because coauthors can modify control table | + | do -- do editor name list first because the now unsupported coauthors used to modify control table |
| | control.maximum , editor_etal = get_display_authors_editors (A['DisplayEditors'], #e, 'editors', editor_etal); | | control.maximum , editor_etal = get_display_authors_editors (A['DisplayEditors'], #e, 'editors', editor_etal); |
| | last_first_list, EditorCount = list_people(control, e, editor_etal); | | last_first_list, EditorCount = list_people(control, e, editor_etal); |
| Line 2,670: |
Line 2,775: |
| | EditorCount = 2; -- spoof to display (eds.) annotation | | EditorCount = 2; -- spoof to display (eds.) annotation |
| | end | | end |
| | + | end |
| | + | do -- now do interviewers |
| | + | control.maximum = #interviewers_list; -- number of interviewerss |
| | + | Interviewers = list_people(control, interviewers_list, false); -- et al not currently supported |
| | end | | end |
| | do -- now do translators | | do -- now do translators |
| Line 2,682: |
Line 2,791: |
| | control.maximum , author_etal = get_display_authors_editors (A['DisplayAuthors'], #a, 'authors', author_etal); | | control.maximum , author_etal = get_display_authors_editors (A['DisplayAuthors'], #a, 'authors', author_etal); |
| | | | |
| − | if is_set(Coauthors) then -- if the coauthor field is also used, prevent ampersand and et al. formatting.
| |
| − | control.lastauthoramp = nil;
| |
| − | control.maximum = #a + 1;
| |
| − | end
| |
| − |
| |
| | last_first_list = list_people(control, a, author_etal); | | last_first_list = list_people(control, a, author_etal); |
| | | | |
| Line 2,703: |
Line 2,807: |
| | end | | end |
| | | | |
| − | if not is_set(Authors) and is_set(Coauthors) then -- coauthors aren't displayed if one of authors=, authorn=, or lastn= isn't specified
| |
| − | table.insert( z.message_tail, { set_error('coauthors_missing_author', {}, true) } ); -- emit error message
| |
| − | end
| |
| | end | | end |
| | | | |
| Line 2,717: |
Line 2,818: |
| | | | |
| | -- special case for chapter format so no error message or cat when chapter not supported | | -- special case for chapter format so no error message or cat when chapter not supported |
| − | if not (in_array(config.CitationClass, {'web','news','journal', 'magazine', 'pressrelease','podcast', 'newsgroup', 'arxiv'}) or | + | if not (in_array(config.CitationClass, {'web', 'news', 'journal', 'magazine', 'pressrelease', 'podcast', 'newsgroup', 'arxiv', 'biorxiv', 'citeseerx'}) or |
| | ('citation' == config.CitationClass and is_set (Periodical) and not is_set (Encyclopedia))) then | | ('citation' == config.CitationClass and is_set (Periodical) and not is_set (Encyclopedia))) then |
| | ChapterFormat = style_format (ChapterFormat, ChapterURL, 'chapter-format', 'chapter-url'); | | ChapterFormat = style_format (ChapterFormat, ChapterURL, 'chapter-format', 'chapter-url'); |
| Line 2,760: |
Line 2,861: |
| | end | | end |
| | | | |
| − | if in_array(config.CitationClass, {'web','news','journal', 'magazine', 'pressrelease','podcast', 'newsgroup', 'arxiv'}) or -- if any of the 'periodical' cites except encyclopedia | + | if in_array(config.CitationClass, {'web','news','journal', 'magazine', 'pressrelease', 'podcast', 'newsgroup', 'arxiv', 'biorxiv', 'citeseerx'}) or -- if any of the 'periodical' cites except encyclopedia |
| | ('citation' == config.CitationClass and is_set (Periodical) and not is_set (Encyclopedia)) then | | ('citation' == config.CitationClass and is_set (Periodical) and not is_set (Encyclopedia)) then |
| | local chap_param; | | local chap_param; |
| Line 2,808: |
Line 2,909: |
| | end | | end |
| | | | |
| − | if in_array(config.CitationClass, {'web','news','journal', 'magazine', 'pressrelease','podcast', 'newsgroup', 'mailinglist', 'arxiv', 'interview'}) or | + | if in_array(config.CitationClass, {'web', 'news', 'journal', 'magazine', 'pressrelease', 'podcast', 'newsgroup', 'mailinglist', 'interview', 'arxiv', 'biorxiv', 'citeseerx'}) or |
| | ('citation' == config.CitationClass and is_set (Periodical) and not is_set (Encyclopedia)) or | | ('citation' == config.CitationClass and is_set (Periodical) and not is_set (Encyclopedia)) or |
| | ('map' == config.CitationClass and is_set (Periodical)) then -- special case for cite map when the map is in a periodical treat as an article | | ('map' == config.CitationClass and is_set (Periodical)) then -- special case for cite map when the map is in a periodical treat as an article |
| Line 2,832: |
Line 2,933: |
| | end | | end |
| | end | | end |
| − |
| |
| − | Title = Title .. TransTitle;
| |
| | | | |
| | if is_set(Title) then | | if is_set(Title) then |
| | if not is_set(TitleLink) and is_set(URL) then | | if not is_set(TitleLink) and is_set(URL) then |
| | | | |
| − | Title = external_link( URL, Title, URLorigin, UrlAccess ) .. TransError .. Format; | + | Title = external_link( URL, Title, URLorigin, UrlAccess ) .. TransTitle .. TransError .. Format; |
| | -- this experiment hidden 2016-04-10; see Help_talk:Citation_Style_1#Recycled_urls | | -- this experiment hidden 2016-04-10; see Help_talk:Citation_Style_1#Recycled_urls |
| | -- local temp_title = external_link( URL, Title, URLorigin ) .. TransError .. Format; -- do this so we get error message even if url is usurped no archive | | -- local temp_title = external_link( URL, Title, URLorigin ) .. TransError .. Format; -- do this so we get error message even if url is usurped no archive |
| Line 2,854: |
Line 2,953: |
| | Format = ""; | | Format = ""; |
| | else | | else |
| − | Title = Title .. TransError; | + | Title = Title .. TransTitle .. TransError; |
| | end | | end |
| | end | | end |
| Line 3,006: |
Line 3,105: |
| | | | |
| | if is_set(URL) then | | if is_set(URL) then |
| − | URL = " " .. external_link( URL, nil, URLorigin, Access ); | + | URL = " " .. external_link( URL, nil, URLorigin, UrlAccess ); |
| | end | | end |
| | | | |
| Line 3,201: |
Line 3,300: |
| | end | | end |
| | if is_set(Authors) then | | if is_set(Authors) then |
| − | if is_set(Coauthors) then
| |
| − | if 'vanc' == NameListFormat then -- separate authors and coauthors with proper name-list-separator
| |
| − | Authors = Authors .. ', ' .. Coauthors;
| |
| − | else
| |
| − | Authors = Authors .. '; ' .. Coauthors;
| |
| − | end
| |
| − | end
| |
| | if (not is_set (Date)) or ('mla' == Mode) then -- when date is set it's in parentheses; no Authors termination | | if (not is_set (Date)) or ('mla' == Mode) then -- when date is set it's in parentheses; no Authors termination |
| | Authors = terminate_name_list (Authors, sepc); -- when no date, terminate with 0 or 1 sepc and a space | | Authors = terminate_name_list (Authors, sepc); -- when no date, terminate with 0 or 1 sepc and a space |
| Line 3,236: |
Line 3,328: |
| | if (sepc ~= '.') then by_text = by_text:lower() end -- lowercase for cs2 | | if (sepc ~= '.') then by_text = by_text:lower() end -- lowercase for cs2 |
| | Authors = by_text .. Authors; -- author follows title so tweak it here | | Authors = by_text .. Authors; -- author follows title so tweak it here |
| − | if is_set (Editors) and ('mla' ~= Mode)then -- when Editors make sure that Authors gets terminated | + | if is_set (Editors) and is_set (Date) and ('mla' ~= Mode) then -- when Editors make sure that Authors gets terminated |
| | Authors = terminate_name_list (Authors, sepc); -- terminate with 0 or 1 sepc and a space | | Authors = terminate_name_list (Authors, sepc); -- terminate with 0 or 1 sepc and a space |
| | end | | end |
| Line 3,357: |
Line 3,449: |
| | | | |
| | if #z.maintenance_cats ~= 0 then | | if #z.maintenance_cats ~= 0 then |
| − | text = text .. '<span class="citation-comment" style="display:none; color:#33aa33">'; | + | text = text .. '<span class="citation-comment" style="display:none; color:#33aa33; margin-left:0.3em">'; |
| | for _, v in ipairs( z.maintenance_cats ) do -- append maintenance categories | | for _, v in ipairs( z.maintenance_cats ) do -- append maintenance categories |
| − | text = text .. ' ' .. v .. ' ([[:Category:' .. v ..'|link]])'; | + | text = text .. v .. ' ([[:Category:' .. v ..'|link]])'; |
| | end | | end |
| − | text = text .. '</span>'; -- maintenance mesages (realy just the names of the categories for now) | + | text = text .. '</span>'; -- maintenance mesages (realy just the names of the categories for now) |
| | end | | end |
| | | | |
| Line 3,379: |
Line 3,471: |
| | return text | | return text |
| | end | | end |
| | + | |
| | | | |
| | --[[--------------------------< C S 1 . C I T A T I O N >------------------------------------------------------ | | --[[--------------------------< C S 1 . C I T A T I O N >------------------------------------------------------ |
| Line 3,431: |
Line 3,524: |
| | z = utilities.z; -- table of error and category tables in Module:Citation/CS1/Utilities | | z = utilities.z; -- table of error and category tables in Module:Citation/CS1/Utilities |
| | | | |
| − | extract_ids = identifiers.extract_ids; -- imported functions from Module:Citation/CS1/Utilities | + | extract_ids = identifiers.extract_ids; -- imported functions from Module:Citation/CS1/Identifiers |
| | build_id_list = identifiers.build_id_list; | | build_id_list = identifiers.build_id_list; |
| | is_embargoed = identifiers.is_embargoed; | | is_embargoed = identifiers.is_embargoed; |
| Line 3,440: |
Line 3,533: |
| | COinS = metadata.COinS; | | COinS = metadata.COinS; |
| | | | |
| − | local args = {}; | + | local args = {}; -- table where we store all of the template's arguments |
| − | local suggestions = {}; | + | local suggestions = {}; -- table where we store suggestions if we need to loadData them |
| | local error_text, error_state; | | local error_text, error_state; |
| | | | |
| − | local config = {}; | + | local config = {}; -- table to store parameters from the module {{#invoke:}} |
| | for k, v in pairs( frame.args ) do | | for k, v in pairs( frame.args ) do |
| | config[k] = v; | | config[k] = v; |
| − | args[k] = v;
| + | -- args[k] = v; -- debug tool that allows us to render a citation from module {{#invoke:}} |
| | end | | end |
| | | | |
| Line 3,453: |
Line 3,546: |
| | for k, v in pairs( pframe.args ) do | | for k, v in pairs( pframe.args ) do |
| | if v ~= '' then | | if v ~= '' then |
| − | if not validate( k ) then | + | if not validate( k, config.CitationClass ) then |
| | error_text = ""; | | error_text = ""; |
| | if type( k ) ~= 'string' then | | if type( k ) ~= 'string' then |
| Line 3,460: |
Line 3,553: |
| | error_text, error_state = set_error( 'text_ignored', {v}, true ); | | error_text, error_state = set_error( 'text_ignored', {v}, true ); |
| | end | | end |
| − | elseif validate( k:lower() ) then | + | elseif validate( k:lower(), config.CitationClass ) then |
| | error_text, error_state = set_error( 'parameter_ignored_suggest', {k, k:lower()}, true ); | | error_text, error_state = set_error( 'parameter_ignored_suggest', {k, k:lower()}, true ); |
| | else | | else |
| Line 3,482: |
Line 3,575: |
| | else | | else |
| | error_text, error_state = set_error( 'parameter_ignored', {k}, true ); | | error_text, error_state = set_error( 'parameter_ignored', {k}, true ); |
| | + | v = ''; -- unset value assigned to unrecognized parameters (this for the limited parameter lists) |
| | end | | end |
| | end | | end |