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 = {};
}
-- Include translation message hooks, ID and error handling configuration settings.
-- Note that require has tested to be significantly faster than loadData for this
-- 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
function is_set( var )
return not (var == nil or var == '');
end
-- 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
-- Whether needle is in haystack
function inArray( needle, haystack )
if needle == nil then
end
for n,v in ipairs( haystack ) do
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(
if
return "";
elseif inArray( key, { 'italic-title', 'trans-italic-title' } ) then
str = safeforitalics( str );
end
return substitute( cfg.
end
வரி 48 ⟶ 63:
]]
function argument_wrapper( args )
return origin[k];
end
},
{
__index = function ( tbl, k )
if origin[k] ~= nil then
return nil;
end
local args, list, v = args, cfg.
if list == nil then
error( cfg.
elseif type( list ) == 'string' then
v, origin[k] =
else
v, origin[k] = selectone(
if origin[k] == nil
origin[k] = ''; --Empty string, not nil;
end
end
if v == nil then
v = cfg.
origin[k] = ''; --Empty string, not nil;
end
tbl = rawset( tbl, k, v );
return v;
end,
});
end
வரி 100 ⟶ 122:
-- Formats a comment for error trapping
function errorcomment( content, hidden )
return wrap( hidden and 'hidden-error' or 'visible-error', content );
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
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 = message .. " ([[" .. cfg.messages['help page link'] ..
"#" .. error_state.anchor .. "|" ..
cfg.
z.error_ids[ error_id ] = true;
if inArray( error_id,
and z.error_ids['citation_missing_title'] then
return '', false;
end
message = table.concat({ prefix
if raw == true then
வரி 144 ⟶ 160:
return errorcomment( message, error_state.hidden );
end
-- Formats a wiki style external link
function externallinkid(options)
local
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]',
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]]',
options.
);
end
-- Format an external link with error checking
function externallink( URL, label, source )
local error_str = "";
if
label = URL;
if is_set( source ) then
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 });
end
-- Formats a link to Amazon
function amazon(id, domain)
if not is_set(
domain = "com"
elseif ( "jp" == domain or "uk" == domain ) then
வரி 213 ⟶ 220:
local text;
if is_set(
text = "[[" .. handler.link .. "|" .. handler.label .. "]]:" .. id;
table.insert( z.error_categories, "Pages with DOIs inactive since " .. selectyear(inactive) );
inactive = " (" .. cfg.
else
text = externallinkid({link = handler.link, label = handler.label,
வரி 261 ⟶ 268:
]]
function checkurl( url_str )
-- Protocol-relative or URL scheme
return url_str:sub(1,2) == "//" or url_str:match( "^[^/]*:" ) ~= nil;
end
வரி 312 ⟶ 311:
-- Gets the display text for a wikilink like [[A|B]] or [[B]] gives B
function removewikilink( str )
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( "[%[%]{}<>]" )
return str;
end
வரி 347 ⟶ 343:
tend to interact poorly under Mediawiki's HTML tidy. ]]
if
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.
return str;
else
வரி 467 ⟶ 463:
function listpeople(control, people)
local sep = control.sep;
local namesep = control.namesep
local format = control.format
வரி 474 ⟶ 469:
local text = {}
local etal = false;
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
local mask = person.mask
local one
local sep_one = sep;
if
etal = true;
break;
வரி 494 ⟶ 492:
one = person.last
local first = person.first
if is_set(first
if ( "vanc" == format ) then first = reducetoinitials(first) end
one = one .. namesep .. first
end
if is_set(person.link
end
table.insert( text, one )
வரி 507 ⟶ 505:
local count = #text / 2;
if count > 0 then
if count > 1 and is_set(lastauthoramp
text[#text-2] = " & ";
end
வரி 515 ⟶ 513:
local result = table.concat(text) -- construct list
if etal then
local etal_text = cfg.
result = result .. " " .. etal_text;
end
வரி 528 ⟶ 526:
-- Generates a CITEREF anchor ID.
function anchorid( options )
return "CITEREF" ..
end
வரி 538 ⟶ 536:
while true do
last = selectone( args, cfg.
if not is_set(
-- just in case someone passed in an empty parameter
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
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 = {};
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 = setmetatable( { ['id'] = v }, fallback(k) );
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
elseif k == 'DOI' then
table.insert( new_list, {handler.label, doi( v, options.DoiBroken ) } );
elseif k == 'ASIN' then
table.insert( new_list, {handler.label, amazon( v, options.ASINTLD ) } );
elseif k == 'OL' then
elseif k ==
local ISBN = internallinkid( handler );
if not checkisbn( v ) and not is_set(options.IgnoreISBN) then
end
table.insert( new_list, {handler.label, ISBN } );
else
error( cfg.
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]
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]
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 ..
error_str = error_str ..
end
if #error_list > 1 then
error_str = error_str ..
else
error_str = error_str ..
end
error_str = error_str ..
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(
-- 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(
if not is_set(Title
Title = Periodical;
Periodical =
else
Chapter = Title
TransChapter = TransTitle
Title =
TransTitle =
end
end
வரி 737 ⟶ 813:
local Volume = A['Volume'];
local Issue = A['Issue'];
local Position =
local Page, Pages, At, page_type;
வரி 743 ⟶ 819:
Pages = hyphentodash( A['Pages'] );
At = A['At'];
if is_set(Pages) or is_set(At) then
Page = Page .. " " .. seterror('extra_pages');
Pages =
At =
end
elseif is_set(Pages
if is_set(At
Pages = Pages .. " " .. seterror('extra_pages');
At =
end
end
local Edition = A['Edition'];
local PublicationPlace = A['PublicationPlace']
local Place = A['Place'];
if not is_set(PublicationPlace) and is_set(Place) then
PublicationPlace = Place;
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
local LaySource = A['LaySource'];
local Transcript = A['Transcript'];
local TranscriptURL = A['TranscriptURL']
local
local
local
local no_tracking_cats = A['NoTracking'];
local this_page = mw.title.getCurrentTitle(); --Also used for COinS
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)
if
local good1, result1, good2,
good1, result1 = pcall(
if good1 and good2 and tonumber( result1 ) < tonumber( result2 ) then
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(
Chapter = Title;
ChapterLink = TitleLink;
TransChapter = TransTitle;
Title = BookTitle;
TitleLink =
TransTitle =
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
if is_set(Season) then table.insert(s, cfg.messages["season"] .. " " .. Season); end
if
if
if is_set(Station) then table.insert(n, Station); end
TitleLink = SeriesLink;
Series = table.concat(s, Sep);
ID = table.concat(n, Sep);
end
--
-- automated
local OCinSoutput = COinS{
['Periodical'] = Periodical,
['Chapter'] = Chapter,
['PublicationPlace'] = PublicationPlace,
['Date'] = first_set(Date, Year, PublicationDate),
['Volume'] = Volume,
['Issue'] = Issue,
['Pages'] = first_set(Page, Pages, At),
['Edition'] = Edition,
['Authors'] = a,
['ID_list'] = ID_list,
};
if is_set(Periodical) and not is_set(Chapter) and is_set(Title) then
TransTitle
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(
local Maximum = tonumber( A['DisplayAuthors'] );
-- Preserve old-style implicit et al.
if not is_set(Maximum
Maximum = 8;
table.insert( z.message_tail, { seterror('implict_etal_author', {}, true ) } );
elseif not is_set(Maximum
Maximum = #a + 1;
end
வரி 968 ⟶ 988:
local control = {
sep = A["AuthorSeparator"] .. " ",
namesep = (first_set(A["AuthorNameSeparator"]
format = A["AuthorFormat"],
maximum = Maximum,
lastauthoramp = LastAuthorAmp
};
-- If the coauthor field is also used, prevent ampersand and et al. formatting.
if is_set(Coauthors
control.lastauthoramp = nil;
control.maximum = #a + 1;
end
Authors = listpeople(control, a)
end
local EditorCount
if not is_set(
local Maximum = tonumber( A['DisplayEditors'] );
-- Preserve old-style implicit et al.
if not is_set(Maximum
Maximum = 3;
table.insert( z.message_tail, { seterror('implict_etal_editor', {}, true) } );
elseif not is_set(Maximum
Maximum = #e + 1;
end
வரி 996 ⟶ 1,016:
local control = {
sep = A["EditorSeparator"] .. " ",
namesep = (first_set(A["EditorNameSeparator"]
format = A['EditorFormat'],
maximum = Maximum,
lastauthoramp = LastAuthorAmp
Editors, EditorCount = listpeople(control, e)
else
EditorCount = 1;
end
if not is_set(Date) then
if is_set(
local Month =
if is_set(
local Day = A['Day']
if is_set(
end
end
end
if
if not is_set(Date) and is_set(PublicationDate) then
Date = PublicationDate;
PublicationDate =
end
-- Captures the value for Date prior to adding parens or other textual transformations
local DateIn = Date;
if
not
not
not
not
-- 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(
table.insert( z.message_tail, { seterror( 'accessdate_missing_url', {}, true ) } );
AccessDate =
end
-- Test if format is given without giving a URL
if is_set(
Format = Format .. seterror( 'format_missing_url' );
end
end
-- Test if citation has no title
if
not
not
not
not
not
table.insert( z.message_tail, { seterror( 'citation_missing_title', {}, true ) } );
end
local OriginalURL = URL
வரி 1,089 ⟶ 1,090:
end
end
-- Format chapter / article title
if is_set(
Chapter = "[[" .. ChapterLink .. "|" .. Chapter .. "]]";
end
if is_set(
Chapter = wrap( 'italic-title', Chapter );
TransChapter = wrap( 'trans-italic-title', TransChapter );
வரி 1,103 ⟶ 1,104:
local TransError = ""
if is_set(TransChapter
if not is_set(Chapter) then
TransError = " " .. seterror( 'trans_missing_chapter' );
else
TransChapter = " " .. TransChapter;
end
end
if is_set(Chapter
if not is_set(
if is_set(
Chapter = externallink( ChapterURL, Chapter ) .. TransError;
if
Chapter = Chapter .. Format;
Format = "";
end
elseif is_set(
Chapter = externallink( URL, Chapter ) .. TransError .. Format;
URL =
Format = "";
else
Chapter = Chapter .. TransError;
end
elseif is_set(ChapterURL
Chapter = Chapter .. " " .. externallink( ChapterURL, nil, ChapterURLorigin ) ..
TransError;
else
வரி 1,132 ⟶ 1,136:
end
Chapter = Chapter .. sepc .. " " -- with end-space
elseif is_set(ChapterURL
Chapter = " " .. externallink( ChapterURL, nil, ChapterURLorigin ) .. sepc .. " ";
end
-- Format main title.
if is_set(
end
if is_set(
Title = wrap( 'quoted-title', Title );
TransTitle = wrap( 'trans-quoted-title', TransTitle );
elseif inArray(
Title = wrap( 'quoted-title', Title );
TransTitle = wrap( 'trans-quoted-title', TransTitle );
வரிசை 1,157:
end
if is_set(TransTitle
if not is_set(Title) then
TransError = " " .. seterror( 'trans_missing_title' );
else
TransTitle = " " .. TransTitle;
end
end
if is_set(Title
if not is_set(
Title = externallink( URL, Title ) .. TransError .. Format
URL =
Format =
else
Title = Title .. TransError;
end
end
if is_set(
if sepc == '.' then
Place = " " .. wrap( 'written', Place ) .. sepc .. " ";
else
Place = " " .. substitute( cfg.
end
end
if is_set(
if is_set(
Conference = externallink( ConferenceURL, Conference );
end
Conference = " " .. Conference
elseif is_set(ConferenceURL
Conference = " " .. externallink( ConferenceURL, nil, ConferenceURLorigin );
end
if not is_set(
local Minutes = A['Minutes'];
if is_set(
Position = " " .. Minutes .. " " .. cfg.
else
local Time = A['Time'];
if is_set(
local TimeCaption = A['TimeCaption']
if not is_set(TimeCaption
TimeCaption = cfg.
if sepc ~= '.' then
TimeCaption = TimeCaption:lower();
end
end
Position = " " .. TimeCaption .. " " .. Time;
end
end
else
Position = " " .. Position;
At = '';
end
if not
if is_set(
not inArray(config.CitationClass, {"encyclopaedia","web","book","news"}) then
Pages
elseif
Pages
Pages = sepc .."
end
end
else
not inArray(config.CitationClass, {"encyclopaedia","web","book","news"}) then
Page
else
Page = sepc .." " .. PPrefix .. Page;
end
end
Others = is_set(Others) and (sepc .. " " .. Others) or "";
TitleNote = is_set(TitleNote) and
Language = is_set(Language) and (" " .. wrap( 'language', Language )) or "";
Edition = is_set(Edition) and (" " .. wrap( 'edition', Edition )) or "";
Series = is_set(Series) and
Agency = is_set(Agency) and
if is_set(Volume) then
if ( mw.ustring.len(Volume) > 4 )
then Volume = sepc .." " .. Volume;
else Volume = " <b>" .. hyphentodash(Volume) .. "</b>";
end
------------------------------------ totally unrelated data
if is_set(
if is_set(
if (
AccessDate = '<span class="reference-accessdate">' .. sepc
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 = " " .. externallink( URL, nil, URLorigin );
end
if is_set(
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
end
local Archived
if is_set(
if not is_set(
ArchiveDate = seterror('archive_missing_date');
end
if
local arch_text = cfg.
if
Archived = sepc .. " " .. substitute( cfg.
{ externallink( ArchiveURL, arch_text ), ArchiveDate } );
if not is_set(OriginalURL
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 sepc ~= "."
Archived =
{ seterror('archive_missing_url'), ArchiveDate } );
end
else
Archived = ""
end
local Lay
if is_set(
if is_set(
if is_set(
LaySource = " – ''" .. safeforitalics(LaySource) .. "''"
else
LaySource = ""
end
if sepc == '.' then
Lay = sepc .. " " .. externallink(
else
Lay = sepc .. " " .. externallink(
end
else
Lay = "";
end
if is_set(Transcript) then
elseif
Transcript = externallink( TranscriptURL, nil, TranscriptURLorigin );
end
local Publisher;
if is_set(Periodical) and
not inArray(config.CitationClass,
if
Publisher = PublicationPlace .. ": " .. PublisherName;
else
Publisher = PublisherName;
end
elseif is_set(PublicationPlace
Publisher= PublicationPlace;
else
Publisher = "";
end
if is_set(
if is_set(Publisher
Publisher = Publisher .. ", " .. wrap( 'published', PublicationDate );
else
வரி 1,387 ⟶ 1,358:
end
end
if is_set(Publisher
Publisher = " (" .. Publisher .. ")";
end
else
if is_set(
PublicationDate = " (" .. wrap( 'published', PublicationDate ) .. ")";
end
if is_set(
if is_set(PublicationPlace
Publisher = sepc .. " " .. PublicationPlace .. ": " .. PublisherName .. PublicationDate;
else
Publisher = sepc .. " " .. PublisherName .. PublicationDate;
end
elseif is_set(PublicationPlace
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(
if is_set(
Periodical = sepc .. " " .. wrap( 'italic-title', Periodical )
else
Periodical = wrap( 'italic-title', Periodical )
end
-- Piece all bits together at last. Here, all should be non-nil.
வரி 1,422 ⟶ 1,392:
local tcommon
if
if
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
if is_set(
if is_set(Coauthors
end
if is_set(
elseif string.sub(Authors,-1,-1) == sepc then
else
end
if is_set(
local in_text = " " .. cfg.messages['in'] .. " "
if (sepc
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(
if is_set(
if EditorCount <= 1 then
Editors = Editors .. ", " .. cfg.
else
Editors = Editors .. ", " .. cfg.
end
Date = " (" .. Date ..")" .. OrigYear .. sepc .. " "
else
if EditorCount <= 1 then
Editors = Editors .. " (" .. cfg.
else
Editors = Editors .. " (" .. cfg.
end
end
வரி 1,482 ⟶ 1,450:
text = safejoin( {text, pgtext, idcommon}, sepc );
else
if is_set(
if ( string.sub(tcommon,-1,-1) ~= sepc )
then Date = sepc .." " .. Date .. OrigYear
else Date = " " .. Date .. OrigYear
end
end
if
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
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(
if is_set(
Year = selectyear( DateIn );
elseif is_set(
Year = selectyear( PublicationDate );
end
end
local options = {};
if is_set(config.CitationClass) and config.CitationClass ~= "citation" then
options.class = "citation " .. config.CitationClass;
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(
for i,v in ipairs(a) do
names[i] = v.last
if i == 4 then break end
end
elseif is_set(
for i,v in ipairs(e) do
names[i] = v.last
வரி 1,545 ⟶ 1,516:
end
if is_set(options.id
text = '<span id="' ..
else
text = '<span class="' ..
end
வரி 1,554 ⟶ 1,525:
-- Note: Using display: none on then COinS span breaks some clients.
local OCinS = '<span title="' ..
text = text .. OCinS;
வரி 1,560 ⟶ 1,531:
text = text .. " ";
for i,v in ipairs( z.message_tail ) do
if is_set(v[1]
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,
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
| |||