Have questions? Visit https://www.reddit.com/r/SNPedia

Module:PMID

From SNPedia

Documentation for this module may be created at Module:PMID/doc

-- For unit tests, see [[Module:PMID/testcases]]
local p = {}

function p.PMID(frame)
    local args = frame:getParent().args
    local pmid = args[1]

    local openaccess = args["OA"]
    local open   = openaccess == "1" or openaccess == "True" or openaccess == "TRUE" or openaccess == "true"

    local out

    if open then
       out = string.format('[[https://www.ncbi.nlm.nih.gov/pubmed/%s?dopt=Abstract PMID %s][[File:OA-icon.png]]][[With PMID::%s| ]]', tostring(pmid),tostring(pmid), tostring(pmid))
    else
       out = string.format('[[https://www.ncbi.nlm.nih.gov/pubmed/%s?dopt=Abstract PMID %s]][[With PMID::%s| ]]', tostring(pmid),tostring(pmid), tostring(pmid))	
    end

    return out
end

return p