Module:Math: Difference between revisions

From DRMF
Jump to navigation Jump to search
imported>Admin
No edit summary
imported>Admin
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
-- vim: set noexpandtab ft=lua ts=4 sw=4:
-- vim: set noexpandtab ft=lua ts=4 sw=4:
require('Module:No globals')
local p = {}
local p = {}
local debug = false
------------------------------------------------------------------------------
-- module local variables and functions
local wiki =
{
langcode = mw.language.getContentLanguage().code
}


p.getMathValue = function(frame)
p.render= function(frame)
local propertyID = mw.text.trim(frame.args[1] or "")
local propertyID = mw.text.trim(frame.args[1] or "")
local entity = mw.wikibase.getEntityObject()
local entity = mw.wikibase.getEntityObject()
local claims
local claims
if entity and entity.claims then claims = entity.claims[propertyID] end
if entity and entity.claims then claims = entity.claims[propertyID] end
if claims then
if claims then
return frame:preprocess( entity:formatStatements(propertyID).value )
return frame:preprocess( entity:formatStatements(propertyID).value )
else
else
return ""
return ""
end
end
end
end


return p
return p

Latest revision as of 19:39, 13 March 2017

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

-- vim: set noexpandtab ft=lua ts=4 sw=4:
local p = {}

p.render= function(frame)
	local propertyID = mw.text.trim(frame.args[1] or "")
	local entity = mw.wikibase.getEntityObject()
	local claims
	if entity and entity.claims then claims = entity.claims[propertyID] end
	if claims then
		return frame:preprocess( entity:formatStatements(propertyID).value )
	else
		return ""
	end
end

return p