Module:WikidataCheck: Difference between revisions
Jump to navigation
Jump to search
>Happy5214 m (Yikes!) |
>Happy5214 (More code) |
||
Line 7: | Line 7: | ||
local property = config.property | local property = config.property | ||
local value = config.value | |||
local entity = mw.wikibase.getEntity() | local entity = mw.wikibase.getEntity() | ||
local | local hasProp = entity.claims[property] | ||
if not hasProp then return "None." end | |||
local propValue = hasProp[0].mainsnak.datavalue.value | |||
return propValue | return propValue | ||
end | end | ||
return p | return p |
Revision as of 05:43, 28 April 2013
Documentation for this module may be created at Module:WikidataCheck/doc
local p = {} function p.wikidatacheck(frame) local pframe = frame:getParent() local config = frame.args -- the arguments passed BY the template, in the wikitext of the template itself local args = pframe.args -- the arguments passed TO the template, in the wikitext that transcludes the template local property = config.property local value = config.value local entity = mw.wikibase.getEntity() local hasProp = entity.claims[property] if not hasProp then return "None." end local propValue = hasProp[0].mainsnak.datavalue.value return propValue end return p