Module:Citation/CS1: Difference between revisions
sync to sandbox, fixes COinS author list
m>Dragons flight (don't categorize empty unnamed parameters) |
m>Dragons flight (sync to sandbox, fixes COinS author list) |
||
Line 653: | Line 653: | ||
else | else | ||
OCinSdata["rft.genre"] = "book" | OCinSdata["rft.genre"] = "book" | ||
if ( nil ~= Title ) then OCinSdata["rft.btitle"] = Title end | |||
end | end | ||
OCinSdata["rft.place"] = PublicationPlace | OCinSdata["rft.place"] = PublicationPlace | ||
Line 670: | Line 670: | ||
OCinSdata["rft.mr"] = MR | OCinSdata["rft.mr"] = MR | ||
OCinSdata.rft_id = URL or ChapterURL | OCinSdata.rft_id = URL or ChapterURL | ||
local last, first; | |||
local OCinSauthors = {}; | |||
for k, v in ipairs( a ) do | |||
last = v.last; | |||
first = v.first; | |||
if k == 1 then | |||
if last ~= nil then | |||
OCinSdata["rft.aulast"] = last; | |||
end | |||
if first ~= nil then | |||
OCinSdata["rft.aufirst"] = first; | |||
end | |||
end | |||
if last ~= nil and first ~= nil then | |||
table.insert( OCinSauthors, last .. (args.NameSep or ", ") .. first ); | |||
elseif last ~= nil then | |||
table.insert( OCinSauthors, last ); | |||
end | end | ||
end | end | ||
local OCinSids = {} -- COinS data only for id, bibcode, doi, pmid, etc. | local OCinSids = {} -- COinS data only for id, bibcode, doi, pmid, etc. | ||
OCinSids["info:arxiv"] = ARXIV | OCinSids["info:arxiv"] = ARXIV | ||
Line 695: | Line 705: | ||
OCinSids["info:zbl"] = ZBL | OCinSids["info:zbl"] = ZBL | ||
local OCinStitle = "ctx_ver=" .. ctx_ver -- such as "Z39.88-2004" | local OCinStitle = "ctx_ver=" .. ctx_ver -- such as "Z39.88-2004" | ||
for name,value in pairs(OCinSdata) do | |||
OCinStitle = OCinStitle .. "&" .. name .. "=" .. mw.uri.encode(value) | |||
end | |||
for _, value in ipairs(OCinSauthors) do | |||
OCinStitle = OCinStitle .. "&rft.au=" .. mw.uri.encode(value) | |||
end | |||
for name,value in pairs(OCinSids) do | for name,value in pairs(OCinSids) do | ||
OCinStitle = OCinStitle .. "&rft_id=" .. mw.uri.encode(name .. "/" .. value) | OCinStitle = OCinStitle .. "&rft_id=" .. mw.uri.encode(name .. "/" .. value) | ||
end | end | ||