Difference between revisions of "Module:Sandbox/Tom Morris"

From blackwiki
Jump to navigation Jump to search
blackwiki>Tom Morris
(fixery)
blackwiki>Tom Morris
m (TODO)
Line 10: Line 10:
 
             out[#out + 1] = "[[" .. mw.wikibase.sitelink("Q" .. v.mainsnak.datavalue.value["numeric-id"]) .. "]]"
 
             out[#out + 1] = "[[" .. mw.wikibase.sitelink("Q" .. v.mainsnak.datavalue.value["numeric-id"]) .. "]]"
 
         end
 
         end
 +
        -- TODO: hlist return
 
         return table.concat(out, ", ")
 
         return table.concat(out, ", ")
 
     else
 
     else

Revision as of 15:17, 19 May 2013

Documentation for this module may be created at Module:Sandbox/Tom Morris/doc

local p = {}

p.spouse = function(frame)
    local spouse_input = mw.text.trim(frame.args[1] or "")
    if spouse_input == "PARAMETER_NOT_SET" then
        -- get from wikidata
        local entity = mw.wikibase.getEntity()
        local out = {}
        for k, v in pairs(entity.claims.p26) do
            out[#out + 1] = "[[" .. mw.wikibase.sitelink("Q" .. v.mainsnak.datavalue.value["numeric-id"]) .. "]]"
        end
        -- TODO: hlist return
        return table.concat(out, ", ")
    else
        return spouse_input
    end
end

return p