Документация
local p = require('Module:Wikidata')

p.oldformatProperty = p.formatProperty;
-- какая-то старая фигня
function p.formatProperty( frame )
	if not frame.args.property then
        		throwError( 'property-param-not-provided' )
    end
	
	if frame.args.value and frame.args.value ~= '' then
		if (frame.args.nocat and frame.args.nocat ~= '') or frame:callParserFunction( '#property', frame.args.property )=='' then
			return frame.args.value
		end
	end
    return p.oldformatProperty( frame )
end

function p.formatEntity( frame )
	local args=frame.args
	local entity=args.entity or frame.entity or frame
	mw.log(entity)
	if type(entity) == 'string' then
		entity = mw.title.makeTitle('',entity,'','d')
		 for i,v in  pairs (entity) do 
		 	local result= v
		 	if type(v) == 'function' and i~="inNamespace" and i~="isSubpageOf" and i~="hasSubjectNamespace" and i~="subPageTitle" then
		 		result = v(entity)
			end
		 	mw.log(i.."="..tostring(result))
		 end
	end
	mw.log(entity)
	local fullText=entity.fullText
	local baseText=mw.wikibase.label(args.entity ) or entity.baseText
	return entity:getContent() or "[["..fullText.."|"..baseText.."]]"
end

return p