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
        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
     if ( nil ~= a[1] and nil ~= a[1].last) then
 
    local last = a[1].last
    local last, first;
local first = a[1].first
    local OCinSauthors = {};
OCinSdata["rft.aulast"] = last
     for k, v in ipairs( a ) do
        if ( nil ~= first ) then  
        last = v.last;
    OCinSdata["rft.aufirst"] = first
        first = v.first;
    OCinSdata["rft.au"] = last .. (args.NameSep or ", ") .. first
        if k == 1 then
else
            if last ~= nil then
    OCinSdata["rft.au"] = last
                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
    for name,value in pairs(OCinSdata) do
        OCinStitle = OCinStitle .. "&" .. name .. "=" .. mw.uri.encode(value)
     end
     end
      
      
Anonymous user