Module:Citation/CS1: Difference between revisions
Jump to navigation
Jump to search
m (1 revision) |
(Test) |
||
Line 216: | Line 216: | ||
label=handler.label , prefix="//www.amazon."..domain.."/dp/",id=id, | label=handler.label , prefix="//www.amazon."..domain.."/dp/",id=id, | ||
encode=handler.encode, separator = handler.separator}) | encode=handler.encode, separator = handler.separator}) | ||
end | end | ||
Line 295: | Line 262: | ||
end | end | ||
end | end | ||
--[[ | --[[ | ||
Line 530: | Line 445: | ||
local lang = mw.getContentLanguage(); | local lang = mw.getContentLanguage(); | ||
local good, result; | local good, result; | ||
good, result = pcall( lang.formatDate, lang, 'Y', str ) | good, result = pcall( lang.formatDate, lang, 'Y', str ) | ||
if good then | if good then | ||
return result; | return result; | ||
else | else | ||
-- | -- Can't make sense of this input, return blank. | ||
return ""; | |||
end | |||
end | |||
end | |||
end | |||
end | |||
end | |||
-- Attempts to convert names to initials. | -- Attempts to convert names to initials. | ||
Line 691: | Line 588: | ||
elseif k == 'OL' then | elseif k == 'OL' then | ||
table.insert( new_list, {handler.label, openlibrary( v ) } ); | table.insert( new_list, {handler.label, openlibrary( v ) } ); | ||
elseif k == 'ISBN' then | elseif k == 'ISBN' then | ||
local ISBN = internallinkid( handler ); | local ISBN = internallinkid( handler ); | ||
Line 970: | Line 863: | ||
local ASINTLD = A['ASINTLD']; | local ASINTLD = A['ASINTLD']; | ||
local IgnoreISBN = A['IgnoreISBN']; | local IgnoreISBN = A['IgnoreISBN']; | ||
local ID_list = extractids( args ); | local ID_list = extractids( args ); | ||
Line 986: | Line 878: | ||
local use_lowercase = ( sepc ~= '.' ); | local use_lowercase = ( sepc ~= '.' ); | ||
local this_page = mw.title.getCurrentTitle(); --Also used for COinS | local this_page = mw.title.getCurrentTitle(); --Also used for COinS | ||
if not is_set(no_tracking_cats) then | if not is_set(no_tracking_cats) then | ||
Line 993: | Line 885: | ||
no_tracking_cats = "true"; | no_tracking_cats = "true"; | ||
break; | break; | ||
end | |||
end | |||
end | |||
if ( config.CitationClass == "journal" ) then | |||
if not is_set(URL) and is_set(ID_list['PMC']) then | |||
local Embargo = A['Embargo']; | |||
if is_set(Embargo) then | |||
local lang = mw.getContentLanguage(); | |||
local good1, result1, good2, result2; | |||
good1, result1 = 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']; | |||
URLorigin = cfg.id_handlers['PMC'].parameters[1]; | |||
end | |||
else | |||
URL = "http://www.ncbi.nlm.nih.gov/pmc/articles/PMC" .. ID_list['PMC']; | |||
URLorigin = cfg.id_handlers['PMC'].parameters[1]; | |||
end | end | ||
end | end | ||
Line 1,096: | Line 1,008: | ||
Authors = listpeople(control, a) | Authors = listpeople(control, a) | ||
end | end | ||
local EditorCount | local EditorCount | ||
Line 1,373: | Line 1,281: | ||
At = At .. Section .. Inset; | At = At .. Section .. Inset; | ||
end | end | ||
Others = is_set(Others) and (sepc .. " " .. Others) or ""; | Others = is_set(Others) and (sepc .. " " .. Others) or ""; | ||
TitleType = is_set(TitleType) and (" (" .. TitleType .. ")") or ""; | TitleType = is_set(TitleType) and (" (" .. TitleType .. ")") or ""; | ||
TitleNote = is_set(TitleNote) and (sepc .. " " .. TitleNote) or ""; | TitleNote = is_set(TitleNote) and (sepc .. " " .. TitleNote) or ""; | ||
Language = is_set(Language) and (" " .. wrap( 'language', Language )) or ""; | |||
Edition = is_set(Edition) and (" " .. wrap( 'edition', Edition )) or ""; | Edition = is_set(Edition) and (" " .. wrap( 'edition', Edition )) or ""; | ||
Issue = is_set(Issue) and (" (" .. Issue .. ")") or ""; | Issue = is_set(Issue) and (" (" .. Issue .. ")") or ""; | ||
Line 1,411: | Line 1,300: | ||
------------------------------------ totally unrelated data | ------------------------------------ totally unrelated data | ||
-- | -- Mimic {{subscription required}} template; | ||
if is_set(Via) then | if is_set(Via) then | ||
Via = " " .. wrap( 'via', Via ); | Via = " " .. wrap( 'via', Via ); | ||
end | end | ||
-- SubscriptionRequired = sepc .. " " .. cfg.messages['subscription']; --citation always requires subscription if 'via' parameter is used | |||
-- This line removed because of editors desire to use via for citations that do not require subscriptions | |||
SubscriptionRequired = sepc .. " " .. cfg.messages[' | if is_set(SubscriptionRequired) then | ||
SubscriptionRequired = sepc .. " " .. cfg.messages['subscription_no_via']; --here when 'via' parameter not used but 'subscription' is | |||
elseif is_set(RegistrationRequired) then | elseif is_set(RegistrationRequired) then | ||
SubscriptionRequired = sepc .. " " .. cfg.messages['registration']; --here when 'via' and 'subscription' parameters not used but 'registration' is | SubscriptionRequired = sepc .. " " .. cfg.messages['registration']; --here when 'via' and 'subscription' parameters not used but 'registration' is | ||
Line 1,435: | Line 1,321: | ||
if is_set(ID) then ID = sepc .." ".. ID; end | if is_set(ID) then ID = sepc .." ".. ID; end | ||
ID_list = buildidlist( ID_list, {DoiBroken = DoiBroken, ASINTLD = ASINTLD, IgnoreISBN = IgnoreISBN | ID_list = buildidlist( ID_list, {DoiBroken = DoiBroken, ASINTLD = ASINTLD, IgnoreISBN = IgnoreISBN} ); | ||
if is_set(URL) then | if is_set(URL) then |