Open main menu

Changes

Module:Citation

107 bytes added, 19:18, 31 August 2012
Corrected processing of translated chapter and title. Added configuration option for page(s) prefix.
local AuthorSep = config.AuthorSep or "&#59;"
local PPrefix = config.PPrefix or "p."
local PPPrefix = config.PPPrefix or "pp."
if ( "y" == args.nopp ) then PPPrefix = "" PPrefix = "" end
-- Transfer unnumbered arguments to numbered arguments if necessary.
OCinSids["info:ssrn"] = SSRN
OCinSids["info:zbl"] = ZBL
local OCinStitle = ""
for name,value in pairs(OCinSids) do
OCinStitle = OCinStitle .. "rft_id=" .. z.wikitext.urlencode(name .. "/" .. value) .. "&"
Date = Year
if ( Date ~= nil ) then
if ( local Month = args.month if ( Month ~= nil ) then Date = args.month Month .. " " .. Date if ( local Day = args.day if ( Day ~= nil ) then Date = args.day Day .. " " .. Date end
end
end
end
if ( PublicationDate == Date or PublicationDate == Year ) then PublicationDate = nil end
if ( TransTitle ~= nil ) then TransTitle = " [" .. TransTitle .. "]." else TransTitle = "" end
if ( TransChapter ~= nil ) then TransChapter = " [" .. TransChapter .. "]." else TransChapter = "" end
if ( Chapter ~= nil ) then
if ( Periodical ~= nil ) then
Chapter = "\"" .. Chapter .. "\""
end
Chapter = Chapter .. TransChapter
if ( ChapterURL ~= nil ) then
Chapter = "[" .. ChapterURL .. " " .. Chapter .. "]"
end
if ( Title ~= nil ) then
if ( URL ~= nil ) then
Title = "[" .. URL .. " " .. Title .. "]"
URL = nil
end
if ( Periodical ~= nil ) then
Title = "\"" .. Title .. "\""
else
Title = "''" .. Title .. "''"
end
Title = Title .. TransTitle
if ( URL ~= nil ) then
Title = "[" .. URL .. " " .. Title .. "]"
URL = nil
end
Title = " " .. Title .. "."
elseif ( Periodical ~= nil ) then
Page = " :" .. Page
elseif ( "y" == args.nopp ) then
Page = " " .. Page
else
Page = " p" ." . PPrefix .. Page
end
if ( nil == Pages ) then
elseif ( Periodical ~= nil ) then
Pages = " :" .. Pages
elseif ( "y" == args.nopp ) then
Pages = " " .. Pages
else
Pages = " pp" ." . PPPrefix .. Pages
end
if ( At ~= nil ) then At = " " .. At .. "." else At = "" end
if ( Coauthors ~= nil ) then Coauthors = " " .. Coauthors .. "." else Coauthors = "" end
if ( Others ~= nil ) then Others = " " .. Others .. "." else Others = "" end
if ( TransTitle ~= nil ) then TransTitle = " (" .. TransTitle .. ")." else TransTitle = "" end
if ( TransChapter ~= nil ) then TransChapter = " (" .. TransChapter .. ")." else TransChapter = "" end
if ( Type ~= nil ) then Type = " (" .. Type .. ")." else Type = "" end
if ( PublicationPlace ~= nil ) then PublicationPlace = PublicationPlace .. ": " else PublicationPlace = "" end
-- We build things this way because it is more efficient in LUA not to keep reassigning to the same string variable over and over.
local idcommon = ARXIV .. ASIN .. BIBCODE .. DOI .. ID .. ISBN .. JFM .. JSTOR .. LCCN .. MR .. OCLC .. OL .. OSTI .. PMC .. PMID .. RFC .. SSRN .. URL .. ZBL .. Accessed .. Via .. SubscriptionRequired
local tcommon = Title .. TransTitle .. Type .. Format .. Edition .. Language .. Periodical .. Series .. Volume .. Issue .. Page .. Pages
Date = Date .. OrigYear
local text
if ( "" ~= Date ) then Date = Date .. "." else Authors = Authors .. "." end
if ( "" ~= Editors ) then Editors = " in " .. Editors .. "." end
text = Authors .. Coauthors .. Date .. Chapter .. TransChapter .. Others .. Editors .. tcommon .. Publisher .. idcommon
elseif ( "" ~= Editors) then
Editors = Editors .. " (eds.)"
if ( "" ~= Date ) then Date = Date .. "." else Editors = Editors .. "." end
text = Editors .. Date .. Chapter .. TransChapter .. tcommon .. Publisher .. idcommon
else
text = Chapter .. TransChapter .. tcommon .. Publisher .. Date .. idcommon
end
Anonymous user