Open main menu

Changes

Module:Citation

191 bytes added, 10:14, 27 August 2012
Fixed generation of citation span ID.
-- At this point fields may be nil if they weren't specified in the template use. We can use that to perform various substitutions.
-- 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 ( Authors == nil ) then Authors = listpeople(config, a) end
if ( Editors == nil ) then Editors = listpeople(config, e) end
if ( Date == nil ) then
Date = Year
if ( Format ~= nil ) then Format = " (" .. Format .. ")" else Format = "" end
if ( Date ~= nil ) then Date = " (" .. Date .. ")" else Date = "" end
if ( Authors == nil ) then Authors = listpeople(config, a) end
if ( Editors == nil ) then Editors = listpeople(config, e) end
if ( ARXIV ~= nil ) then ARXIV = " " .. externallinkid(frame, {label="arXiv",link="arXiv",prefix="http://arxiv.org/abs/",id=ARXIV,separator=":"}) else ARXIV = "" end
if ( ASIN ~= nil ) then ASIN = " " .. amazon(frame, ASIN, ASINTLD) else ASIN = "" end
local id = Ref
if ( "harv" == Ref ) then
local P1 names = Surname1{} local P2 if ( "" ~= Surname2Authors ) then for i,v in ipairs(a) do names[i] = v.last end local P3 elseif ( "" ~= Surname3Editors ) then local P4 for i,v in ipairs(e) do names[i] = Surname4v.last end local P5end if ( Surname2 names[1] == nil ) then names[1] = Year elseif ( names[2] == nil ) then P2 names[2] = Year elseif ( Surname3 names[3] == nil ) then P3 names[3] = Year elseif ( Surname4 names[4] == nil ) then P4 names[4] = Year
else
P5 names[5] = Year
end
id = anchorid({P1,P2,P3,P4,P5}names)
end
local args = { class="citation " .. config.CitationClass, id=id }
Anonymous user