Module:Citation/CS1: Difference between revisions
From Vigyanwiki
m (1 revision imported) |
m (1 revision imported) |
||
| (3 intermediate revisions by 3 users not shown) | |||
| Line 1: | Line 1: | ||
require('strict'); | require ('strict'); | ||
--[[--------------------------< 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 533: | Line 533: | ||
end | end | ||
-- if we get this far we have prefix and script | -- if we get this far we have prefix and script | ||
name = cfg. | name = cfg.lang_tag_remap[lang] or mw.language.fetchLanguageName( lang, cfg.this_wiki_code ); -- get language name so that we can use it to categorize | ||
if utilities.is_set (name) then -- is prefix a proper ISO 639-1 language code? | if utilities.is_set (name) then -- is prefix a proper ISO 639-1 language code? | ||
script_value = script_value:gsub ('^%l+%s*:%s*', ''); -- strip prefix from script | script_value = script_value:gsub ('^%l+%s*:%s*', ''); -- strip prefix from script | ||
| Line 1,260: | Line 1,260: | ||
end | end | ||
if tag then | if tag then | ||
local lang = cfg. | local lang = cfg.lang_tag_remap[tag] or cfg.mw_languages_by_tag_t[tag]; | ||
if lang then -- error messaging done in extract_names() where we know parameter names | if lang then -- error messaging done in extract_names() where we know parameter names | ||
one = one .. utilities.wrap_style ('interwiki', lang); -- add resized leading space, brackets, static text, language name | one = one .. utilities.wrap_style ('interwiki', lang); -- add resized leading space, brackets, static text, language name | ||
| Line 1,290: | Line 1,290: | ||
local result = table.concat (name_list); -- construct list | local result = table.concat (name_list); -- construct list | ||
if etal and utilities.is_set (result) then -- etal may be set by |display-authors=etal but we might not have a last-first list | if etal and utilities.is_set (result) then -- etal may be set by |display-authors=etal but we might not have a last-first list | ||
result = result .. sep | result = result .. sep .. cfg.messages['et al']; -- we've got a last-first list and etal so add et al. | ||
end | end | ||
| Line 1,406: | Line 1,406: | ||
semicolons. Escaped semicolons are ones used as part of selected HTML entities. | semicolons. Escaped semicolons are ones used as part of selected HTML entities. | ||
If the condition is met, the function adds the multiple name maintenance category. | If the condition is met, the function adds the multiple name maintenance category. | ||
Same test for first except that commas should not appear in given names (MOS:JR says | |||
that the generational suffix does not take a separator character). Titles, degrees, | |||
postnominals, affiliations, all normally comma separated don't belong in a citation. | |||
<name> – name parameter value | |||
<list_name> – AuthorList, EditorList, etc | |||
<limit> – number of allowed commas; 1 (default) for surnames; 0 for given names | |||
returns nothing | returns nothing | ||
| Line 1,411: | Line 1,419: | ||
]] | ]] | ||
local function name_has_mult_names (name, list_name) | local function name_has_mult_names (name, list_name, limit) | ||
local _, commas, semicolons, nbsps; | local _, commas, semicolons, nbsps; | ||
limit = limit and limit or 1; | |||
if utilities.is_set (name) then | if utilities.is_set (name) then | ||
_, commas = name:gsub (',', ''); -- count the number of commas | _, commas = name:gsub (',', ''); -- count the number of commas | ||
| Line 1,426: | Line 1,435: | ||
-- from semicolons to 'escape' them. If additional entities are added, | -- from semicolons to 'escape' them. If additional entities are added, | ||
-- they also can be subtracted. | -- they also can be subtracted. | ||
if | if limit < commas or 0 < (semicolons - nbsps) then | ||
utilities.set_message ('maint_mult_names', cfg.special_case_translation [list_name]); -- add a maint message | utilities.set_message ('maint_mult_names', cfg.special_case_translation [list_name]); -- add a maint message | ||
end | end | ||
| Line 1,521: | Line 1,530: | ||
if not accept_name then -- <last> not wrapped in accept-as-written markup | 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_has_mult_names (last, list_name); -- check for multiple names in the parameter | ||
name_is_numeric (last, list_name); -- check for names that are composed of digits and punctuation | name_is_numeric (last, list_name); -- check for names that are composed of digits and punctuation | ||
name_is_generic (last, last_alias); -- check for names found in the generic names list | name_is_generic (last, last_alias); -- check for names found in the generic names list | ||
| Line 1,531: | Line 1,540: | ||
if not accept_name then -- <first> not wrapped in accept-as-written markup | 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, list_name); -- check for names that are composed of digits and punctuation | name_is_numeric (first, list_name); -- check for names that are composed of digits and punctuation | ||
name_is_generic (first, first_alias); -- check for names found in the generic names list | name_is_generic (first, first_alias); -- check for names found in the generic names list | ||
| Line 1,644: | Line 1,654: | ||
This function looks for: | This function looks for: | ||
<lang_param> as a tag in cfg. | <lang_param> as a tag in cfg.lang_tag_remap{} | ||
<lang_param> as a name in cfg.lang_name_remap{} | <lang_param> as a name in cfg.lang_name_remap{} | ||
| Line 1,662: | Line 1,672: | ||
local tag; | local tag; | ||
name = cfg. | 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 name then -- when <name>, <lang_param> is a tag for a remapped language name | ||
return name, lang_param_lc; -- so return <name> from remap and <lang_param_lc> | return name, lang_param_lc; -- so return <name> from remap and <lang_param_lc> | ||
| Line 1,668: | Line 1,678: | ||
tag = lang_param_lc:match ('^(%a%a%a?)%-.*'); -- still assuming that <lang_param_lc> is a tag; strip script, region, variant subtags | tag = lang_param_lc:match ('^(%a%a%a?)%-.*'); -- still assuming that <lang_param_lc> is a tag; strip script, region, variant subtags | ||
name = cfg. | 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 | if name then -- when <name>, <tag> is a tag for a remapped language name | ||
return name, tag; -- so return <name> from remap and <tag> | return name, tag; -- so return <name> from remap and <tag> | ||
| Line 1,879: | Line 1,889: | ||
inputs: | inputs: | ||
max: A['DisplayAuthors'] or A['DisplayEditors']; a number or some flavor of etal | max: A['DisplayAuthors'] or A['DisplayEditors'], etc; a number or some flavor of etal | ||
count: #a or #e | count: #a or #e | ||
list_name: 'authors' or 'editors' | list_name: 'authors' or 'editors' | ||
etal: author_etal or editor_etal | etal: author_etal or editor_etal | ||
This function sets an error message when |display-xxxxors= value greater than or equal to number of names but | |||
not when <max> comes from {{cs1 config}} global settings. When using global settings, <param> is set to the | |||
keyword 'cs1 config' which is used to supress the normal error. Error is suppressed because it is to be expected | |||
that some citations in an article will have the same or fewer names that the limit specified in {{cs1 config}}. | |||
]] | ]] | ||
| Line 1,893: | Line 1,908: | ||
elseif max:match ('^%d+$') then -- if is a string of numbers | elseif max:match ('^%d+$') then -- if is a string of numbers | ||
max = tonumber (max); -- make it a number | max = tonumber (max); -- make it a number | ||
if max >= count then | if (max >= count) and ('cs1 config' ~= param) then -- error when local |display-xxxxors= value greater than or equal to number of names; not an error when using global setting | ||
utilities.set_message ('err_disp_name', {param, max}); -- add error message | utilities.set_message ('err_disp_name', {param, max}); -- add error message | ||
max = nil; | max = nil; | ||
end | end | ||
else -- not a valid keyword or number | else -- not a valid keyword or number | ||
utilities.set_message ('err_disp_name', {param, max}); | utilities.set_message ('err_disp_name', {param, max}); -- add error message | ||
max = nil; -- unset; as if |display-xxxxors= had not been set | max = nil; -- unset; as if |display-xxxxors= had not been set | ||
end | end | ||
| Line 2,414: | Line 2,429: | ||
for timestamp errors when the timestamp has a wildcard, return the URL unmodified | for timestamp errors when the timestamp has a wildcard, return the URL unmodified | ||
for timestamp errors when the timestamp does not have a wildcard, return with timestamp limited to six digits plus wildcard (/yyyymm*/) | for timestamp errors when the timestamp does not have a wildcard, return with timestamp limited to six digits plus wildcard (/yyyymm*/) | ||
A secondary function is to return an archive-url timestamp from those urls that have them (archive.org and | |||
archive.today). The timestamp is used by validation.archive_date_check() to see if the value in |archive-date= | |||
matches the timestamp in the archive url. | |||
]=] | ]=] | ||
| Line 2,421: | Line 2,440: | ||
local path, timestamp, flag; -- portions of the archive.org URL | local path, timestamp, flag; -- portions of the archive.org URL | ||
timestamp = url:match ('//archive.today/(%d%d%d%d%d%d%d%d%d%d%d%d%d%d)/'); -- get timestamp from archive.today urls | |||
if timestamp then -- if this was an archive.today url ... | |||
return url, date, timestamp; -- return ArchiveURL, ArchiveDate, and timestamp from |archive-url=, and done | |||
end | |||
-- here for archive.org urls | |||
if (not url:match('//web%.archive%.org/')) and (not url:match('//liveweb%.archive%.org/')) then -- also deprecated liveweb Wayback machine URL | 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 | ||
| Line 2,450: | Line 2,474: | ||
err_msg = cfg.err_msg_supl.flag; | err_msg = cfg.err_msg_supl.flag; | ||
else | else | ||
return url, date; | return url, date, timestamp; -- return ArchiveURL, ArchiveDate, and timestamp from |archive-url= | ||
end | end | ||
end | end | ||
| Line 2,457: | Line 2,481: | ||
if is_preview_mode then | if is_preview_mode then | ||
return url, date; | return url, date, timestamp; -- preview mode so return ArchiveURL, ArchiveDate, and timestamp from |archive-url= | ||
else | else | ||
return '', ''; -- return empty strings for ArchiveURL and ArchiveDate | return '', ''; -- return empty strings for ArchiveURL and ArchiveDate | ||
| Line 2,524: | Line 2,548: | ||
local a = {}; -- authors list from |lastn= / |firstn= pairs or |vauthors= | local a = {}; -- authors list from |lastn= / |firstn= pairs or |vauthors= | ||
local Authors; | local Authors; | ||
local NameListStyle = is_valid_parameter_value (A['NameListStyle'], A:ORIGIN('NameListStyle'), cfg.keywords_lists['name-list-style'], ''); | local NameListStyle; | ||
if cfg.global_cs1_config_t['NameListStyle'] then -- global setting in {{cs1 config}} overrides local |name-list-style= parameter value; nil when empty or assigned value invalid | |||
NameListStyle = is_valid_parameter_value (cfg.global_cs1_config_t['NameListStyle'], 'cs1 config: name-list-style', cfg.keywords_lists['name-list-style'], ''); -- error messaging 'param' here is a hoax | |||
else | |||
NameListStyle = is_valid_parameter_value (A['NameListStyle'], A:ORIGIN('NameListStyle'), cfg.keywords_lists['name-list-style'], ''); | |||
end | |||
if cfg.global_cs1_config_t['NameListStyle'] and utilities.is_set (A['NameListStyle']) then -- when template has |name-list-style=<something> which global setting has overridden | |||
utilities.set_message ('maint_overridden_setting'); -- set a maint message | |||
end | |||
local Collaboration = A['Collaboration']; | local Collaboration = A['Collaboration']; | ||
| Line 2,533: | Line 2,567: | ||
elseif 2 == selected then | elseif 2 == selected then | ||
NameListStyle = 'vanc'; -- override whatever |name-list-style= might be | NameListStyle = 'vanc'; -- override whatever |name-list-style= might be | ||
a, author_etal = parse_vauthors_veditors (args, | a, author_etal = parse_vauthors_veditors (args, A['Vauthors'], 'AuthorList'); -- fetch author list from |vauthors=, |author-linkn=, and |author-maskn= | ||
elseif 3 == selected then | elseif 3 == selected then | ||
Authors = A['Authors']; -- use content of |authors= | Authors = A['Authors']; -- use content of |authors= | ||
| Line 2,589: | Line 2,623: | ||
local TitleLink = A['TitleLink']; | local TitleLink = A['TitleLink']; | ||
local auto_select = ''; -- default is auto | local auto_select = ''; -- default is auto | ||
local accept_link; | local accept_link; | ||
TitleLink, accept_link = utilities.has_accept_as_written (TitleLink, true); -- test for accept-this-as-written markup | TitleLink, accept_link = utilities.has_accept_as_written (TitleLink, true); -- test for accept-this-as-written markup | ||
| Line 2,606: | Line 2,640: | ||
local Periodical = A['Periodical']; | local Periodical = A['Periodical']; | ||
local Periodical_origin = ''; | local Periodical_origin = A:ORIGIN('Periodical'); | ||
local ScriptPeriodical = A['ScriptPeriodical']; | |||
local ScriptPeriodical_origin = A:ORIGIN('ScriptPeriodical'); | |||
local TransPeriodical = A['TransPeriodical']; | |||
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 (ScriptPeriodical))) 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 | |||
if utilities.is_set (param) then -- if we found one | |||
utilities.set_message ('err_periodical_ignored', {param}); -- emit an error message | |||
end | |||
end | |||
if utilities.is_set (Periodical) then | if utilities.is_set (Periodical) then | ||
local i; | local i; | ||
Periodical, i = utilities.strip_apostrophe_markup (Periodical); -- strip apostrophe markup so that metadata isn't contaminated | Periodical, i = utilities.strip_apostrophe_markup (Periodical); -- strip apostrophe markup so that metadata isn't contaminated | ||
| Line 2,624: | Line 2,680: | ||
Periodical_origin = A:ORIGIN('MailingList'); | Periodical_origin = A:ORIGIN('MailingList'); | ||
end | end | ||
-- web and news not tested for now because of | -- web and news not tested for now because of | ||
| Line 2,638: | Line 2,692: | ||
local Volume; | local Volume; | ||
-- local ScriptPeriodical_origin = A:ORIGIN('ScriptPeriodical'); | |||
if 'citation' == config.CitationClass then | if 'citation' == config.CitationClass then | ||
if utilities.is_set (Periodical) then | if utilities.is_set (Periodical) then | ||
| Line 2,694: | Line 2,748: | ||
local PublisherName = A['PublisherName']; | local PublisherName = A['PublisherName']; | ||
local PublisherName_origin = A:ORIGIN('PublisherName'); | local PublisherName_origin = A:ORIGIN('PublisherName'); | ||
if utilities.is_set (PublisherName) then | if utilities.is_set (PublisherName) and (cfg.keywords_xlate['none'] ~= PublisherName) then | ||
local i = 0; | local i = 0; | ||
PublisherName, i = utilities.strip_apostrophe_markup (PublisherName); -- strip apostrophe markup so that metadata isn't contaminated; publisher is never italicized | PublisherName, i = utilities.strip_apostrophe_markup (PublisherName); -- strip apostrophe markup so that metadata isn't contaminated; publisher is never italicized | ||
if i then | if i and (0 < i) then -- non-zero when markup was stripped so emit an error message | ||
utilities.set_message ('err_apostrophe_markup', {PublisherName_origin}); | utilities.set_message ('err_apostrophe_markup', {PublisherName_origin}); | ||
end | end | ||
end | |||
if ('document' == config.CitationClass) and not utilities.is_set (PublisherName) then | |||
utilities.set_message ('err_missing_publisher', {config.CitationClass, 'publisher'}); | |||
end | end | ||
| Line 2,706: | Line 2,764: | ||
if 'newsgroup' == config.CitationClass then | if 'newsgroup' == config.CitationClass then | ||
if utilities.is_set (PublisherName) then | if utilities.is_set (PublisherName) and (cfg.keywords_xlate['none'] ~= PublisherName) then -- general use parameter |publisher= not allowed in cite newsgroup | ||
utilities.set_message ('err_parameter_ignored', {PublisherName_origin}); | utilities.set_message ('err_parameter_ignored', {PublisherName_origin}); | ||
end | end | ||
| Line 2,768: | Line 2,826: | ||
if PublicationPlace == Place then Place = ''; end -- don't need both if they are the same | if PublicationPlace == Place then Place = ''; end -- don't need both if they are the same | ||
local URL_origin = A:ORIGIN('URL'); -- get name of parameter that holds URL | local URL_origin = A:ORIGIN('URL'); -- get name of parameter that holds URL | ||
local ChapterURL_origin = A:ORIGIN('ChapterURL'); -- get name of parameter that holds ChapterURL | local ChapterURL_origin = A:ORIGIN('ChapterURL'); -- get name of parameter that holds ChapterURL | ||
| Line 2,783: | Line 2,841: | ||
Parameter remapping for cite encyclopedia: | Parameter remapping for cite encyclopedia: | ||
When the citation has these parameters: | When the citation has these parameters: | ||
|encyclopedia= and |title= then map |title= to |article= and |encyclopedia= to |title= | |encyclopedia= and |title= then map |title= to |article= and |encyclopedia= to |title= for rendering | ||
|encyclopedia= and |article= then map |encyclopedia= to |title= | |encyclopedia= and |article= then map |encyclopedia= to |title= for rendering | ||
|trans-title= maps to |trans-chapter= when |title= is re-mapped | |trans-title= maps to |trans-chapter= when |title= is re-mapped | ||
| Line 2,803: | Line 2,861: | ||
if ('encyclopaedia' == config.CitationClass) or ('citation' == config.CitationClass and utilities.is_set (Encyclopedia)) then | if ('encyclopaedia' == config.CitationClass) or ('citation' == config.CitationClass and utilities.is_set (Encyclopedia)) then | ||
if utilities.is_set (Periodical) and utilities.is_set (Encyclopedia) then -- when both set emit an error | if utilities.is_set (Periodical) and utilities.is_set (Encyclopedia) then -- when both parameters set emit an error message; {{citation}} only; Periodical not allowed in {{cite encyclopedia}} | ||
utilities.set_message (' | utilities.set_message ('err_periodical_ignored', {Periodical_origin}); | ||
end | end | ||
if utilities.is_set (Encyclopedia) then | if utilities.is_set (Encyclopedia) then | ||
Periodical = Encyclopedia; -- error or no, set Periodical to Encyclopedia; | Periodical = Encyclopedia; -- error or no, set Periodical to Encyclopedia for rendering; {{citation}} could (not legitimately) have both; use Encyclopedia | ||
Periodical_origin = A:ORIGIN ('Encyclopedia'); | Periodical_origin = A:ORIGIN ('Encyclopedia'); | ||
if utilities.is_set (Title) or utilities.is_set (ScriptTitle) then | if utilities.is_set (Title) or utilities.is_set (ScriptTitle) then | ||
if not utilities.is_set (Chapter) then | if not utilities.is_set (Chapter) then | ||
Chapter = Title; -- |encyclopedia= and |title= are set so map |title= to |article= and |encyclopedia= to |title= | Chapter = Title; -- |encyclopedia= and |title= are set so map |title= to |article= and |encyclopedia= to |title= for rendering | ||
ScriptChapter = ScriptTitle; | ScriptChapter = ScriptTitle; | ||
ScriptChapter_origin = A:ORIGIN('ScriptTitle') | ScriptChapter_origin = A:ORIGIN('ScriptTitle') | ||
| Line 2,837: | Line 2,893: | ||
end | end | ||
elseif utilities.is_set (Chapter) or utilities.is_set (ScriptChapter) then -- |title= not set | elseif utilities.is_set (Chapter) or utilities.is_set (ScriptChapter) then -- |title= not set | ||
Title = Periodical; -- |encyclopedia= set and |article= set so map |encyclopedia= to |title= | Title = Periodical; -- |encyclopedia= set and |article= set so map |encyclopedia= to |title= for rendering | ||
Periodical = ''; -- redundant so unset | Periodical = ''; -- redundant so unset | ||
end | end | ||
| Line 2,883: | Line 2,939: | ||
-- CS1/2 mode | -- CS1/2 mode | ||
local Mode = is_valid_parameter_value (A['Mode'], A:ORIGIN('Mode'), cfg.keywords_lists['mode'], ''); | local Mode; | ||
if cfg.global_cs1_config_t['Mode'] then -- global setting in {{cs1 config}} overrides local |mode= parameter value; nil when empty or assigned value invalid | |||
Mode = is_valid_parameter_value (cfg.global_cs1_config_t['Mode'], 'cs1 config: mode', cfg.keywords_lists['mode'], ''); -- error messaging 'param' here is a hoax | |||
else | |||
Mode = is_valid_parameter_value (A['Mode'], A:ORIGIN('Mode'), cfg.keywords_lists['mode'], ''); | |||
end | |||
if cfg.global_cs1_config_t['Mode'] and utilities.is_set (A['Mode']) then -- when template has |mode=<something> which global setting has overridden | |||
utilities.set_message ('maint_overridden_setting'); -- set a maint message | |||
end | |||
-- separator character and postscript | -- separator character and postscript | ||
local sepc, PostScript = set_style (Mode:lower(), A['PostScript'], config.CitationClass); | local sepc, PostScript = set_style (Mode:lower(), A['PostScript'], config.CitationClass); | ||
| Line 2,986: | Line 3,052: | ||
local TitleType = A['TitleType']; | local TitleType = A['TitleType']; | ||
local Degree = A['Degree']; | local Degree = A['Degree']; | ||
if utilities.in_array (config.CitationClass, {'AV-media-notes', 'interview', 'mailinglist', 'map', 'podcast', 'pressrelease', 'report', 'speech', 'techreport', 'thesis'}) then | if utilities.in_array (config.CitationClass, {'AV-media-notes', 'document', 'interview', 'mailinglist', 'map', 'podcast', 'pressrelease', 'report', 'speech', 'techreport', 'thesis'}) then | ||
TitleType = set_titletype (config.CitationClass, TitleType); | TitleType = set_titletype (config.CitationClass, TitleType); | ||
if utilities.is_set (Degree) and "Thesis" == TitleType then -- special case for cite thesis | if utilities.is_set (Degree) and "Thesis" == TitleType then -- special case for cite thesis | ||
| Line 3,035: | Line 3,101: | ||
local ArchiveDate; | local ArchiveDate; | ||
local ArchiveFormat = A['ArchiveFormat']; | local ArchiveFormat = A['ArchiveFormat']; | ||
local archive_url_timestamp; -- timestamp from wayback machine url | |||
ArchiveURL, ArchiveDate = archive_url_check (A['ArchiveURL'], A['ArchiveDate']) | |||
ArchiveURL, ArchiveDate, archive_url_timestamp = archive_url_check (A['ArchiveURL'], A['ArchiveDate']) | |||
ArchiveFormat = style_format (ArchiveFormat, ArchiveURL, 'archive-format', 'archive-url'); | ArchiveFormat = style_format (ArchiveFormat, ArchiveURL, 'archive-format', 'archive-url'); | ||
ArchiveURL, ArchiveDate = is_unique_archive_url (ArchiveURL, URL, ChapterURL, A:ORIGIN('ArchiveURL'), ArchiveDate); -- add error message when URL or ChapterURL == ArchiveURL | ArchiveURL, ArchiveDate = is_unique_archive_url (ArchiveURL, URL, ChapterURL, A:ORIGIN('ArchiveURL'), ArchiveDate); -- add error message when URL or ChapterURL == ArchiveURL | ||
local AccessDate = A['AccessDate']; | 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 COinS_date = {}; -- holds date info extracted from |date= for the COinS metadata by Module:Date verification | ||
local DoiBroken = A['DoiBroken']; | local DoiBroken = A['DoiBroken']; | ||
| Line 3,057: | Line 3,123: | ||
['doi-broken-date'] = {val = DoiBroken, name = A:ORIGIN ('DoiBroken')}, | ['doi-broken-date'] = {val = DoiBroken, name = A:ORIGIN ('DoiBroken')}, | ||
['pmc-embargo-date'] = {val = Embargo, name = A:ORIGIN ('Embargo')}, | ['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')}, | ['publication-date'] = {val = PublicationDate, name = A:ORIGIN ('PublicationDate')}, | ||
['year'] = {val = Year, name = A:ORIGIN ('Year')}, | ['year'] = {val = Year, name = A:ORIGIN ('Year')}, | ||
| Line 3,098: | Line 3,164: | ||
Date = date_parameters_list['date'].val; | Date = date_parameters_list['date'].val; | ||
DoiBroken = date_parameters_list['doi-broken-date'].val; | DoiBroken = date_parameters_list['doi-broken-date'].val; | ||
-- LayDate = date_parameters_list['lay-date'].val; | |||
PublicationDate = date_parameters_list['publication-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); -- does YYYYMMDD in archive_url_timestamp match date in ArchiveDate | |||
end | end | ||
else | else | ||
| Line 3,105: | Line 3,175: | ||
end | end | ||
end -- end of do | end -- end of do | ||
if utilities.in_array (config.CitationClass, {'book', 'encyclopaedia'}) or -- {{cite book}}, {{cite encyclopedia}}; TODO: {{cite conference}} and others? | |||
('citation' == config.CitationClass and utilities.is_set (Encyclopedia)) or -- {{citation}} as an encylopedia citation | |||
('citation' == config.CitationClass and not utilities.is_set (Periodical)) then -- {{citation}} as a book citation | |||
if utilities.is_set (PublicationPlace) then | |||
if not utilities.is_set (PublisherName) then | |||
local date = COinS_date.rftdate and tonumber (COinS_date.rftdate:match ('%d%d%d%d')); -- get year portion of COinS date (because in Arabic numerals); convert string to number | |||
if date and (1850 <= date) then -- location has no publisher; if date is 1850 or later | |||
utilities.set_message ('maint_location_no_publisher'); -- add maint cat | |||
end | |||
else -- PublisherName has a value | |||