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

உள்ளடக்கம் நீக்கப்பட்டது உள்ளடக்கம் சேர்க்கப்பட்டது
sync with sandbox, merge cite_web_title to bare_url, better style control on translations, category suppression by config, tweak display authors
sync to sandbox, mostly code cleaning / organization. Also, ref = none, layurl as alias for laysummary, tweaks to COinS output, and changes to bareurl error.
வரிசை 4:
message_tail = {};
}
 
local SEEN = {};
local DATA = {};
 
-- Include translation message hooks, ID and error handling configuration settings.
-- Note that require has tested to be significantly faster than loadData for this
local cfg = require( 'Module:Citation/CS1/Configuration' );
-- usage. This might be a side effect of the unnecessary cloning described
-- in bugzilla 47300.
local cfg = require( 'Module:Citation/CS1/Configuration/sandbox' );
 
-- Contains a list of all recognized parameters
local whitelist = mw.loadData( 'Module:Citation/CS1/Whitelist' );
 
-- Whether variable is set or not
-- Populates numbered arguments in a message string using
function is_set( var )
-- an argument table.
return not (var == nil or var == '');
function substitute( message, arguments )
end
if arguments == nil then
 
return message;
-- First set variable or nil if none
function first_set(...)
local list = {...};
for _, var in pairs(list) do
if is_set( var ) then
return var;
end
end
end
 
message = message .. " ";
-- Whether needle is in haystack
for k, v in ipairs( arguments ) do
function inArray( needle, haystack )
v = v:gsub( "%%", "%%%%" );
if needle == nil then
message = message:gsub( "$" .. k .. "(%D)", v .. "%1" );
end return false;
end
message = message:sub(1,-2);
for n,v in ipairs( haystack ) do
return message;
if v == needle then
return n;
end
end
return false;
end
 
-- Populates numbered arguments in a message string using an argument table.
function substitute( msg, args )
return args and tostring( mw.message.newRawMessage( msg, args ) ) or msg;
end
 
-- Wraps a string using a message_list configuration taking one argument
function wrap( message_keykey, str )
if strnot == nil oris_set( str == "") then
return "";
elseif inArray( key, { 'italic-title', 'trans-italic-title' } ) then
end
if message_key == 'italic-title' or
message_key == 'trans-italic-title' then
str = safeforitalics( str );
end
return substitute( cfg.message_listmessages[message_keykey], {str} );
end
 
வரி 48 ⟶ 63:
]]
function argument_wrapper( args )
DATAlocal origin = args{};
local tbl = {};
local mt =return setmetatable({
__indexORIGIN = function ( tblself, k )
iflocal SEENdummy = self[k]; --force the variable to be thenloaded.
return origin[k];
end
},
{
__index = function ( tbl, k )
if origin[k] ~= nil then
return nil;
end
local args, list, v = args, cfg.argument_mapaliases[k];
 
if list == nil then
error( cfg.message_listmessages['unknown_argument_map'] );
elseif type( list ) == 'string' then
v, origin[k] = DATAargs[list], list;
else
v, origin[k] = selectone( DATAargs, cfg.argument_map[k]list, 'redundant_parameters' );
if origin[k] == nil 'redundant_parameters' );then
origin[k] = ''; --Empty string, not nil;
end
end
if v == nil then
v = cfg.default_valuesdefaults[k] or "";
origin[k] = ''; --Empty string, not nil;
end
SEEN[k] = true;
tbl = rawset( tbl, k, v );
tbl = rawset( tbl, k, v );
return v;
end,
});
return setmetatable( tbl, mt );
end
 
வரி 100 ⟶ 122:
-- Formats a comment for error trapping
function errorcomment( content, hidden )
return wrap( hidden and 'hidden-error' or 'visible-error', content );
if hidden then
return wrap( 'hidden-error', content );
else
return wrap( 'visible-error', content );
end
end
 
வரி 113 ⟶ 131:
function seterror( error_id, arguments, raw, prefix, suffix )
local error_state = cfg.error_conditions[ error_id ];
prefix = prefix or "";
suffix = suffix or "";
 
if error_state == nil then
error( cfg.message_list['undefined_error'] );
end
if error_state.category ~== nil and error_state.category ~= "" then
error( cfg.messages['undefined_error'] );
elseif is_set( error_state.category ) then
table.insert( z.error_categories, error_state.category );
end
local message = substitute( error_state.message, arguments );
message = substitute( message, arguments );
message = message .. " ([[" .. cfg.messages['help page link'] ..
 
message = wikiescape(message) .. " ([[" .. cfg.message_list['help page link'] ..
"#" .. error_state.anchor .. "|" ..
cfg.message_listmessages['help page label'] .. "]])";
 
z.error_ids[ error_id ] = true;
if inArray( error_id, =={ 'bare_url_missing_title' or error_id ==, 'trans_missing_title' } )
and z.error_ids['citation_missing_title'] then
return '', false;
end
message = table.concat({ prefix .., message, ..suffix suffix});
if raw == true then
வரி 144 ⟶ 160:
return errorcomment( message, error_state.hidden );
end
 
-- This returns a string with HTML character entities for wikitext markup characters.
function wikiescape(text)
text = text:gsub( '[&\'%[%]{|}]', {
['&'] = '&',
["'"] = ''',
['['] = '[',
[']'] = ']',
['{'] = '{',
['|'] = '|',
['}'] = '}' } );
return text;
end
 
-- Formats a wiki style external link
function externallinkid(options)
local sepurl_string = options.separator or "&nbspid;"
options.suffix = options.suffix or ""
local url_string = options.id
if options.encode == true or options.encode == nil then
url_string = mw.uri.encode( url_string );
end
return mw.ustring.format( '[[%s|%s]]%s[%s%s%s %s]',
return "[[" .. options.link .. "|" .., options.label, options..separator "]]" .. sep ..or "[ " .. ,
options.prefix .., url_string .., options.suffix .. " " .. mw.text.nowiki(options.id) ..or "]",
mw.text.nowiki(options.id)
);
end
 
-- Formats a wiki style internal link
function internallinkid(options)
return mw.ustring.format( '[[%s|%s]]%s[[%s%s%s|%s]]',
local sep = options.separator or " "
options.suffixlink, =options.label, options.suffixseparator or " ",
return "[[" .. options.linkprefix, options.. "|" ..id, options.labelsuffix ..or "]]" .. sep .. "[[" .. ,
options.prefix .. options.id .. options.suffix .. "|" .. mw.text.nowiki(options.id) .. "]]"
);
end
 
-- Format an external link with error checking
function externallink( URL, label, source )
local error_str = "";
if labelnot == nil oris_set( label == "") then
label = URL;
if is_set( source ) then
error_str = seterror( 'bare_url_missing_title', {}, false, " " );
error_str = seterror( 'bare_url_missing_title', { wrap( 'parameter', source ) }, false, " " );
else
error( cfg.messages["bare_url_no_origin"] );
end
end
if not checkurl( URL ) then
error_str = seterror( 'bad_url', {}, false, " " ) .. error_str;
end
return table.concat({ "[", URL, " ", safeforurl( label ), "]", error_str });
 
return "[" .. URL .. ' ' .. safeforurl( label ) .. "]" .. error_str;
end
 
-- Formats a link to Amazon
function amazon(id, domain)
if not is_set( nil == domain ) then
domain = "com"
elseif ( "jp" == domain or "uk" == domain ) then
வரி 213 ⟶ 220:
local text;
if is_set( inactive ~= nil ) then
text = "[[" .. handler.link .. "|" .. handler.label .. "]]:" .. id;
table.insert( z.error_categories, "Pages with DOIs inactive since " .. selectyear(inactive) );
inactive = " (" .. cfg.message_listmessages['inactive'] .. " " .. inactive .. ")"
else
text = externallinkid({link = handler.link, label = handler.label,
வரி 261 ⟶ 268:
]]
function checkurl( url_str )
-- Protocol-relative or URL scheme
if url_str:sub(1,2) == "//" then
return url_str:sub(1,2) == "//" or url_str:match( "^[^/]*:" ) ~= nil;
-- Protocol-less URLs
return true;
elseif url_str:match( "^[^/]*:" ) ~= nil then
-- Look for ":" prefix and assume it is a URI scheme
return true;
else
-- Anything else is an error
return false;
end
end
 
வரி 312 ⟶ 311:
-- Gets the display text for a wikilink like [[A|B]] or [[B]] gives B
function removewikilink( str )
str =return (str:gsub( "%[%[([^|%]]*|([^%]]*)%]%]", "%1" function(l);
str = str return l:gsub( "%^[^|]*|(.*)$", "%[1" ):gsub(["^%]]s*(.-)%]%]s*$", "%1" );
return strend));
end
 
வரி 324 ⟶ 323:
return str:gsub( '[%[%]\n]', {
['['] = '[',
[']'] = ']',
['\n'] = ' ' } );
end
வரி 331 ⟶ 330:
-- Converts a hyphen to a dash
function hyphentodash( str )
if not is_set(str) or str:match( "[%[%]{}<>]" ) =~= nil then
return nil;
end
if str:match( "[%[%]{}<>]" ) ~= nil then
return str;
end
வரி 347 ⟶ 343:
tend to interact poorly under Mediawiki's HTML tidy. ]]
if str == nil ornot is_set(str == '') then
return str;
else
வரி 439 ⟶ 435:
-- Is the input a simple number?
local num = tonumber( str );
if num ~= nil and num > 0 and num < 2100 and num == math.absfloor(num) then
return str;
else
வரி 467 ⟶ 463:
function listpeople(control, people)
local sep = control.sep;
if sep:sub(-1,-1) ~= " " then sep = sep .. " " end
local namesep = control.namesep
local format = control.format
வரி 474 ⟶ 469:
local text = {}
local etal = false;
if maximum < 1 then return "", 0; end
if sep:sub(-1,-1) ~= " " then sep = sep .. " " end
if maximum ~= nil and maximum < 1 then return "", 0; end
for i,person in ipairs(people) do
if is_set(person.last ~= nil or person.last ~= "") then
local mask = person.mask
local one
local sep_one = sep;
if ( maximum ~= nil and i > maximum ) then
etal = true;
break;
வரி 494 ⟶ 492:
one = person.last
local first = person.first
if is_set(first ~= nil and first ~= '') then
if ( "vanc" == format ) then first = reducetoinitials(first) end
one = one .. namesep .. first
end
if is_set(person.link ~= nil and person.link ~= "") then one = "[[" .. person.link .. "|" .. one .. "]]" end
end
table.insert( text, one )
வரி 507 ⟶ 505:
local count = #text / 2;
if count > 0 then
if count > 1 and is_set(lastauthoramp ~= nil and lastauthoramp ~= "") and not etal then
text[#text-2] = " & ";
end
வரி 515 ⟶ 513:
local result = table.concat(text) -- construct list
if etal then
local etal_text = cfg.message_listmessages['et al'];
result = result .. " " .. etal_text;
end
வரி 528 ⟶ 526:
-- Generates a CITEREF anchor ID.
function anchorid( options )
return "CITEREF" .. mw.uri.anchorEncode( table.concat( options ) );
end
 
வரி 538 ⟶ 536:
while true do
last = selectone( args, cfg.argument_mapaliases[list_name .. '-Last'], 'redundant_parameters', i );
if not is_set( last and "" < last ) then -- just in case someone passed in an empty parameter
-- 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
break;
end
names[i] = {
last = last,
first = selectone( args, cfg.aliases[list_name .. '-First'], 'redundant_parameters', i ),
link = selectone( args, cfg.aliases[list_name .. '-Link'], 'redundant_parameters', i ),
mask = selectone( args, cfg.aliases[list_name .. '-Mask'], 'redundant_parameters', i )
};
i = i + 1;
end
வரி 557 ⟶ 555:
function extractids( args )
local id_list = {};
for k, v in pairs( cfg.id_handlers ) do
id_list[k]v = selectone( args, v.parameters, 'redundant_parameters' );
if is_set(v) then id_list[k] = v; end
end
 
return id_list;
end
வரி 567 ⟶ 564:
-- Takes a table of IDs and turns it into a table of formatted ID outputs.
function buildidlist( id_list, options )
local new_list, handler = {};
local new_list = {};
function fallback(k) return { __index = function(t,i) return cfg.id_handlers[k][i] end } end;
for k, v in pairs( id_list ) do
handler-- =fallback {};to read-only cfg
handler = setmetatable( { ['id'] = v }, fallback(k) );
if handler.mode == 'external' then
--Becasue cfg is read-only we have to copy it the hard way.
for k2, v2 in pairs( cfg.id_handlers[k] ) do
handler[k2] = v2;
end
handler['id'] = v;
if handler.mode == 'external' then
table.insert( new_list, {handler.label, externallinkid( handler ) } );
elseif handler.mode == 'internal' then
table.insert( new_list, {handler.label, internallinkid( handler ) } );
elseif handler.mode =~= 'manual' then
if k ==error( cfg.messages['DOIunknown_ID_mode'] then);
elseif k == 'DOI' then
table.insert( new_list, {handler.label, doi( v, options.DoiBroken ) } );
table.insert( new_list, {handler.label, doi( v, options.DoiBroken ) } );
elseif k == 'ASIN' then
elseif k == 'ASIN' then
table.insert( new_list, {handler.label, amazon( v, options.ASINTLD ) } );
table.insert( new_list, {handler.label, amazon( v, options.ASINTLD ) } );
elseif k == 'OL' then
elseif k == 'OL' then
table.insert( new_list, {handler.label, openlibrary( v ) } );
elseiftable.insert( knew_list, =={handler.label, 'ISBN'openlibrary( thenv ) } );
elseif k == local 'ISBN' = internallinkid( handler );then
local ISBN = internallinkid( handler );
if not checkisbn( v ) and ( options.IgnoreISBN == nil or options.IgnoreISBN == "" ) then
if not checkisbn( v ) and not is_set(options.IgnoreISBN) then
ISBN = ISBN .. seterror( 'bad_isbn', {}, false, " ", "" );
endISBN = ISBN .. seterror( 'bad_isbn', {}, false, " ", "" );
end
table.insert( new_list, {handler.label, ISBN } );
table.insert( new_list, {handler.label, ISBN } );
else
error( cfg.message_list['unknown_manual_ID'] );
end
else
error( cfg.message_listmessages['unknown_ID_modeunknown_manual_ID'] );
end
end
 
function comp( a, b )
return a[1] < b[1];
end
 
table.sort( new_list, comp );
for k, v in ipairs( new_list ) do
வரி 622 ⟶ 613:
local selected = '';
local error_list = {};
if index ~= nil then index = tostring(index); end
வரி 628 ⟶ 620:
for _, v in ipairs( possible ) do
v = v:gsub( "#", "" );
if is_set(args[v] ~= nil) then
if value ~= nil and selected ~= v then
table.insert( error_list, v );
வரி 638 ⟶ 630:
end
end
 
for _, v in ipairs( possible ) do
if index ~= nil then
v = v:gsub( "#", index );
end
if is_set(args[v] ~= nil) then
if value ~= nil and selected ~= v then
table.insert( error_list, v );
else
வரி 652 ⟶ 644:
end
end
 
if #error_list > 0 then
local error_str = "";
for _, k in ipairs( error_list ) do
if error_str ~= "" then error_str = error_str .. ", "cfg.messages['parameter-separator'] end
error_str = error_str .. "<code>|"wrap( ..'parameter', k .. "=</code>");
end
if #error_list > 1 then
error_str = error_str .. ", and "cfg.messages['parameter-final-separator'];
else
error_str = error_str .. " and "cfg.messages['parameter-pair-separator'];
end
error_str = error_str .. "<code>|"wrap( ..'parameter', selected .. "=</code>");
table.insert( z.message_tail, { seterror( error_condition, {error_str}, true ) } );
end
return value, selected;
end
 
-- COinS metadata (see <http://ocoins.info/>) allows automated tools to parse
-- the citation information.
function COinS(data)
if 'table' ~= type(data) or nil == next(data) then
return '';
end
local ctx_ver = "Z39.88-2004";
-- treat table strictly as an array with only set values.
local OCinSoutput = setmetatable( {}, {
__newindex = function(self, key, value)
if is_set(value) then
rawset( self, #self+1, table.concat{ key, '=', mw.uri.encode( removewikilink( value ) ) } );
end
end
});
if is_set(data.Chapter) then
OCinSoutput.rft_val_fmt = "info:ofi/fmt:kev:mtx:book";
OCinSoutput["rft.genre"] = "bookitem";
OCinSoutput["rft.btitle"] = data.Chapter;
OCinSoutput["rft.atitle"] = data.Title;
elseif is_set(data.Periodical) then
OCinSoutput.rft_val_fmt = "info:ofi/fmt:kev:mtx:journal";
OCinSoutput["rft.genre"] = "article";
OCinSoutput["rft.jtitle"] = data.Periodical;
OCinSoutput["rft.atitle"] = data.Title;
else
OCinSoutput.rft_val_fmt = "info:ofi/fmt:kev:mtx:book";
OCinSoutput["rft.genre"] = "book"
OCinSoutput["rft.btitle"] = data.Title;
end
OCinSoutput["rft.place"] = data.PublicationPlace;
OCinSoutput["rft.date"] = data.Date;
OCinSoutput["rft.series"] = data.Series;
OCinSoutput["rft.volume"] = data.Volume;
OCinSoutput["rft.issue"] = data.Issue;
OCinSoutput["rft.pages"] = data.Pages;
OCinSoutput["rft.edition"] = data.Edition;
OCinSoutput["rft.pub"] = data.PublisherName;
for k, v in pairs( data.ID_list ) do
local id, value = cfg.id_handlers[k].COinS;
if k == 'ISBN' then value = cleanisbn( v ); else value = v; end
if string.sub( id or "", 1, 4 ) == 'info' then
OCinSoutput["rft_id"] = table.concat{ id, "/", v };
else
OCinSoutput[ id ] = value;
end
end
local last, first;
for k, v in ipairs( data.Authors ) do
last, first = v.last, v.first;
if k == 1 then
if is_set(last) then
OCinSoutput["rft.aulast"] = last;
end
if is_set(first) then
OCinSoutput["rft.aufirst"] = first;
end
end
if is_set(last) and is_set(first) then
OCinSoutput["rft.au"] = table.concat{ last, ", ", first };
elseif is_set(last) then
OCinSoutput["rft.au"] = last;
end
end
OCinSoutput.rft_id = data.URL;
OCinSoutput.rfr_id = table.concat{ "info:sid/", mw.site.server:match( "[^/]*$" ), ":", data.RawPage };
OCinSoutput = setmetatable( OCinSoutput, nil );
-- sort with version string always first, and combine.
table.sort( OCinSoutput );
table.insert( OCinSoutput, 1, "ctx_ver=" .. ctx_ver ); -- such as "Z39.88-2004"
return table.concat(OCinSoutput, "&");
end
 
வரி 686 ⟶ 759:
local PPrefix = A['PPrefix']
local PPPrefix = A['PPPrefix']
if is_set( nil ~= A['NoPP'] ) then PPPrefix = "" PPrefix = "" end
-- Pick out the relevant fields from the arguments. Different citation templates
வரி 715 ⟶ 788:
local TitleType = A['TitleType'];
local ArchiveURL = A['ArchiveURL'];
local URL = A['URL'];
local URLorigin = A:ORIGIN('URL');
local ChapterURL = A['ChapterURL'];
local ChapterURLorigin = A:ORIGIN('ChapterURL');
local ConferenceURL = A['ConferenceURL'];
local ConferenceURLorigin = A:ORIGIN('ConferenceURL');
local Periodical = A['Periodical'];
if ( config.CitationClass == "encyclopaedia" ) then
if not is_set( Chapter == nil or Chapter == '' ) then
if not is_set(Title == nil or Title == "") then
Title = Periodical;
Periodical = nil'';
else
Chapter = Title
TransChapter = TransTitle
Title = nil '';
TransTitle = nil'';
end
end
வரி 737 ⟶ 813:
local Volume = A['Volume'];
local Issue = A['Issue'];
local Position = nil'';
local Page, Pages, At, page_type;
வரி 743 ⟶ 819:
Pages = hyphentodash( A['Pages'] );
At = A['At'];
if Page ~= nil then
if Pages ~= nil or At ~= nilis_set(Page) then
if is_set(Pages) or is_set(At) then
Page = Page .. " " .. seterror('extra_pages');
Pages = nil'';
At = nil'';
end
elseif is_set(Pages ~= nil) then
if is_set(At ~= nil) then
Pages = Pages .. " " .. seterror('extra_pages');
At = nil'';
end
end
local Edition = A['Edition'];
local PublicationPlace = A['PublicationPlace']
local Place = A['Place'];
if PublicationPlace == nil and Place ~= nil then
if not is_set(PublicationPlace) and is_set(Place) then
PublicationPlace = Place;
end
if PublicationPlace == Place then Place = nil end
if PublicationPlace == Place then Place = ''; end
local PublisherName = A['PublisherName'];
வரி 772 ⟶ 851:
local DeadURL = A['DeadURL']
local Language = A['Language'];
local Format = A['Format'];
local Ref = A['Ref'];
 
local DoiBroken = A['DoiBroken'];
local ID = A['ID'];
local ASINTLD = A['ASINTLD'];
local IgnoreISBN = A['IgnoreISBN'];
 
local ID_list = extractids( args );
local Quote = A['Quote'];
local PostScript = A['PostScript'];
local LaySummaryLayURL = A['LaySummaryLayURL'];
local LaySource = A['LaySource'];
local Transcript = A['Transcript'];
local TranscriptURL = A['TranscriptURL'];
local sepcTranscriptURLorigin = A[:ORIGIN('SeparatorTranscriptURL']);
local LastAuthorAmpsepc = A['LastAuthorAmpSeparator'];
local no_tracking_catsLastAuthorAmp = A['NoTrackingLastAuthorAmp'] or "";
local no_tracking_cats = A['NoTracking'];
 
local this_page = mw.title.getCurrentTitle(); --Also used for COinS
if no_tracking_cats == "" then
if not is_set(no_tracking_cats) then
for k, v in pairs( cfg.uncategorized_namespaces ) do
if this_page.nsText == v then
வரி 802 ⟶ 883:
end
 
if ( config.CitationClass == "journal" ) then
if not is_set(URL) ==and nil or URL == ""is_set(ID_list['PMC']) then
iflocal (ID_listEmbargo = A['PMCEmbargo'] ~= nil) then ;
if local is_set(Embargo) = A['Embargo'];then
iflocal Embargolang ~= nil thenmw.getContentLanguage();
local good1, result1, good2, local lang = mw.getContentLanguage()result2;
good1, result1 = pcall( local good1lang.formatDate, result1lang, good2'U', result2Embargo );
good1good2, result1result2 = pcall( lang.formatDate, lang, 'U', Embargo );
good2, result2 = pcall( lang.formatDate, lang, 'U' );
if good1 and good2 and tonumber( result1 ) < tonumber( result2 ) then
 
URL = "http://www.ncbi.nlm.nih.gov/pmc/articles/PMC" .. ID_list['PMC'];
if good1 and good2 and tonumber( result1 ) < tonumber( result2 ) then
URLURLorigin = "http://wwwcfg.ncbi.nlm.nih.gov/pmc/articles/PMC" .. ID_listid_handlers['PMC'].parameters[1];
end
else
URL = "http://www.ncbi.nlm.nih.gov/pmc/articles/PMC" .. ID_list['PMC'];
end
else
URL = "http://www.ncbi.nlm.nih.gov/pmc/articles/PMC" .. ID_list['PMC'];
URLorigin = cfg.id_handlers['PMC'].parameters[1];
end
end
வரி 825 ⟶ 906:
-- Account for the oddity that is {{cite conference}}, before generation of COinS data.
if is_set( BookTitle ) then
Chapter = Title;
ChapterLink = TitleLink;
TransChapter = TransTitle;
Title = BookTitle;
TitleLink = nil'';
TransTitle = nil'';
end
-- Account for the oddity that is {{cite episode}}, before generation of COinS data.
if config.CitationClass == "episode" then
local AirDate = A['AirDate'];
local SeriesLink = A['SeriesLink'];
local Season = A['Season'];
local SeriesNumber = A['SeriesNumber'];
local Network = A['Network'];
local Station = A['Station'];
local s, n = {}, {};
local Sep = (first_set(A["SeriesSeparator"], A["Separator"]) or "") .. " ";
if Issue ~= nil then table.insert(s, cfg.message_list["episode"] .. " " .. Issue) Issue = nil end
if Season ~= nil then table.insert(s, cfg.message_list["season"] .. " " .. Season) end
if SeriesNumber ~= nilis_set(Issue) then table.insert(s, cfg.message_listmessages["seriesepisode"] .. " " .. SeriesNumberIssue); Issue = ''; end
if is_set(Season) then table.insert(s, cfg.messages["season"] .. " " .. Season); end
local n = {}
if Network ~= nilis_set(SeriesNumber) then table.insert(ns, Networkcfg.messages["series"] .. " " .. SeriesNumber); end
if Station ~= nilis_set(Network) then table.insert(n, StationNetwork); end
if is_set(Station) then table.insert(n, Station); end
Date = Date or AirDate
Chapter = Title
ChapterLinkDate = TitleLinkDate or AirDate;
TransChapterChapter = TransTitleTitle;
TitleChapterLink = SeriesTitleLink;
TitleLinkTransChapter = SeriesLinkTransTitle;
TransTitleTitle = nilSeries;
TitleLink = SeriesLink;
local Sep = (A["SeriesSeparator"] or A["Separator"]) .. " "
SeriesTransTitle = table.concat(s, Sep)'';
ID = table.concat(n, Sep)
Series = table.concat(s, Sep);
ID = table.concat(n, Sep);
end
-- These data form a COinS tagmetadata (see <http://ocoins.info/>) which allows for
-- automated toolsparsing to parse theof citation information.
local OCinSoutput = COinS{
local OCinSdata = {} -- COinS metadata excluding id, bibcode, doi, etc.
['Periodical'] = Periodical,
local ctx_ver = "Z39.88-2004"
['Chapter'] = Chapter,
OCinSdata.rft_val_fmt = "info:ofi/fmt:kev:mtx:book"
if ( nil ~= Periodical['Title'] )= thenTitle,
['PublicationPlace'] = PublicationPlace,
OCinSdata.rft_val_fmt = "info:ofi/fmt:kev:mtx:journal"
['Date'] = first_set(Date, Year, PublicationDate),
OCinSdata["rft.genre"] = "article"
OCinSdata["rft.jtitle"'Series'] = PeriodicalSeries,
['Volume'] = Volume,
if ( nil ~= Title ) then OCinSdata["rft.atitle"] = Title end
['Issue'] = Issue,
end
['Pages'] = first_set(Page, Pages, At),
if ( nil ~= Chapter and "" ~= Chapter) then
['Edition'] = Edition,
OCinSdata.rft_val_fmt = "info:ofi/fmt:kev:mtx:book"
OCinSdata["rft.genre"'PublisherName'] = "bookitem"PublisherName,
OCinSdata["rft.btitle"'URL'] = Chapterfirst_set( URL, ChapterURL ),
['Authors'] = a,
if ( nil ~= Title ) then OCinSdata["rft.atitle"] = Title end
['ID_list'] = ID_list,
else
OCinSdata["rft.genre"'RawPage'] = "book"this_page.prefixedText,
};
if ( nil ~= Title ) then OCinSdata["rft.btitle"] = Title end
end
OCinSdata["rft.place"] = PublicationPlace
OCinSdata["rft.date"] = Date or Year or PublicationDate
OCinSdata["rft.series"] = Series
OCinSdata["rft.volume"] = Volume
OCinSdata["rft.issue"] = Issue
OCinSdata["rft.pages"] = Page or Pages or At
OCinSdata["rft.edition"] = Edition
OCinSdata["rft.pub"] = PublisherName
for k, v in pairs( ID_list ) do
if k == 'ISBN' then
v = cleanisbn( v );
end
if string.sub( cfg.id_handlers[k].COinS or "info", 1, 4 ) ~= 'info' then
OCinSdata[ cfg.id_handlers[k].COinS ] = v;
end
end
OCinSdata.rft_id = URL or ChapterURL
 
if is_set(Periodical) and not is_set(Chapter) and is_set(Title) then
local last, first;
local OCinSauthors Chapter = {}Title;
for k, v in ipairs(ChapterLink a= ) doTitleLink;
lastTransChapter = v.lastTransTitle;
firstTitle = v.first'';
if kTitleLink == 1 then'';
TransTitle if last ~= nil then'';
OCinSdata["rft.aulast"] = last;
end
if first ~= nil then
OCinSdata["rft.aufirst"] = first;
end
end
if last ~= nil and first ~= nil then
table.insert( OCinSauthors, last .. ", " .. first );
elseif last ~= nil then
table.insert( OCinSauthors, last );
end
end
 
local OCinSids = {} -- COinS data only for id, bibcode, doi, pmid, etc.
for k, v in pairs( ID_list ) do
if string.sub( cfg.id_handlers[k].COinS or "", 1, 4 ) == 'info' then
OCinSids[ cfg.id_handlers[k].COinS ] = v;
end
end
 
local OCinStitle = "ctx_ver=" .. ctx_ver -- such as "Z39.88-2004"
for name,value in pairs(OCinSdata) do
OCinStitle = OCinStitle .. "&" .. name .. "=" .. mw.uri.encode( removewikilink(value) );
end
for _, value in ipairs(OCinSauthors) do
OCinStitle = OCinStitle .. "&rft.au=" .. mw.uri.encode( removewikilink(value) );
end
for name,value in pairs(OCinSids) do
OCinStitle = OCinStitle .. "&rft_id=" .. mw.uri.encode(name .. "/" .. removewikilink(value) );
end
OCinStitle = OCinStitle .. "&rfr_id=info:sid/" .. mw.site.server:match( "[^/]*$" ) .. ":"
.. this_page.prefixedText -- end COinS data by page's non-encoded pagename
 
if (Periodical ~= nil and Periodical ~= "") and
(Chapter == nil or Chapter == '') and
(Title ~= nil and Title ~= "") then
Chapter = Title
ChapterLink = TitleLink
TransChapter = TransTitle
Title = nil
TitleLink = nil
TransTitle = nil
end
 
வரி 955 ⟶ 975:
-- We also add leading spaces and surrounding markup and punctuation to the
-- various parts of the citation, but only when they are non-nil.
if not is_set( Authors == nil ) then
local Maximum = tonumber( A['DisplayAuthors'] );
-- Preserve old-style implicit et al.
if not is_set(Maximum == nil) and #a == 9 then
Maximum = 8;
table.insert( z.message_tail, { seterror('implict_etal_author', {}, true ) } );
elseif not is_set(Maximum == nil) then
Maximum = #a + 1;
end
வரி 968 ⟶ 988:
local control = {
sep = A["AuthorSeparator"] .. " ",
namesep = (first_set(A["AuthorNameSeparator"] or, A["NameSeparator"]) or "") .. " ",
format = A["AuthorFormat"],
maximum = Maximum,
lastauthoramp = LastAuthorAmp
};
-- If the coauthor field is also used, prevent ampersand and et al. formatting.
if is_set(Coauthors ~= nil and Coauthors ~= "") then
control.lastauthoramp = nil;
control.maximum = #a + 1;
end
Authors = listpeople(control, a)
end
local EditorCount
if not is_set( Editors == nil ) then
local Maximum = tonumber( A['DisplayEditors'] );
 
-- Preserve old-style implicit et al.
if not is_set(Maximum == nil) and #e == 4 then
Maximum = 3;
table.insert( z.message_tail, { seterror('implict_etal_editor', {}, true) } );
elseif not is_set(Maximum == nil) then
Maximum = #e + 1;
end
வரி 996 ⟶ 1,016:
local control = {
sep = A["EditorSeparator"] .. " ",
namesep = (first_set(A["EditorNameSeparator"] or, A["NameSeparator"]) or "") .. " ",
format = A['EditorFormat'],
maximum = Maximum,
lastauthoramp = LastAuthorAmp
};
 
Editors, EditorCount = listpeople(control, e) ;
else
EditorCount = 1;
end
if ( Date == nil or Date == "") then
if not is_set(Date) then
-- there's something hinky with how this adds dashes to perfectly-good free-standing years
--[[ Date = Year;
if is_set( Date ~= nil ) then
local Month = args.monthA['Month'];
if is_set( Month == nil ) then
local BeganDate = argsMonth .began. " " .. Date;
local Ended = args.ended
if Began ~= nil and Ended ~= nil then
Month = Began .. "&ndash;" .. Ended
else
Month = "&ndash;"
end
end
Date = Month .. " " .. Date
local Day = args.day
if ( Day ~= nil ) then Date = Day .. " " .. Date end
end
]] -- so let's use the original version for now
Date = Year
if ( Date ~= nil and Date ~="") then
local Month = A['Month']
if ( Month ~= nil and Month ~= "") then
Date = Month .. " " .. Date
local Day = A['Day']
if is_set( Day ~= nil ) then Date = Day .. " " .. Date end
else Month = ""
end
else Date = ""
end
end
if ( PublicationDate == Date or PublicationDate == Year ) then PublicationDate = nil end
if( inArray(Date == nil orPublicationDate, {Date, == ""Year}) andthen PublicationDate ~= nil ) then''; end
if not is_set(Date) and is_set(PublicationDate) then
Date = PublicationDate;
PublicationDate = nil'';
end
 
-- Captures the value for Date prior to adding parens or other textual transformations
local DateIn = Date;
if ( URL == nil ornot is_set(URL == '' ) and
not is_set( ChapterURL == nil or ChapterURL == '' ) and
not is_set( ArchiveURL == nil or ArchiveURL == '' ) and
not is_set( ConferenceURL == nil or ConferenceURL == '' ) and
not is_set( TranscriptURL == nil or TranscriptURL == '' ) then
 
-- Test if cite web is called without giving a URL
if ( config.CitationClass == "web" ) then
table.insert( z.message_tail, { seterror( 'cite_web_url', {}, true ) } );
end
 
-- Test if accessdate is given without giving a URL
if is_set( AccessDate ~= nil and AccessDate ~= '' ) then
table.insert( z.message_tail, { seterror( 'accessdate_missing_url', {}, true ) } );
AccessDate = nil'';
end
-- Test if format is given without giving a URL
if is_set( Format ~= nil and Format ~= '' ) then
Format = Format .. seterror( 'format_missing_url' );
end
end
 
-- Test if citation has no title
if ( Chapter == nil ornot is_set(Chapter == "" ) and
not is_set( Title == nil or Title == "" ) and
not is_set( Periodical == nil or Periodical == "" ) and
not is_set( Conference == nil or Conference == "" ) and
not is_set( TransTitle == nil or TransTitle == "" ) and
not is_set( TransChapter == nil or TransChapter == "" ) then
table.insert( z.message_tail, { seterror( 'citation_missing_title', {}, true ) } );
end
 
if ( Format ~= nilis_set(Format) and " (" .. Format ~=.. ")" )or then"";
Format = " (" .. Format .. ")" else Format = "" end
local OriginalURL = URL
வரி 1,089 ⟶ 1,090:
end
end
 
-- Format chapter / article title
if is_set( Chapter ~= nil and Chapter ~= "" ) and is_set( ChapterLink and "" < ChapterLink ) then
Chapter = "[[" .. ChapterLink .. "|" .. Chapter .. "]]";
end
if is_set( Periodical and "" < Periodical ) and is_set(Title ~= nil and Title ~= "" ) then
Chapter = wrap( 'italic-title', Chapter );
TransChapter = wrap( 'trans-italic-title', TransChapter );
வரி 1,103 ⟶ 1,104:
local TransError = ""
if is_set(TransChapter ~= "" and Chapter == "") then
if not is_set(Chapter) then
TransError = " " .. seterror( 'trans_missing_chapter' );
TransError = " " .. seterror( 'trans_missing_chapter' );
else
TransChapter = " " .. TransChapter;
end
end
ifChapter TransChapter ~= "" and Chapter ~= "" then TransChapter = " " .. TransChapter; end
Chapter = Chapter .. TransChapter
if is_set(Chapter ~= "") then
if not is_set( ChapterLink == nil ) then
if is_set( ChapterURL and "" < ChapterURL ) then
Chapter = externallink( ChapterURL, Chapter ) .. TransError;
if URL == nil ornot is_set(URL == "") then
Chapter = Chapter .. Format;
Format = "";
end
elseif is_set( URL and "" < URL ) then
Chapter = externallink( URL, Chapter ) .. TransError .. Format;
URL = nil"";
Format = "";
else
Chapter = Chapter .. TransError;
end
elseif is_set(ChapterURL ~= nil and ChapterURL ~= "") then
Chapter = Chapter .. " " .. externallink( ChapterURL, nil, ChapterURLorigin ) ..
TransError;
else
வரி 1,132 ⟶ 1,136:
end
Chapter = Chapter .. sepc .. " " -- with end-space
elseif is_set(ChapterURL ~= nil and ChapterURL ~= "") then
Chapter = " " .. externallink( ChapterURL, nil, ChapterURLorigin ) .. sepc .. " ";
end
-- Format main title.
if is_set( TitleLink) and "" < TitleLink is_set(Title) then
ifTitle (= Title"[[" and.. TitleLink .. "|" <.. Title ).. then"]]"
Title = "[[" .. TitleLink .. "|" .. Title .. "]]"
end
end
 
if is_set( Periodical and "" < Periodical ) then
Title = wrap( 'quoted-title', Title );
TransTitle = wrap( 'trans-quoted-title', TransTitle );
elseif inArray( config.CitationClass, == {"web","news","pressrelease"}) and
ornot config.CitationClass == "news"is_set(Chapter) then
or config.CitationClass == "pressrelease" ) and
Chapter == "" then
Title = wrap( 'quoted-title', Title );
TransTitle = wrap( 'trans-quoted-title', TransTitle );
வரிசை 1,157:
end
local TransError = "";
if is_set(TransTitle ~= "" and Title == "") then
if not is_set(Title) then
TransError = " " .. seterror( 'trans_missing_title' );
TransError = " " .. seterror( 'trans_missing_title' );
else
TransTitle = " " .. TransTitle;
end
end
ifTitle TransTitle ~= "" and Title ~= "" then TransTitle = " " .. TransTitle; end
Title = Title .. TransTitle
if is_set(Title ~= "") then
if not is_set( TitleLink == nil) and is_set(URL and "" < URL ) then
Title = externallink( URL, Title ) .. TransError .. Format
URL = nil"";
Format = ''"";
else
Title = Title .. TransError;
end
end
 
if is_set( Place ~= nil and Place ~= "" ) then
if sepc == '.' then
Place = " " .. wrap( 'written', Place ) .. sepc .. " ";
else
Place = " " .. substitute( cfg.message_listmessages['written']:lower(), {Place} ) .. sepc .. " ";
end
else
Place = "";
end
if is_set( Conference ~= nil and Conference ~="" ) then
if is_set( ConferenceURL ~= nil ) then
Conference = externallink( ConferenceURL, Conference );
end
Conference = " " .. Conference
elseif is_set(ConferenceURL ~= nil and ConferenceURL ~= "") then
Conference = " " .. externallink( ConferenceURL, nil, ConferenceURLorigin );
else
Conference = ""
end
if ( nil ~= Position or nil ~= Page or nil ~= Pages ) then At = nil end
if not is_set( nil == Position and "" ~= Position ) then
local Minutes = A['Minutes'];
if is_set( nil ~= Minutes ) then
Position = " " .. Minutes .. " " .. cfg.message_listmessages['minutes'];
else
local Time = A['Time'];
if is_set( nil ~= Time ) then
local TimeCaption = A['TimeCaption']
if not is_set(TimeCaption == nil) then
TimeCaption = cfg.message_listmessages['event'];
if sepc ~= '.' then
TimeCaption = TimeCaption:lower();
end
end
Position = " " .. TimeCaption .. " " .. Time;
else
Position = ""
end
end
else
Position = " " .. Position;
At = '';
end
if ( nil == Page or "" == Page ) then
if not is_set(Page) = "" then
if is_set( nil == Pages or "" == Pages) then
Pagesif =is_set(Periodical) ""and
not inArray(config.CitationClass, {"encyclopaedia","web","book","news"}) then
elseif ( Periodical ~= nil and Periodical ~= "" and
Pages config.CitationClass ~= "encyclopaedia: " and.. Pages;
elseif config.CitationClasstonumber(Pages) ~= "web"nil andthen
Pages config.CitationClass ~= sepc .."book " and.. PPrefix .. Pages;
config.CitationClass ~= "news") thenelse
Pages = sepc ..": " .. PPPrefix .. Pages;
else
if ( tonumber(Pages) ~= nil ) then
Pages = sepc .." " .. PPrefix .. Pages
else Pages = sepc .." " .. PPPrefix .. Pages
end
end
else
Pagesif =is_set(Periodical) ""and
not inArray(config.CitationClass, {"encyclopaedia","web","book","news"}) then
if ( Periodical ~= nil and Periodical ~= "" and
Page config.CitationClass ~= "encyclopaedia: " and.. Page;
config.CitationClass ~= "web" and
config.CitationClass ~= "book" and
config.CitationClass ~= "news") then
Page = ": " .. Page
else
Page = sepc .." " .. PPrefix .. Page;
end
end
if ( At ~= nil and At ~="") then At = sepc .. " " .. At
else At = is_set(At) and (sepc .. " " end.. At) or "";
Others = is_set(Others) and (sepc .. " " .. Others) or "";
if ( Coauthors == nil ) then Coauthors = "" end
ifTitleType = is_set(TitleType) Othersand ~=(" nil(" and.. OthersTitleType .. ~=")" ) thenor "";
TitleNote = is_set(TitleNote) and Others = (sepc .. " " .. OthersTitleNote) else Others =or "" end;
Language = is_set(Language) and (" " .. wrap( 'language', Language )) or "";
if ( TitleType ~= nil and TitleType ~="" ) then
Edition = is_set(Edition) and (" " .. wrap( 'edition', Edition )) or "";
TitleType = " (" .. TitleType .. ")" else TitleType = "" end
ifIssue = is_set(Issue) TitleNoteand ~=(" nil(" and.. TitleNoteIssue .. ~=")" ) thenor "";
Series = is_set(Series) and TitleNote = (sepc .. " " .. TitleNoteSeries) else TitleNote =or "" end;
ifOrigYear = is_set(OrigYear) Languageand ~=(" nil[" and.. LanguageOrigYear .. ~="]" ) thenor "";
Agency = is_set(Agency) and Language(sepc =.. " " .. wrap( 'language', Language Agency) else Language =or "" end;
if ( Edition ~= nil and Edition ~="" ) then
if is_set(Volume) then
Edition = " " .. wrap( 'edition', Edition ) else Edition = "" end
if ( Volume ~= nil and Volume ~="" )
then
if ( mw.ustring.len(Volume) > 4 )
then Volume = sepc .." " .. Volume;
else Volume = " <b>" .. hyphentodash(Volume) .. "</b>";
end
else Volume = "" end
if ( Issue ~= nil and Issue ~="" ) then
Issue = " (" .. Issue .. ")" else Issue = "" end
if ( Series ~= nil and Series ~="" ) then
Series = sepc .. " " .. Series else Series = "" end
if ( OrigYear ~= nil and OrigYear ~="" ) then
OrigYear = " [" .. OrigYear .. "]" else OrigYear = "" end
if ( Agency ~= nil and Agency ~="" ) then
Agency = sepc .. " " .. Agency else Agency = "" end
------------------------------------ totally unrelated data
if is_set( Date ~= nil Via) then DateVia = Date" else" Date.. =wrap( 'via', ""Via ); end
if is_set( Via ~= nil and Via ~="" AccessDate) then
Vialocal retrv_text = " " .. wrap( cfg.messages['viaretrieved', Via ) else Via = "" end]
if ( AccessDatesepc ~= nil".") andthen AccessDateretrv_text ~="" retrv_text:lower() end
AccessDate = '<span class="reference-accessdate">' .. sepc
then local retrv_text = " " .. cfg.message_list['retrieved']
if (sepc ~= "."). thensubstitute( retrv_text, ={AccessDate} retrv_text:lower() end.. '</span>'
AccessDate = '<span class="reference-accessdate">' .. sepc
.. substitute( retrv_text, {AccessDate} ) .. '</span>'
else AccessDate = "" end
if ( SubscriptionRequired ~= nil and
SubscriptionRequired ~= "" ) then
SubscriptionRequired = sepc .. " " .. cfg.message_list['subscription'];
else
SubscriptionRequired = ""
end
if ( ID ~= nil and ID ~="") then ID = sepc .." ".. ID else ID="" end
if is_set(SubscriptionRequired) then
 
SubscriptionRequired = sepc .. " " .. cfg.messages['subscription'];
end
if is_set(ID) then ID = sepc .." ".. ID; end
ID_list = buildidlist( ID_list, {DoiBroken = DoiBroken, ASINTLD = ASINTLD, IgnoreISBN = IgnoreISBN} );
 
if is_set( URL ~= nil and URL ~="") then
URL = " " .. externallink( URL, nil, URLorigin );
else
URL = ""
end
 
if is_set( Quote and Quote ~="" ) then
if Quote:sub(1,1) == '"' and Quote:sub(-1,-1) == '"' then
Quote = Quote:sub(2,-2);
end
Quote = sepc .." " .. wrap( 'quoted-text', Quote );
PostScript = "";
elseif PostScript:lower() == "none" then
else
if ( PostScript == nil) then PostScript = "" end;
Quote = ""
end
local Archived
if is_set( nil ~= ArchiveURL and "" ~= ArchiveURL ) then
if not is_set( ArchiveDate == nil or ArchiveDate =="" ) then
ArchiveDate = seterror('archive_missing_date');
end
if ( "no" == DeadURL ) then
local arch_text = cfg.message_listmessages['archived'];
if (sepc ~= ".") then arch_text = arch_text:lower() end
Archived = sepc .. " " .. substitute( cfg.message_listmessages['archived-not-dead'],
{ externallink( ArchiveURL, arch_text ), ArchiveDate } );
if not is_set(OriginalURL == nil or OriginalUrl == '') then
Archived = Archived .. " " .. seterror('archive_missing_url');
end
elseif is_set(OriginalURL) then
local arch_text = cfg.messages['archived-dead'];
if sepc ~= "." then arch_text = arch_text:lower() end
Archived = sepc .. " " .. substitute( arch_text,
{ externallink( OriginalURL, cfg.messages['original'] ), ArchiveDate } );
else
local arch_text = cfg.messages['archived-missing'];
if OriginalURL ~= nil and OriginalURL ~= '' then
if sepc ~= "." localthen arch_text = cfg.message_list['archived-dead'];arch_text:lower() end
Archived = if (sepc ~=.. ". ") then.. arch_text =substitute( arch_text:lower(), end
{ seterror('archive_missing_url'), ArchiveDate } );
Archived = sepc .. " " .. substitute( arch_text,
{ externallink( OriginalURL, cfg.message_list['original'] ), ArchiveDate } );
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
else
Archived = ""
end
local Lay
if is_set( nil ~= LaySummary and "" ~= LaySummary LayURL) then
if is_set( LayDate ~= nil ) then LayDate = " (" .. LayDate .. ")" else LayDate = "" end
if is_set( LaySource ~= nil ) then
LaySource = " &ndash; ''" .. safeforitalics(LaySource) .. "''" ;
else
LaySource = "" ;
end
if sepc == '.' then
Lay = sepc .. " " .. externallink( LaySummaryLayURL, cfg.message_listmessages['lay summary'] ) .. LaySource .. LayDate
else
Lay = sepc .. " " .. externallink( LaySummaryLayURL, cfg.message_listmessages['lay summary']:lower() ) .. LaySource .. LayDate
end
else
Lay = "";
end
if ( nil ~= Transcript and "" ~= Transcript ) then
if is_set(Transcript) then
if ( TranscriptURL ~= nil ) then Transcript = externallink( TranscriptURL, Transcript ) end
elseif TranscriptURL ~= nil andif is_set(TranscriptURL) then Transcript ~= ""externallink( thenTranscriptURL, Transcript ); end
elseif Transcript = externallinkis_set( TranscriptURL ) then
Transcript = externallink( TranscriptURL, nil, TranscriptURLorigin );
else
Transcript = ""
end
local Publisher = ""
local Publisher;
if ( Periodical and Periodical ~= "" and
if is_set(Periodical) and
config.CitationClass ~= "encyclopaedia" and
not inArray(config.CitationClass, ~= {"encyclopaedia","web","pressrelease"}) andthen
if config.CitationClass ~= "pressrelease" is_set(PublisherName) then
if ( PublisherName ~= nil and PublisherName ~=""if is_set(PublicationPlace) then
if (PublicationPlace ~= nil and PublicationPlace ~= '') then
Publisher = PublicationPlace .. ": " .. PublisherName;
else
Publisher = PublisherName;
end
elseif is_set(PublicationPlace ~= nil and PublicationPlace ~= '') then
Publisher= PublicationPlace;
else
Publisher = "";
end
if is_set( PublicationDate and PublicationDate ~="" ) then
if is_set(Publisher ~= '') then
Publisher = Publisher .. ", " .. wrap( 'published', PublicationDate );
else
வரி 1,387 ⟶ 1,358:
end
end
if is_set(Publisher ~= "") then
Publisher = " (" .. Publisher .. ")";
end
else
if is_set( PublicationDate and PublicationDate ~="" ) then
PublicationDate = " (" .. wrap( 'published', PublicationDate ) .. ")";
else
PublicationDate = ""
end
if is_set( PublisherName ~= nil and PublisherName ~="" ) then
if is_set(PublicationPlace ~= nil and PublicationPlace ~= '') then
Publisher = sepc .. " " .. PublicationPlace .. ": " .. PublisherName .. PublicationDate;
else
Publisher = sepc .. " " .. PublisherName .. PublicationDate;
end
elseif is_set(PublicationPlace ~= nil and PublicationPlace ~= '') then
Publisher= sepc .. " " .. PublicationPlace .. PublicationDate;
else
வரி 1,408 ⟶ 1,377:
end
end
-- Several of the above rely upon detecting this as nil, so do it last.
if is_set( Periodical ~= nil and Periodical ~="" ) then
if is_set( Title and Title ~= "" ) or is_set( TitleNote and TitleNote ~= "" ) then
Periodical = sepc .. " " .. wrap( 'italic-title', Periodical )
else
Periodical = wrap( 'italic-title', Periodical )
end
else Periodical = "" end
 
-- Piece all bits together at last. Here, all should be non-nil.
வரி 1,422 ⟶ 1,392:
 
local tcommon
if ( ( inArray(config.CitationClass, == {"journal") or (config.CitationClass == ,"citation"}) and is_set(Periodical) andthen
if Periodicalis_set(Others) then Others ~= Others .. sepc .. " " ) thenend
if (Others ~= "") then Others = Others .. sepc .. " " end
tcommon = safejoin( {Others, Title, TitleNote, Conference, Periodical, Format, TitleType, Series,
Language, Edition, Publisher, Agency, Volume, Issue, Position}, sepc );
வரி 1,436 ⟶ 1,405:
else
ID_list = ID;
end
local idcommon = safejoin( { ID_list, URL, Archived, AccessDate, Via, SubscriptionRequired, Lay, Quote }, sepc );
local text;
 
local textpgtext = Page .. Pages .. At;
local pgtext = Page .. Pages .. At
if is_set( "" ~= Authors ) then
if is_set(Coauthors ~= "") then
then Authors = Authors .. A['AuthorSeparator'] .. " " .. Coauthors
end
if is_set( "" ~= Date) )then
then Date = " ("..Date..")" .. OrigYear .. sepc .. " "
elseif string.sub(Authors,-1,-1) == sepc then
else
if ( string.sub(Authors,-1,-1) == sepc)Authors --check.. end" character"
else
then Authors = Authors .. " "
else Authors = Authors .. sepc .. " "
end
end
if is_set( "" ~= Editors) then
local in_text = " " .. cfg.messages['in'] .. " "
if (sepc =~= '.') then in_text = " In "in_text:lower() end
if (string.sub(Editors,-1,-1) == sepc)
then Editors = in_text .. Editors .. " "
வரி 1,464 ⟶ 1,432:
text = safejoin( {Authors, Date, Chapter, Place, Editors, tcommon }, sepc );
text = safejoin( {text, pgtext, idcommon}, sepc );
elseif is_set( "" ~= Editors) then
if is_set( "" ~= Date ) then
if EditorCount <= 1 then
Editors = Editors .. ", " .. cfg.message_listmessages['editor'];
else
Editors = Editors .. ", " .. cfg.message_listmessages['editors'];
end
Date = " (" .. Date ..")" .. OrigYear .. sepc .. " "
else
if EditorCount <= 1 then
Editors = Editors .. " (" .. cfg.message_listmessages['editor'] .. ")" .. sepc .. " "
else
Editors = Editors .. " (" .. cfg.message_listmessages['editors'] .. ")" .. sepc .. " "
end
end
வரி 1,482 ⟶ 1,450:
text = safejoin( {text, pgtext, idcommon}, sepc );
else
if is_set( "" ~= Date ) then
if ( string.sub(tcommon,-1,-1) ~= sepc )
then Date = sepc .." " .. Date .. OrigYear
else Date = " " .. Date .. OrigYear
end
end -- endif ""~=Date
if ( config.CitationClass=="journal" and is_set(Periodical ) then
text = safejoin( {Chapter, Place, tcommon}, sepc );
text = safejoin( {text, pgtext, Date, idcommon}, sepc );
else
text = safejoin( {Chapter, Place, tcommon, Date}, sepc );
text = safejoin( {text, pgtext, idcommon}, sepc );
end
end
if is_set(PostScript ~= '' and PostScript ~= nil) and PostScript ~= sepc then
text = safejoin( {text, sepc}, sepc ); --Deals with italics, spaces, etc.
text = text:sub(1,-2); --Remove final seperator
வரி 1,505 ⟶ 1,473:
 
-- Now enclose the whole thing in a <span/> element
if not is_set( Year == nil ) then
if is_set( DateIn ~= nil and DateIn ~= "" ) then
Year = selectyear( DateIn );
elseif is_set( PublicationDate ~= nil and PublicationDate ~= "" ) then
Year = selectyear( PublicationDate );
else
Year = ""
end
end
local classname = "citation"
local options = {};
if ( config.CitationClass ~= "citation" )
then classname = "citation " .. (config.CitationClass or "") end
if is_set(config.CitationClass) and config.CitationClass ~= "citation" then
local options = { class=classname }
options.class = "citation " .. config.CitationClass;
if ( Ref ~= nil ) then
else
options.class = "citation";
end
if is_set(Ref) and Ref:lower() ~= "none" then
local id = Ref
if ( "harv" == Ref ) then
local names = {} --table of last names & year
if is_set( "" ~= Authors ) then
for i,v in ipairs(a) do
names[i] = v.last
if i == 4 then break end
end
elseif is_set( "" ~= Editors ) then
for i,v in ipairs(e) do
names[i] = v.last
வரி 1,545 ⟶ 1,516:
end
if is_set(options.id ~= nil) then
text = '<span id="' .. wikiescapemw.uri.anchorEncode(options.id) ..'" class="' .. wikiescapemw.text.nowiki(options.class) .. '">' .. text .. "</span>";
else
text = '<span class="' .. wikiescapemw.text.nowiki(options.class) .. '">' .. text .. "</span>";
end
 
வரி 1,554 ⟶ 1,525:
-- Note: Using display: none on then COinS span breaks some clients.
local OCinS = '<span title="' .. wikiescape(OCinStitle)OCinSoutput .. '" class="Z3988">' .. empty_span .. '</span>';
text = text .. OCinS;
வரி 1,560 ⟶ 1,531:
text = text .. " ";
for i,v in ipairs( z.message_tail ) do
if is_set(v[1] ~= nil and v[1] ~= "") then
if i == #z.message_tail then
text = text .. errorcomment( v[1], v[2] );
வரி 1,571 ⟶ 1,542:
no_tracking_cats = no_tracking_cats:lower();
if inArray(no_tracking_cats, =={"", "no", or no_tracking_cats =="false", "non"}) orthen
no_tracking_cats == "false" or no_tracking_cats == "n" then
for _, v in ipairs( z.error_categories ) do
text = text .. '[[Category:' .. v ..']]';
வரி 1,588 ⟶ 1,558:
local suggestions = {};
local error_text, error_state;
 
local config = {};
for k, v in pairs( frame.args ) do
config[k] = v;
args[k] = v;
end
 
for k, v in pairs( pframe.args ) do
if v ~= '' then
வரி 1,612 ⟶ 1,589:
table.insert( z.message_tail, {error_text, error_state} );
end
end
args[k] = v;
elseif args[k] ~= nil or (k == 'postscript') then
args[k] = v;
end
end
 
local config = {};
for k, v in pairs( frame.args ) do
config[k] = v;
if args[k] == nil and (v ~= '' or k == 'postscript') then
args[k] = v;
end
"https://tamilar.wiki/w/Module:Citation/CS1" இலிருந்து மீள்விக்கப்பட்டது