Module:Citation/CS1: திருத்தங்களுக்கு இடையிலான வேறுபாடு

உள்ளடக்கம் நீக்கப்பட்டது உள்ளடக்கம் சேர்க்கப்பட்டது
imported>Sukanthi
No edit summary
சிNo edit summary
வரிசை 28:
local added_vanc_errs; -- Boolean flag so we only emit one Vancouver error / category
local added_generic_name_errs; -- Boolean flag so we only emit one generic name error / category and stop testing names once an error is encountered
local added_numeric_name_errs; -- Boolean flag so we only emit one numeric name error / category and stop testing names once an error is encountered
local added_numeric_name_maint; -- Boolean flag so we only emit one numeric name maint category and stop testing names once a category has been emitted
local Frame; -- holds the module's frame table
local is_preview_mode; -- true when article is in preview mode; false when using 'Preview page with this template' (previewing the module)
வரி 1,383 ⟶ 1,385:
--[[---------------------< N A M E _ I S _ N U M E R I C >----------------------
 
Add maintan caterror message and category when <name> parameter value does not contain letters. Does not catch
 
mixed alphanumeric names so |last=A. Green (1922-1987) does not get caught in the
Add a maintenance category when <name> parameter value has numeric characters mixed with characters that are
current version of this test but |first=(1888) is caught.
not numeric characters; could be letters and/or punctuation characters.
 
This function will only emit one error and one maint message for the current template. Does not emit both error
and maint messages/categories for the same parameter value.
 
returns nothing
வரி 1,391 ⟶ 1,397:
]]
 
local function name_is_numeric (name, name_alias, list_name)
local patterns = {
if utilities.is_set (name) then
if mw.ustring.match (name, '^[%A]D+$%d') then, -- when <name> must have doesdigits notpreceded containby anyother letterscharacters
'^%D*%d+%D+', -- <name> must have digits followed by other characters
utilities.set_message ('maint_numeric_names', cfg.special_case_translation [list_name]); -- add a maint cat for this template
}
 
if not added_numeric_name_errs and mw.ustring.match (name, '^[%A]+$') then -- if we have not already set an error message and <name> does not have any alpha characters
utilities.set_message ('err_numeric_names', name_alias); -- add an error message
added_numeric_name_errs = true; -- set the flag so we emit only one error message
return; -- when here no point in further testing; abandon
end
 
if not added_numeric_name_maint then -- if we have already set a maint message
for _, pattern in ipairs (patterns) do -- spin through list of patterns
if mw.ustring.match (name, pattern) then -- digits preceded or followed by anything but digits; %D+ includes punctuation
utilities.set_message ('maint_numeric_names', cfg.special_case_translation [list_name]); -- add a maint cat for this template
added_numeric_name_maint = true; -- set the flag so we emit only one maint message
return; -- when here no point in further testing; abandon
end
end
end
வரி 1,531 ⟶ 1,552:
if not accept_name then -- <last> not wrapped in accept-as-written markup
name_has_mult_names (last, list_name); -- check for multiple names in the parameter
name_is_numeric (last, last_alias, list_name); -- check for names that have no letters or are composeda mix of digits and punctuationother characters
name_is_generic (last, last_alias); -- check for names found in the generic names list
end
வரி 1,541 ⟶ 1,562:
if not accept_name then -- <first> not wrapped in accept-as-written markup
name_has_mult_names (first, list_name, 0); -- check for multiple names in the parameter; 0 is number of allowed commas in a given name
name_is_numeric (first, first_alias, list_name); -- check for names that have no letters or are composeda mix of digits and punctuationother characters
name_is_generic (first, first_alias); -- check for names found in the generic names list
end
வரி 1,674 ⟶ 1,695:
name = cfg.lang_tag_remap[lang_param_lc]; -- assume <lang_param_lc> is a tag; attempt to get remapped language name
if name then -- when <name>, <lang_param> is a tag for a remapped language name
if cfg.lang_name_remap[name:lower()][2] ~= lang_param_lc then
utilities.set_message ('maint_unknown_lang'); -- add maint category if not already added
return name, cfg.lang_name_remap[name:lower()][2]; -- so return name and tag from lang_name_remap[name]; special case to xlate sr-ec and sr-el to sr-cyrl and sr-latn
end
return name, lang_param_lc; -- so return <name> from remap and <lang_param_lc>
end
 
tag = lang_param_lc:match ('^(%a%a%a?)%-.*'); -- still assuming that <lang_param_lc> is a tag; strip script, region, variant subtags
name = cfg.lang_tag_remap[tag]; -- attempt to get remapped language name with language subtag only
if name then -- when <name>, <tag> is a tag for a remapped language name
return name, tag; -- so return <name> from remap and <tag>
end
 
if cfg.lang_name_remap[lang_param_lc] then -- not a remapped tag, assume <lang_param_lc> is a name; attempt to get remapped language tag
return cfg.lang_name_remap[lang_param_lc][1], cfg.lang_name_remap[lang_param_lc][2]; -- for this <lang_param_lc>, return a (possibly) new name and appropriate tag
end
 
tag = cfg.mw_languages_by_name_t[lang_param_lc]; -- assume that <lang_param_lc> is a language name; attempt to get its matching tag
if tag then
return cfg.mw_languages_by_tag_t[tag], tag; -- <lang_param_lc> is a name so return the name from the table and <tag>
end
 
வரி 1,699 ⟶ 1,718:
end
tag = cfg.mw_languages_by_name_t[lang_param_lc]; -- assume that <lang_param_lc> is a language name; attempt to get its matching tag
if tag then
return cfg.mw_languages_by_tag_t[tag], tag; -- <lang_param_lc> is a name so return the name from the table and <tag>
end
 
tag = lang_param_lc:match ('^(%a%a%a?)%-.*'); -- is <lang_param_lc> an IETF-like tag that MediaWiki doesn't recognize? <tag> gets the language subtag; nil else
 
வரி 2,524 ⟶ 2,549:
return true;
end
end
end
 
 
--[[--------------------------< D I S P L A Y _ N A M E S _ S E L E C T >--------------------------------------
 
for any of the |display-authors=, |display-editors=, etc parameters, select either the local or global setting.
When both are present, look at <local_display_names> value. When the value is some sort of 'et al.'string,
special handling is required.
 
When {{cs1 config}} has |display-<namelist>= AND this template has |display-<namelist>=etal AND:
the number of names specified by <number_of_names> is:
greater than the number specified in the global |display-<namelist>= parameter (<global_display_names>)
use global |display-<namelist>= parameter value
set overridden maint category
less than or equal to the number specified in the global |display-<namelist>= parameter
use local |display-<namelist>= parameter value
 
The purpose of this function is to prevent categorizing a template that has fewer names than the global setting
to keep the etal annotation specified by <local_display_names>.
 
]]
 
local function display_names_select (global_display_names, local_display_names, param_name, number_of_names, test)
if global_display_names and utilities.is_set (local_display_names) then -- when both
if 'etal' == local_display_names:lower():gsub("[ '%.]", '') then -- the :gsub() portion makes 'etal' from a variety of 'et al.' spellings and stylings
number_of_names = tonumber (number_of_names); -- convert these to numbers for comparison
local global_display_names_num = tonumber (global_display_names); -- <global_display_names> not set when parameter value is not digits
 
if number_of_names > global_display_names_num then -- template has more names than global config allows to be displayed?
utilities.set_message ('maint_overridden_setting'); -- set a maint message because global is overriding local |display-<namelist>=etal
return global_display_names, 'cs1 config'; -- return global with spoof parameter name (for get_display_names())
else
return local_display_names, param_name; -- return local because fewer names so let <local_display_names> control
end
end
-- here when <global_display_names> and <local_display_names> both numbers; <global_display_names> controls
utilities.set_message ('maint_overridden_setting'); -- set a maint message
return global_display_names, 'cs1 config'; -- return global with spoof parameter name (for get_display_names())
end
-- here when only one of <global_display_names> or <local_display_names> set
if global_display_names then
return global_display_names, 'cs1 config'; -- return global with spoof parameter name (for get_display_names())
else
return local_display_names, param_name; -- return local
end
end
வரி 2,569 ⟶ 2,639:
a, author_etal = parse_vauthors_veditors (args, A['Vauthors'], 'AuthorList'); -- fetch author list from |vauthors=, |author-linkn=, and |author-maskn=
elseif 3 == selected then
Authors = A['Authors']; -- use content of |people= or |credits=; |authors= is deprecated; TODO: constrain |people= and |credits= to cite av media, episode, serial?
if 'authors' == A:ORIGIN('Authors') then -- but add a maint cat if the parameter is |authors=
utilities.set_message ('maint_authors'); -- because use of this parameter is discouraged; what to do about the aliases is a TODO:
end
end
if utilities.is_set (Collaboration) then
வரி 2,646 ⟶ 2,713:
local TransPeriodical_origin = A:ORIGIN ('TransPeriodical');
if (utilities.in_array (config.CitationClass, {'book', 'encyclopaedia'}) and (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical) or utilities.is_set (ScriptPeriodicalTransPeriodical))) then
local param;
if utilities.is_set (Periodical) then -- get a parameter name from one of these periodical related meta-parameters
Periodical = nil''; -- unset because not valid {{cite book}} or {{cite encyclopedia}} parameters
param = Periodical_origin -- get parameter name for error messaging
elseif utilities.is_set (TransPeriodical) then
TransPeriodical = nil''; -- unset because not valid {{cite book}} or {{cite encyclopedia}} parameters
param = TransPeriodical_origin; -- get parameter name for error messaging
elseif utilities.is_set (ScriptPeriodical) then
ScriptPeriodical = nil''; -- unset because not valid {{cite book}} or {{cite encyclopedia}} parameters
param = ScriptPeriodical_origin; -- get parameter name for error messaging
end
வரி 2,692 ⟶ 2,759:
local Volume;
-- local ScriptPeriodical_origin = A:ORIGIN('ScriptPeriodical');
if 'citation' == config.CitationClass then
if utilities.is_set (Periodical) then
வரி 3,109 ⟶ 3,175:
 
local AccessDate = A['AccessDate'];
-- local LayDate = A['LayDate'];
local COinS_date = {}; -- holds date info extracted from |date= for the COinS metadata by Module:Date verification
local DoiBroken = A['DoiBroken'];
வரி 3,123 ⟶ 3,188:
['doi-broken-date'] = {val = DoiBroken, name = A:ORIGIN ('DoiBroken')},
['pmc-embargo-date'] = {val = Embargo, name = A:ORIGIN ('Embargo')},
-- ['lay-date'] = {val = LayDate, name = A:ORIGIN ('LayDate')},
['publication-date'] = {val = PublicationDate, name = A:ORIGIN ('PublicationDate')},
['year'] = {val = Year, name = A:ORIGIN ('Year')},
வரி 3,164 ⟶ 3,228:
Date = date_parameters_list['date'].val;
DoiBroken = date_parameters_list['doi-broken-date'].val;
-- LayDate = date_parameters_list['lay-date'].val;
PublicationDate = date_parameters_list['publication-date'].val;
end
 
if archive_url_timestamp and utilities.is_set (ArchiveDate) then
validation.archive_date_check (ArchiveDate, archive_url_timestamp, DF); -- does YYYYMMDD in archive_url_timestamp match date in ArchiveDate
end
else
வரி 3,336 ⟶ 3,399:
 
do -- do editor name list first because the now unsupported coauthors used to modify control table
iflocal display_names, param = display_names_select (cfg.global_cs1_config_t['DisplayEditors'], then --A['DisplayEditors'], globalA:ORIGIN setting from {{cs1 config}} overrides local('DisplayEditors'), setting#e);
control.maximum , editor_etal = get_display_names (cfg.global_cs1_config_t['DisplayEditors']display_names, #e, 'editors', editor_etal, 'cs1 config'param);
else
control.maximum , editor_etal = get_display_names (A['DisplayEditors'], #e, 'editors', editor_etal, A:ORIGIN ('DisplayEditors'));
end
 
if cfg.global_cs1_config_t['DisplayEditors'] and utilities.is_set (A['DisplayEditors']) then -- when template has |display-editors=<something> which global setting has overridden
utilities.set_message ('maint_overridden_setting'); -- set a maint message
end
 
Editors, EditorCount = list_people (control, e, editor_etal);
வரி 3,353 ⟶ 3,409:
end
do -- now do interviewers
iflocal display_names, param = display_names_select (cfg.global_cs1_config_t['DisplayInterviewers'], then --A['DisplayInterviewers'], globalA:ORIGIN setting from {{cs1 config}} overrides local('DisplayInterviewers'), setting#interviewers_list);
control.maximum, interviewer_etal = get_display_names (cfg.global_cs1_config_t['DisplayInterviewers']display_names, #interviewers_list, 'interviewers', interviewer_etal, 'cs1 config'param);
else
control.maximum, interviewer_etal = get_display_names (A['DisplayInterviewers'], #interviewers_list, 'interviewers', interviewer_etal, A:ORIGIN ('DisplayInterviewers'));
end
 
if cfg.global_cs1_config_t['DisplayInterviewers'] and utilities.is_set (A['DisplayInterviewers']) then -- when template has |display-interviewers=<something> which global setting has overridden
utilities.set_message ('maint_overridden_setting'); -- set a maint message
end
 
Interviewers = list_people (control, interviewers_list, interviewer_etal);
end
do -- now do translators
iflocal display_names, param = display_names_select (cfg.global_cs1_config_t['DisplayTranslators'], then --A['DisplayTranslators'], globalA:ORIGIN setting from {{cs1 config}} overrides local('DisplayTranslators'), setting#t);
control.maximum, translator_etal = get_display_names (cfg.global_cs1_config_t['DisplayTranslators']display_names, #t, 'translators', translator_etal, 'cs1 config'param);
else
control.maximum, translator_etal = get_display_names (A['DisplayTranslators'], #t, 'translators', translator_etal, A:ORIGIN ('DisplayTranslators'));
end
 
if cfg.global_cs1_config_t['DisplayTranslators'] and utilities.is_set (A['DisplayTranslators']) then -- when template has |display-translators=<something> which global setting has overridden
utilities.set_message ('maint_overridden_setting'); -- set a maint message
end
 
Translators = list_people (control, t, translator_etal);
end
do -- now do contributors
iflocal display_names, param = display_names_select (cfg.global_cs1_config_t['DisplayContributors'], then --A['DisplayContributors'], globalA:ORIGIN setting from {{cs1 config}} overrides local('DisplayContributors'), setting#c);
control.maximum, contributor_etal = get_display_names (cfg.global_cs1_config_t['DisplayContributors']display_names, #c, 'contributors', contributor_etal, 'cs1 config'param);
else
control.maximum, contributor_etal = get_display_names (A['DisplayContributors'], #c, 'contributors', contributor_etal, A:ORIGIN ('DisplayContributors'));
end
 
if cfg.global_cs1_config_t['DisplayContributors'] and utilities.is_set (A['DisplayContributors']) then -- when template has |display-contributors=<something> which global setting has overridden
utilities.set_message ('maint_overridden_setting'); -- set a maint message
end
 
Contributors = list_people (control, c, contributor_etal);
end
do -- now do authors
iflocal display_names, param = display_names_select (cfg.global_cs1_config_t['DisplayAuthors'], then --A['DisplayAuthors'], globalA:ORIGIN setting from('DisplayAuthors'), {{cs1 config}} overrides local#a, settingauthor_etal);
control.maximum, author_etal = get_display_names (cfg.global_cs1_config_t['DisplayAuthors']display_names, #a, 'authors', author_etal, 'cs1 config'param);
else
control.maximum, author_etal = get_display_names (A['DisplayAuthors'], #a, 'authors', author_etal, A:ORIGIN ('DisplayAuthors'));
end
 
if cfg.global_cs1_config_t['DisplayAuthors'] and utilities.is_set (A['DisplayAuthors']) then -- when template has |display-authors=<something> which global setting has overridden
utilities.set_message ('maint_overridden_setting'); -- set a maint message
end
 
last_first_list = list_people (control, a, author_etal);
வரி 3,810 ⟶ 3,838:
if utilities.is_set (ArchiveURL) then
local arch_text;
-- if not utilities.is_set (ArchiveDate) then
-- utilities.set_message ('err_archive_missing_date');
-- ArchiveDate = ''; -- empty string for concatenation
-- end
if "live" == UrlStatus then
arch_text = cfg.messages['பரணிடப்பட்டதுarchived'];
if sepc ~= "." then arch_text = arch_text:lower() end
if utilities.is_set (ArchiveDate) then
வரி 3,857 ⟶ 3,881:
end
-- local Lay = '';
-- local LaySource = A['LaySource'];
-- local LayURL = A['LayURL'];
-- local LayFormat = A['LayFormat'];
-- LayFormat = style_format (LayFormat, LayURL, 'lay-format', 'lay-url');
-- if utilities.is_set (LayURL) then
-- if utilities.is_set (LayDate) then LayDate = " (" .. LayDate .. ")" end
-- if utilities.is_set (LaySource) then
-- LaySource = " &ndash; ''" .. utilities.safe_for_italics (LaySource) .. "''";
-- else
-- LaySource = "";
-- end
-- if sepc == '.' then
-- Lay = sepc .. " " .. external_link( LayURL, cfg.messages['lay summary'], A:ORIGIN('LayURL'), nil ) .. LayFormat .. LaySource .. LayDate
-- else
-- Lay = sepc .. " " .. external_link( LayURL, cfg.messages['lay summary']:lower(), A:ORIGIN('LayURL'), nil ) .. LayFormat .. LaySource .. LayDate
-- end
-- elseif utilities.is_set (LayFormat) then -- Test if |lay-format= is given without giving a |lay-url=
-- Lay = sepc .. LayFormat; -- if set and LayURL not set, then LayFormat has error message
-- end
 
local TranscriptURL = A['TranscriptURL']
local TranscriptFormat = A['TranscriptFormat'];
வரி 3,990 ⟶ 3,993:
local idcommon;
if 'audio-visual' == config.CitationClass or 'episode' == config.CitationClass then -- special case for cite AV media & cite episode position transcript
-- idcommon = safe_join( { ID_list, URL, Archived, Transcript, AccessDate, Via, Lay, Quote }, sepc );
idcommon = safe_join( { ID_list, URL, Archived, Transcript, AccessDate, Via, Quote }, sepc );
else
-- idcommon = safe_join( { ID_list, URL, Archived, AccessDate, Via, Lay, Quote }, sepc );
idcommon = safe_join( { ID_list, URL, Archived, AccessDate, Via, Quote }, sepc );
end
வரி 4,168 ⟶ 4,169:
 
if not no_tracking_cats then
local sort_key;
local cat_wikilink = 'cat wikilink';
if cfg.enable_sort_keys then -- when namespace sort keys enabled
local namespace_number = mw.title.getCurrentTitle().namespace; -- get namespace number for this wikitext
sort_key = (0 ~= namespace_number and (cfg.name_space_sort_keys[namespace_number] or cfg.name_space_sort_keys.other)) or nil; -- get sort key character; nil for mainspace
cat_wikilink = (not sort_key and 'cat wikilink') or 'cat wikilink sk'; -- make <cfg.messages> key
end
 
for _, v in ipairs (z.error_cats_t) do -- append error categories
table.insert (render_t, utilities.substitute (cfg.messages['cat wikilink'cat_wikilink], {v, sort_key}));
end
for _, v in ipairs (z.maint_cats_t) do -- append maintenance categories
table.insert (render_t, utilities.substitute (cfg.messages['cat wikilink'cat_wikilink], {v, sort_key}));
end
 
for _, v in ipairs (z.prop_cats_t) do -- append properties categories
table.insert (render_t, utilities.substitute (cfg.messages['cat wikilink'], v)); -- no sort keys
end
end
"https://tamilar.wiki/w/Module:Citation/CS1" இலிருந்து மீள்விக்கப்பட்டது