Модуль:Wikidata/count

{{i}} Документація модуля[перегляд] [редагувати] [історія] [очистити кеш]

Використання

Службовий модуль для Модуль:Wikidata.

local p = {}

function p.getCount( context, options )
	if ( not context ) then error( 'context not specified' ); end;
	if ( not options ) then error( 'options not specified' ); end;
	if ( not options.entity ) then error( 'options.entity missing' ); end;

	local claims;
	if options.property then
		claims = context.selectClaims( options, options.property );
	end
	if claims == nil then
		return '';
	end
	
	return table.getn(claims);
end

function p.isMultiple( context, options )
	local count = p.getCount( context, options );
	local multiple = '';
	if( count ~= nil and count ~= '' and count > 1 ) then
		multiple = 1;
	end
	return multiple;
end

return p
Prefix: a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9

Portal di Ensiklopedia Dunia

Kembali kehalaman sebelumnya