Module:Citation/CS1: திருத்தங்களுக்கு இடையிலான வேறுபாடு
உள்ளடக்கம் நீக்கப்பட்டது உள்ளடக்கம் சேர்க்கப்பட்டது
sync to sandbox, fixes a problem that can cause a script error in rare circumstances |
sync to sandbox, changes in support of additional modes and minro bug fixes |
||
வரிசை 6:
-- Include translation message hooks, ID and error handling configuration settings.
▲local cfg = require( 'Module:Citation/CS1/Configuration' );
-- Contains a list of all recognized parameters
வரி 48 ⟶ 45:
-- Wraps a string using a message_list configuration taking one argument
function wrap( key, str, lower )
if not is_set( str ) then
return "";
வரி 54 ⟶ 51:
str = safeforitalics( str );
end
return substitute( cfg.messages[key], {str} );▼
return substitute( cfg.messages[key]:lower(), {str} );
▲ return substitute( cfg.messages[key], {str} );
end
வரி 79 ⟶ 80:
local args, list, v = args, cfg.aliases[k];
if type( list ) ==
error( cfg.messages['unknown_argument_map'] );▼
elseif type( list ) == 'string' then▼
v, origin[k] = args[list], list;▼
▲ else
v, origin[k] = selectone( args, list, 'redundant_parameters' );
if origin[k] == nil then
origin[k] = '';
end
▲ v, origin[k] = args[list], list;
-- maybe let through instead of raising an error?
-- v, origin[k] = args[k], k;
▲ error( cfg.messages['unknown_argument_map'] );
end
-- Empty strings, not nil;
if v == nil then
v = cfg.defaults[k] or
origin[k] = ''
end
வரி 872 ⟶ 876:
local no_tracking_cats = A['NoTracking'];
local use_lowercase = ( sepc ~= '.' );
local this_page = mw.title.getCurrentTitle(); --Also used for COinS
வரி 1,002 ⟶ 1,007:
Authors = listpeople(control, a)
end
local EditorCount
if not is_set(Editors) then
வரி 1,025 ⟶ 1,030:
else
EditorCount = 1;
end▼
local Cartography = "";
local Scale = "";
if config.CitationClass == "map" then
if not is_set( Authors ) and is_set( PublisherName ) then
Authors = PublisherName;
PublisherName = "";
end
Cartography = A['Cartography'];
Cartography = sepc .. " " .. wrap( 'cartography', Cartography, use_lowercase );
end
Scale = A['Scale'];
if is_set( Scale ) then
Scale = sepc .. " " .. Scale;
end
end
வரி 1,149 ⟶ 1,171:
Title = wrap( 'quoted-title', Title );
TransTitle = wrap( 'trans-quoted-title', TransTitle );
elseif inArray(config.CitationClass, {"web","news","pressrelease","conference"}) and
not is_set(Chapter) then
Title = wrap( 'quoted-title', Title );
வரி 1,180 ⟶ 1,202:
if is_set(Place) then
▲ if sepc == '.' then
▲ Place = " " .. wrap( 'written', Place ) .. sepc .. " ";
▲ else
▲ Place = " " .. substitute( cfg.messages['written']:lower(), {Place} ) .. sepc .. " ";
▲ end
end
வரி 1,191 ⟶ 1,209:
Conference = externallink( ConferenceURL, Conference );
end
Conference = sepc .. " " .. Conference
elseif is_set(ConferenceURL) then
Conference = sepc .. " " .. externallink( ConferenceURL, nil, ConferenceURLorigin );
end
வரி 1,239 ⟶ 1,257:
At = is_set(At) and (sepc .. " " .. At) or "";
Position = is_set(Position) and (sepc .. " " .. Position) or "";
if config.CitationClass == 'map' then
local Section = A['Section'];
local Inset = A['Inset'];
if first_set( Pages, Page, At ) ~= nil or sepc ~= '.' then
if is_set( Section ) then
Section = ", " .. wrap( 'section', Section, true );
end
if is_set( Inset ) then
Inset = ", " .. wrap( 'inset', Inset, true );
end
else
if is_set( Section ) then
Section = sepc .. " " .. wrap( 'section', Section, use_lowercase );
if is_set( Inset ) then
Inset = ", " .. wrap( 'inset', Inset, true );
end
elseif is_set( Inset ) then
Inset = sepc .. " " .. wrap( 'inset', Inset, use_lowercase );
end
end
At = At .. Section .. Inset;
end
Others = is_set(Others) and (sepc .. " " .. Others) or "";
TitleType = is_set(TitleType) and (" (" .. TitleType .. ")") or "";
வரி 1,257 ⟶ 1,299:
------------------------------------ totally unrelated data
-- Mimic {{subscription required}} template;
if is_set(Via) then Via = " " .. wrap( 'via', Via ); end▼
if is_set(Via) then
SubscriptionRequired = sepc .. " " .. cfg.messages['subscription']; --citation always requires subscription if 'via' parameter is used▼
elseif is_set(SubscriptionRequired) then
SubscriptionRequired = sepc .. " " .. cfg.messages['subscription_no_via']; --here when 'via' parameter not used but 'subscription' is
end▼
if is_set(AccessDate) then
local retrv_text = " " .. cfg.messages['retrieved']
வரி 1,263 ⟶ 1,312:
AccessDate = '<span class="reference-accessdate">' .. sepc
.. substitute( retrv_text, {AccessDate} ) .. '</span>'
▲ end
▲ if is_set(SubscriptionRequired) then
▲ SubscriptionRequired = sepc .. " " .. cfg.messages['subscription'];
end
வரி 1,395 ⟶ 1,440:
if inArray(config.CitationClass, {"journal","citation"}) and is_set(Periodical) then
if is_set(Others) then Others = Others .. sepc .. " " end
tcommon = safejoin( {Others, Title, TitleNote, Conference, Periodical, Format, TitleType, Scale, Series,
Language, Cartography, Edition, Publisher, Agency, Volume, Issue
else
tcommon = safejoin( {Title, TitleNote, Conference, Periodical, Format, TitleType, Scale, Series, Language,
Volume, Issue, Others, Cartography, Edition, Publisher, Agency
end
வரி 1,410 ⟶ 1,455:
local idcommon = safejoin( { ID_list, URL, Archived, AccessDate, Via, SubscriptionRequired, Lay, Quote }, sepc );
local text;
local pgtext = Position .. Page .. Pages .. At;
if is_set(Authors) then
வரி 1,424 ⟶ 1,469:
end
if is_set(Editors) then
local in_text = " "
local post_text = "";
if is_set(Chapter) then
in_text = in_text .. cfg.messages['in'] .. " "
else
if EditorCount <= 1 then
post_text = ", " .. cfg.messages['editor'];
else
post_text = ", " .. cfg.messages['editors'];
end
end
if (sepc ~= '.') then in_text = in_text:lower() end
Editors = in_text .. Editors .. post_text;
if (string.sub(Editors,-1,-1) == sepc)
then Editors =
else Editors =
end
end
வரி 1,494 ⟶ 1,550:
if ( "harv" == Ref ) then
local names = {} --table of last names & year
if
for i,v in ipairs(a) do
names[i] = v.last
if i == 4 then break end
end
elseif
for i,v in ipairs(e) do
names[i] = v.last
| |||