Module:Citation/CS1: Difference between revisions
sync to sandbox, mostly translation handles almost uniformity for archiveurl errors.
m>Dragons flight (D'oh, meant to edit sandbox) |
m>Dragons flight (sync to sandbox, mostly translation handles almost uniformity for archiveurl errors.) |
||
Line 4: | Line 4: | ||
message_tail = {}; | message_tail = {}; | ||
} | } | ||
local SEEN = {}; | |||
local DATA = {}; | |||
-- Include translation message hooks, ID and error handling configuration settings. | -- Include translation message hooks, ID and error handling configuration settings. | ||
local cfg = | local cfg = require( 'Module:Citation/CS1/Configuration' ); | ||
-- Contains a list of all recognized parameters | -- Contains a list of all recognized parameters | ||
local whitelist = mw.loadData( 'Module:Citation/CS1/Whitelist' ); | local whitelist = mw.loadData( 'Module:Citation/CS1/Whitelist' ); | ||
-- Checks that parameter name is valid | -- Populates numbered arguments in a message string using | ||
-- an argument table. | |||
function substitute( message, arguments ) | |||
if arguments == nil then | |||
return message; | |||
end | |||
message = message .. " "; | |||
for k, v in ipairs( arguments ) do | |||
v = v:gsub( "%%", "%%%%" ); | |||
message = message:gsub( "$" .. k .. "(%D)", v .. "%1" ); | |||
end | |||
message = message:sub(1,-2); | |||
return message; | |||
end | |||
--[[ | |||
Argument wrapper. This function provides support for argument | |||
mapping defined in the configuration file so that multiple names | |||
can be transparently aliased to single internal variable. | |||
]] | |||
function argument_wrapper( args ) | |||
DATA = args; | |||
local tbl = {}; | |||
local mt = { | |||
__index = function ( tbl, k ) | |||
if SEEN[k] then | |||
return nil; | |||
end | |||
local list = cfg.argument_map[k]; | |||
if list == nil then | |||
error( cfg.message_list['unknown_argument_map'] ); | |||
elseif type( list ) == 'string' then | |||
v = DATA[list]; | |||
else | |||
v = selectone( DATA, cfg.argument_map[k], | |||
'redundant_parameters' ); | |||
end | |||
if v == nil then | |||
v = cfg.default_values[k]; | |||
end | |||
SEEN[k] = true; | |||
tbl = rawset( tbl, k, v ); | |||
return v; | |||
end, | |||
} | |||
return setmetatable( tbl, mt ); | |||
end | |||
-- Checks that parameter name is valid using the whitelist | |||
function validate( name ) | function validate( name ) | ||
name = tostring( name ); | name = tostring( name ); | ||
Line 33: | Line 89: | ||
function errorcomment( content, hidden ) | function errorcomment( content, hidden ) | ||
if hidden then | if hidden then | ||
return ' | return substitute( cfg.message_list['hidden-error'], { content } ); | ||
else | else | ||
return ' | return substitute( cfg.message_list['visible-error'], { content } ); | ||
end | end | ||
end | end | ||
Line 43: | Line 99: | ||
of the error message in the output is the responsibility of the calling function. | of the error message in the output is the responsibility of the calling function. | ||
]] | ]] | ||
function seterror( error_id, | function seterror( error_id, arguments, raw, prefix, suffix ) | ||
local error_state = cfg.error_conditions[ error_id ]; | local error_state = cfg.error_conditions[ error_id ]; | ||
prefix = prefix or ""; | prefix = prefix or ""; | ||
Line 57: | Line 113: | ||
local message = error_state.message; | local message = error_state.message; | ||
message = substitute( message, arguments ); | |||
message = wikiescape(message) .. " ([[" .. cfg.message_list['help page link'] .. | message = wikiescape(message) .. " ([[" .. cfg.message_list['help page link'] .. | ||
Line 91: | Line 142: | ||
[']'] = ']', | [']'] = ']', | ||
['{'] = '{', | ['{'] = '{', | ||
['|'] = '|', | ['|'] = '|', | ||
['}'] = '}' } ); | ['}'] = '}' } ); | ||
return text; | return text; | ||
Line 289: | Line 340: | ||
if str:sub(1,1) == "'" then str = "<span />" .. str; end | if str:sub(1,1) == "'" then str = "<span />" .. str; end | ||
if str:sub(-1,-1) == "'" then str = str .. "<span />"; end | if str:sub(-1,-1) == "'" then str = str .. "<span />"; end | ||
-- Remove newlines as they break italics. | |||
return str:gsub( '\n', ' ' ); | return str:gsub( '\n', ' ' ); | ||
end | end | ||
Line 458: | Line 511: | ||
end | end | ||
-- Gets | -- Gets name list from the input arguments | ||
function | function extractnames(args, list_name) | ||
local names = {}; | |||
local | |||
local i = 1; | local i = 1; | ||
local last; | local last; | ||
while true do | while true do | ||
last = selectone( args, cfg.argument_map[list_name .. '-Last'], 'redundant_parameters', i ); | |||
if ( last and "" < last ) then -- just in case someone passed in an empty parameter | if ( last and "" < last ) then -- just in case someone passed in an empty parameter | ||
names[i] = { | |||
last = last, | |||
first = selectone( args, cfg.argument_map[list_name .. '-First'], 'redundant_parameters', i ), | |||
link = selectone( args, cfg.argument_map[list_name .. '-Link'], 'redundant_parameters', i ), | |||
mask = selectone( args, cfg.argument_map[list_name .. '-Mask'], 'redundant_parameters', i ) | |||
} | |||
else | else | ||
break; | break; | ||
Line 550: | Line 531: | ||
i = i + 1; | i = i + 1; | ||
end | end | ||
return | return names; | ||
end | end | ||
Line 617: | Line 598: | ||
-- Chooses one matching parameter from a list of parameters to consider | -- Chooses one matching parameter from a list of parameters to consider | ||
-- Generates an error if more than one match is present. | -- Generates an error if more than one match is present. | ||
function selectone( args, possible, error_condition ) | function selectone( args, possible, error_condition, index ) | ||
local value = nil; | local value = nil; | ||
local selected = ''; | local selected = ''; | ||
local error_list = {}; | local error_list = {}; | ||
if index ~= nil then index = tostring(index); end | |||
-- Handle special case of "#" replaced by empty string | |||
if index == '1' then | |||
for _, v in ipairs( possible ) do | |||
v = v:gsub( "#", "" ); | |||
if args[v] ~= nil then | |||
if value ~= nil and selected ~= v then | |||
table.insert( error_list, v ); | |||
else | |||
value = args[v]; | |||
selected = v; | |||
end | |||
end | |||
end | |||
end | |||
for _, v in ipairs( possible ) do | for _, v in ipairs( possible ) do | ||
if index ~= nil then | |||
v = v:gsub( "#", index ); | |||
end | |||
if args[v] ~= nil then | if args[v] ~= nil then | ||
if value ~= nil then | if value ~= nil then | ||
Line 632: | Line 632: | ||
end | end | ||
end | end | ||
if #error_list > 0 then | if #error_list > 0 then | ||
local error_str = ""; | local error_str = ""; | ||
Line 656: | Line 656: | ||
]] | ]] | ||
function citation0( config, args) | function citation0( config, args) | ||
-- Load Input Parameters | --[[ | ||
Load Input Parameters | |||
The argment_wrapper facillitates the mapping of multiple | |||
aliases to single internal variable. | |||
]] | |||
local A = argument_wrapper( args ); | |||
local i | local i | ||
local PPrefix = | local PPrefix = A['PPrefix'] | ||
local PPPrefix = | local PPPrefix = A['PPPrefix'] | ||
if ( nil ~= | if ( nil ~= A['NoPP'] ) then PPPrefix = "" PPrefix = "" end | ||
-- Pick out the relevant fields from the arguments. Different citation templates | -- Pick out the relevant fields from the arguments. Different citation templates | ||
-- define different field names for the same underlying things. | -- define different field names for the same underlying things. | ||
local Authors = | local Authors = A['Authors']; | ||
local a = | local a = extractnames( args, 'AuthorList' ); | ||
local Coauthors = | local Coauthors = A['Coauthors']; | ||
local Others = | local Others = A['Others']; | ||
local Editors = | local Editors = A['Editors']; | ||
local e = | local e = extractnames( args, 'EditorList' ); | ||
local Year = | local Year = A['Year']; | ||
local PublicationDate = | local PublicationDate = A['PublicationDate']; | ||
local OrigYear = | local OrigYear = A['OrigYear']; | ||
local Date = | local Date = A['Date']; | ||
local LayDate = | local LayDate = A['LayDate']; | ||
------------------------------------------------- Get title data | ------------------------------------------------- Get title data | ||
local Title = | local Title = A['Title']; | ||
local BookTitle = | local BookTitle = A['BookTitle']; | ||
local Conference = | local Conference = A['Conference']; | ||
local TransTitle = | local TransTitle = A['TransTitle']; | ||
local TitleNote = | local TitleNote = A['TitleNote']; | ||
local TitleLink = | local TitleLink = A['TitleLink']; | ||
local Chapter = | local Chapter = A['Chapter']; | ||
local ChapterLink = | local ChapterLink = A['ChapterLink']; | ||
local TransChapter = | local TransChapter = A['TransChapter']; | ||
local TitleType = | local TitleType = A['TitleType']; | ||
local ArchiveURL = | local ArchiveURL = A['ArchiveURL']; | ||
local URL = | local URL = A['URL']; | ||
local ChapterURL = | local ChapterURL = A['ChapterURL']; | ||
local ConferenceURL = | local ConferenceURL = A['ConferenceURL']; | ||
local Periodical = | local Periodical = A['Periodical']; | ||
if ( config.CitationClass == "encyclopaedia" ) then | if ( config.CitationClass == "encyclopaedia" ) then | ||
if ( | if ( Chapter == nil or Chapter == '' ) then | ||
if ( Title | if (Title == nil or Title == "") then | ||
Title = Periodical; | |||
Periodical = nil; | |||
else | |||
Chapter = Title | Chapter = Title | ||
TransChapter = TransTitle | TransChapter = TransTitle | ||
Line 710: | Line 711: | ||
TransTitle = nil | TransTitle = nil | ||
end | end | ||
end | end | ||
end | end | ||
local Series = | |||
local Volume = | local Series = A['Series']; | ||
local Issue = | local Volume = A['Volume']; | ||
local Issue = A['Issue']; | |||
local Position = nil | local Position = nil | ||
local Page, Pages, At, page_type; | local Page, Pages, At, page_type; | ||
Page | Page = A['Page']; | ||
Pages = hyphentodash( A['Pages'] ); | |||
if | At = A['At']; | ||
if Page ~= nil then | |||
if Pages ~= nil or At ~= nil then | |||
elseif | Page = Page .. " " .. seterror('extra_pages'); | ||
At = | Pages = nil; | ||
At = nil; | |||
end | end | ||
elseif Pages ~= nil then | |||
if At ~= nil then | |||
Pages = Pages .. " " .. seterror('extra_pages'); | |||
At = nil; | |||
end | |||
end | |||
local Edition = | local Edition = A['Edition']; | ||
local PublicationPlace = | local PublicationPlace = A['PublicationPlace'] | ||
local Place = | local Place = A['Place']; | ||
if PublicationPlace == nil and Place ~= nil then | if PublicationPlace == nil and Place ~= nil then | ||
PublicationPlace = Place; | PublicationPlace = Place; | ||
Line 739: | Line 744: | ||
if PublicationPlace == Place then Place = nil end | if PublicationPlace == Place then Place = nil end | ||
local PublisherName = | local PublisherName = A['PublisherName']; | ||
local SubscriptionRequired = | local SubscriptionRequired = A['SubscriptionRequired']; | ||
local Via = | local Via = A['Via']; | ||
local AccessDate = | local AccessDate = A['AccessDate']; | ||
local ArchiveDate = | local ArchiveDate = A['ArchiveDate']; | ||
local Agency = | local Agency = A['Agency']; | ||
local DeadURL = | local DeadURL = A['DeadURL'] | ||
local Language = | local Language = A['Language']; | ||
local Format = | local Format = A['Format'] | ||
local Ref = | local Ref = A['Ref'] | ||
local DoiBroken = | local DoiBroken = A['DoiBroken'] | ||
local ID = | local ID = A['ID']; | ||
local ASINTLD = | local ASINTLD = A['ASINTLD']; | ||
local IgnoreISBN = | local IgnoreISBN = A['IgnoreISBN'] | ||
local ID_list = extractids( args ); | local ID_list = extractids( args ); | ||
local Quote = | local Quote = A['Quote']; | ||
local PostScript = | local PostScript = A['PostScript'] | ||
local LaySummary = | local LaySummary = A['LaySummary'] | ||
local LaySource = | local LaySource = A['LaySource']; | ||
local Transcript = | local Transcript = A['Transcript']; | ||
local TranscriptURL = | local TranscriptURL = A['TranscriptURL']; | ||
local sepc = | local sepc = A['Separator'] | ||
local LastAuthorAmp = | local LastAuthorAmp = A['LastAuthorAmp'] | ||
local no_tracking_cats = | local no_tracking_cats = A['NoTracking']; | ||
if ( config.CitationClass == "journal" ) then | if ( config.CitationClass == "journal" ) then | ||
if (URL == nil or URL == "") then | if (URL == nil or URL == "") then | ||
if (ID_list['PMC'] ~= nil) then | if (ID_list['PMC'] ~= nil) then | ||
local Embargo = | local Embargo = A['Embargo']; | ||
if Embargo ~= nil then | if Embargo ~= nil then | ||
local lang = mw.getContentLanguage(); | local lang = mw.getContentLanguage(); | ||
Line 801: | Line 805: | ||
-- Account for the oddity that is {{cite episode}}, before generation of COinS data. | -- Account for the oddity that is {{cite episode}}, before generation of COinS data. | ||
if config.CitationClass == "episode" then | if config.CitationClass == "episode" then | ||
local AirDate = | local AirDate = A['AirDate'] | ||
local SeriesLink = | local SeriesLink = A['SeriesLink'] | ||
local Season = | local Season = A['Season'] | ||
local SeriesNumber = | local SeriesNumber = A['SeriesNumber'] | ||
local Network = | local Network = A['Network'] | ||
local Station = | local Station = A['Station'] | ||
local s = {} | local s = {} | ||
if Issue ~= nil then table.insert(s, cfg.message_list["episode"] .. " " .. Issue) Issue = nil end | if Issue ~= nil then table.insert(s, cfg.message_list["episode"] .. " " .. Issue) Issue = nil end | ||
Line 821: | Line 825: | ||
TitleLink = SeriesLink | TitleLink = SeriesLink | ||
TransTitle = nil | TransTitle = nil | ||
local Sep = | local Sep = (A["SeriesSeparator"] or A["Separator"]) .. " " | ||
Series = table.concat(s, Sep) | Series = table.concat(s, Sep) | ||
ID = table.concat(n, Sep) | ID = table.concat(n, Sep) | ||
Line 880: | Line 884: | ||
end | end | ||
if last ~= nil and first ~= nil then | if last ~= nil and first ~= nil then | ||
table.insert( OCinSauthors, last .. | table.insert( OCinSauthors, last .. ", " .. first ); | ||
elseif last ~= nil then | elseif last ~= nil then | ||
table.insert( OCinSauthors, last ); | table.insert( OCinSauthors, last ); | ||
Line 923: | Line 927: | ||
-- various parts of the citation, but only when they are non-nil. | -- various parts of the citation, but only when they are non-nil. | ||
if ( Authors == nil ) then | if ( Authors == nil ) then | ||
local Maximum = tonumber( | local Maximum = tonumber( A['DisplayAuthors'] ); | ||
-- Preserve old-style implicit et al. | -- Preserve old-style implicit et al. | ||
Line 934: | Line 938: | ||
local control = { | local control = { | ||
sep = | sep = A["AuthorSeparator"] .. " ", | ||
namesep = ( | namesep = (A["AuthorNameSeparator"] or A["NameSeparator"]) .. " ", | ||
format = | format = A["AuthorFormat"], | ||
maximum = Maximum, | maximum = Maximum, | ||
lastauthoramp = LastAuthorAmp | lastauthoramp = LastAuthorAmp | ||
Line 951: | Line 955: | ||
local EditorCount | local EditorCount | ||
if ( Editors == nil ) then | if ( Editors == nil ) then | ||
local Maximum = tonumber( | local Maximum = tonumber( A['DisplayEditors'] ); | ||
-- Preserve old-style implicit et al. | -- Preserve old-style implicit et al. | ||
Line 962: | Line 966: | ||
local control = { | local control = { | ||
sep = | sep = A["EditorSeparator"] .. " ", | ||
namesep = ( | namesep = (A["EditorNameSeparator"] or A["NameSeparator"]) .. " ", | ||
format = | format = A['EditorFormat'], | ||
maximum = Maximum, | maximum = Maximum, | ||
lastauthoramp = LastAuthorAmp | lastauthoramp = LastAuthorAmp | ||
Line 994: | Line 998: | ||
Date = Year | Date = Year | ||
if ( Date ~= nil and Date ~="") then | if ( Date ~= nil and Date ~="") then | ||
local Month = | local Month = A['Month'] | ||
if ( Month ~= nil and Month ~= "") then | if ( Month ~= nil and Month ~= "") then | ||
Date = Month .. " " .. Date | Date = Month .. " " .. Date | ||
local Day = | local Day = A['Day'] | ||
if ( Day ~= nil ) then Date = Day .. " " .. Date end | if ( Day ~= nil ) then Date = Day .. " " .. Date end | ||
else Month = "" | else Month = "" | ||
Line 1,057: | Line 1,061: | ||
end | end | ||
if ( TransTitle and "" < TransTitle ) then TransTitle = " | if ( TransTitle and "" < TransTitle ) then TransTitle = " " .. substitute( cfg.message_list['trans-title'], { TransTitle } ) else TransTitle = "" end | ||
if ( TransChapter and "" < TransChapter ) then TransChapter = " | if ( TransChapter and "" < TransChapter ) then TransChapter = " " .. substitute( cfg.message_list['trans-title'], { TransChapter } ) else TransChapter = "" end | ||
-- Format chapter / article title | -- Format chapter / article title | ||
Line 1,065: | Line 1,069: | ||
if ( Periodical and "" < Periodical ) and (Title ~= nil and Title ~= "" ) | if ( Periodical and "" < Periodical ) and (Title ~= nil and Title ~= "" ) | ||
then | then | ||
Chapter = | Chapter = substitute( cfg.message_list['italic-title'], { (safeforitalics(Chapter)) } ); | ||
else | else | ||
Chapter = | Chapter = substitute( cfg.message_list['quoted-title'], { Chapter } ); | ||
end | end | ||
else | else | ||
Line 1,109: | Line 1,113: | ||
Title = "[[" .. TitleLink .. "|" .. Title .. "]]" end | Title = "[[" .. TitleLink .. "|" .. Title .. "]]" end | ||
if ( Periodical and "" < Periodical ) then | if ( Periodical and "" < Periodical ) then | ||
Title = | Title = substitute( cfg.message_list['quoted-title'], { Title } ); | ||
elseif ( config.CitationClass == "web" | elseif ( config.CitationClass == "web" | ||
or config.CitationClass == "news" | or config.CitationClass == "news" | ||
or config.CitationClass == "pressrelease" ) and | or config.CitationClass == "pressrelease" ) and | ||
Chapter == "" then | Chapter == "" then | ||
Title = | Title = substitute( cfg.message_list['quoted-title'], { Title } ); | ||
else | else | ||
Title = | Title = substitute( cfg.message_list['italic-title'], { (safeforitalics(Title)) } ); | ||
end | end | ||
else | else | ||
Line 1,139: | Line 1,143: | ||
if ( Place ~= nil and Place ~= "" ) then | if ( Place ~= nil and Place ~= "" ) then | ||
if sepc == '.' then | if sepc == '.' then | ||
Place = " " .. cfg.message_list['written'] | Place = " " .. substitute( cfg.message_list['written'], {Place} ) .. sepc .. " "; | ||
else | else | ||
Place = " " .. cfg.message_list['written']:lower() | Place = " " .. substitute( cfg.message_list['written']:lower(), {Place} ) .. sepc .. " "; | ||
end | end | ||
else | else | ||
Line 1,159: | Line 1,163: | ||
if ( nil ~= Position or nil ~= Page or nil ~= Pages ) then At = nil end | if ( nil ~= Position or nil ~= Page or nil ~= Pages ) then At = nil end | ||
if ( nil == Position and "" ~= Position ) then | if ( nil == Position and "" ~= Position ) then | ||
local Minutes = | local Minutes = A['Minutes']; | ||
if ( nil ~= Minutes ) then | if ( nil ~= Minutes ) then | ||
Position = " " .. Minutes .. " " .. cfg.message_list['minutes']; | Position = " " .. Minutes .. " " .. cfg.message_list['minutes']; | ||
else | else | ||
local Time = | local Time = A['Time']; | ||
if ( nil ~= Time ) then | if ( nil ~= Time ) then | ||
local TimeCaption = | local TimeCaption = A['TimeCaption'] | ||
if TimeCaption == nil then | if TimeCaption == nil then | ||
TimeCaption = cfg.message_list['event']; | TimeCaption = cfg.message_list['event']; | ||
Line 1,218: | Line 1,222: | ||
TitleNote = sepc .. " " .. TitleNote else TitleNote = "" end | TitleNote = sepc .. " " .. TitleNote else TitleNote = "" end | ||
if ( Language ~= nil and Language ~="" ) then | if ( Language ~= nil and Language ~="" ) then | ||
Language = " | Language = " " .. substitute( cfg.message_list['language'] , {Language} ) else Language = "" end | ||
if ( Edition ~= nil and Edition ~="" ) then | if ( Edition ~= nil and Edition ~="" ) then | ||
Edition = | Edition = " " .. substitute( cfg.message_list['edition'] , {Edition} ) else Edition = "" end | ||
if ( Volume ~= nil and Volume ~="" ) | if ( Volume ~= nil and Volume ~="" ) | ||
then | then | ||
Line 1,239: | Line 1,243: | ||
if ( Date ~= nil ) then Date = Date else Date = "" end | if ( Date ~= nil ) then Date = Date else Date = "" end | ||
if ( Via ~= nil and Via ~="" ) then | if ( Via ~= nil and Via ~="" ) then | ||
Via = " | Via = " " .. substitute( cfg.message_list['via'], {Via} ) else Via = "" end | ||
if ( AccessDate ~= nil and AccessDate ~="" ) | if ( AccessDate ~= nil and AccessDate ~="" ) | ||
then local retrv_text = " " .. cfg.message_list['retrieved'] | then local retrv_text = " " .. cfg.message_list['retrieved'] | ||
if (sepc ~= ".") then retrv_text = retrv_text:lower() end | if (sepc ~= ".") then retrv_text = retrv_text:lower() end | ||
AccessDate = '<span class="reference-accessdate">' .. sepc | AccessDate = '<span class="reference-accessdate">' .. sepc | ||
.. retrv_text | .. substitute( retrv_text, {AccessDate} ) .. '</span>' | ||
else AccessDate = "" end | else AccessDate = "" end | ||
if ( SubscriptionRequired ~= nil and | if ( SubscriptionRequired ~= nil and | ||
Line 1,273: | Line 1,277: | ||
end | end | ||
Quote = sepc .. | Quote = sepc .." " .. substitute( cfg.message_list['quoted-text'], { Quote } ); | ||
PostScript = "" | PostScript = "" | ||
else | else | ||
Line 1,282: | Line 1,286: | ||
local Archived | local Archived | ||
if ( nil ~= ArchiveURL and "" ~= ArchiveURL ) then | if ( nil ~= ArchiveURL and "" ~= ArchiveURL ) then | ||
if ( ArchiveDate | if ( ArchiveDate == nil or ArchiveDate =="" ) then | ||
ArchiveDate = | ArchiveDate = seterror('archive_missing_date'); | ||
end | end | ||
if ( "no" == DeadURL ) then | if ( "no" == DeadURL ) then | ||
local arch_text = cfg.message_list['archived']; | |||
if (sepc ~= ".") then arch_text = arch_text:lower() end | |||
Archived = sepc .. " " .. substitute( cfg.message_list['archived-not-dead'], | |||
{ externallink( ArchiveURL, arch_text ), ArchiveDate } ); | |||
if OriginalURL == nil or OriginalUrl == '' then | if OriginalURL == nil or OriginalUrl == '' then | ||
Archived = Archived .. " " .. seterror(' | Archived = Archived .. " " .. seterror('archive_missing_url'); | ||
end | end | ||
else | else | ||
if OriginalURL ~= nil and OriginalURL ~= '' then | if OriginalURL ~= nil and OriginalURL ~= '' then | ||
local arch_text = cfg.message_list['archived-dead']; | |||
if (sepc ~= ".") then arch_text = arch_text:lower() end | |||
Archived = sepc .. " " .. substitute( arch_text, | |||
{ externallink( OriginalURL, cfg.message_list['original'] ), ArchiveDate } ); | |||
else | else | ||
local arch_text = cfg.message_list['archived-missing']; | |||
if (sepc ~= ".") then arch_text = arch_text:lower() end | |||
Archived = sepc .. " " .. substitute( arch_text, | |||
{ seterror('archive_missing_url'), ArchiveDate } ); | |||
end | end | ||
end | end | ||
Line 1,355: | Line 1,354: | ||
if ( PublicationDate and PublicationDate ~="" ) then | if ( PublicationDate and PublicationDate ~="" ) then | ||
if Publisher ~= '' then | if Publisher ~= '' then | ||
Publisher = Publisher .. ", " .. cfg.message_list['published'] | Publisher = Publisher .. ", " .. substitute( cfg.message_list['published'], {PublicationDate} ); | ||
else | else | ||
Publisher = PublicationDate; | Publisher = PublicationDate; | ||
Line 1,365: | Line 1,364: | ||
else | else | ||
if ( PublicationDate and PublicationDate ~="" ) then | if ( PublicationDate and PublicationDate ~="" ) then | ||
PublicationDate = " (" .. cfg.message_list['published'] | PublicationDate = " (" .. substitute( cfg.message_list['published'], {PublicationDate} ) .. ")" | ||
else | else | ||
PublicationDate = "" | PublicationDate = "" | ||
Line 1,384: | Line 1,383: | ||
if ( Periodical ~= nil and Periodical ~="" ) then | if ( Periodical ~= nil and Periodical ~="" ) then | ||
if ( Title and Title ~= "" ) or ( TitleNote and TitleNote ~= "" ) then | if ( Title and Title ~= "" ) or ( TitleNote and TitleNote ~= "" ) then | ||
Periodical = sepc .. " | Periodical = sepc .. " " .. substitute( cfg.message_list['italic-title'], { (safeforitalics(Periodical)) } ) | ||
else | else | ||
Periodical = | Periodical = substitute( cfg.message_list['italic-title'], { (safeforitalics(Periodical)) } ) | ||
end | end | ||
else Periodical = "" end | else Periodical = "" end | ||
Line 1,417: | Line 1,416: | ||
if ( "" ~= Authors ) then | if ( "" ~= Authors ) then | ||
if (Coauthors ~= "") | if (Coauthors ~= "") | ||
then Authors = Authors .. " | then Authors = Authors .. A['AuthorSeparator'] .. " " .. Coauthors | ||
end | end | ||
if ( "" ~= Date ) | if ( "" ~= Date ) | ||
Line 1,531: | Line 1,530: | ||
if #z.message_tail ~= 0 then | if #z.message_tail ~= 0 then | ||
text = text .. " "; | |||
for i,v in ipairs( z.message_tail ) do | for i,v in ipairs( z.message_tail ) do | ||
if v[1] ~= nil and v[1] ~= "" then | if v[1] ~= nil and v[1] ~= "" then | ||
Line 1,542: | Line 1,542: | ||
end | end | ||
if no_tracking_cats == | if no_tracking_cats == nil then | ||
for _, v in ipairs( z.error_categories ) do | for _, v in ipairs( z.error_categories ) do | ||
text = text .. '[[Category:' .. v ..']]'; | text = text .. '[[Category:' .. v ..']]'; | ||
Line 1,601: | Line 1,601: | ||
return z | return z | ||