Jump to content

Module:Sandbox/Tom Morris

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Tom Morris (talk | contribs) at 13:16, 19 May 2013 (whoops). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
local p = {}

p.spouse = function(frame)
    if not frame.args[1] == nil then
        if not frame.args[2] == nil then
            return "[[" + frame.args[1] + "|" + frame.args[2] + "]]"
        else
            return "[[" + frame.args[1] + "]]"
        end
    else
        local entity = mw.wikibase.getEntity()
        if not entity.claims.p26 == nil then
            local label = mw.wikibase.label( "Q" .. entity.claims.p26[0].mainsnak.datavalue.value["numeric-id"])
            return "[[" + label + "]]"
        end
    end
end

return p