Module:Creator
This module is rated as pre-alpha. It is unfinished, and may or may not be in active development. It should not be used from article namespace pages. Modules remain pre-alpha until the original editor (or someone who takes one over if it is abandoned for some time) is satisfied with the basic structure. |
Aim edit
This aim of this module is to develop routines to either work with or replace parts of the {{Creator}}
template extensively used on Commons.
It is currently at a very early stage of inital development and experimentation.
Test pages edit
Code
local p = {}
local wikidata = require('Module:Wikidata')
function p.CreatorProperties(frame)
local item = frame.args[1]
local entity = mw.wikibase.getEntityObject(item) -- item needs to include the Q
local t = {}
table.insert(t, ' {{Creator')
table.insert(t, ' | Name = ' .. entity:getLabel())
table.insert(t, ' | Birthdate = ' .. table.maxn(entity:formatPropertyValues('P569'),'/'))
table.insert(t, ' | Birthloc = ' .. table.maxn(entity:formatPropertyValues('P19'),'/'))
table.insert(t, ' | Deathdate = ' .. table.maxn(entity:formatPropertyValues('P570'),'/'))
table.insert(t, ' | Deathloc = ' .. table.maxn(entity:formatPropertyValues('P20'),'/'))
table.insert(t, ' | Wikidata = ' .. item)
table.insert(t, ' }}')
local ret = table.concat(t, '\n')
return(ret)
end
return p