For faster navigation, this Iframe is preloading the Wikiwand page for Модуль:Wikidata/link.

Модуль:Wikidata/link

ХӀокху модулах лаьцна хааман Модуль:Wikidata/link/doc агӀо кхолла мега

p = {};

function p.fromTemplate( frame )
	local args = frame.args;
	return p.generateLink( args[ 1 ], args[ 2 ], args[ 'title' ] );
end

function p.fromModule( context, options, id )
	return p.generateLink( options[ 'property' ], id, options[ 'title' ], context, options );
end

function p.generateLink( propertyId, id, title, context, options )
	propertyId = propertyId:upper()

	if p[ propertyId ] then
		return p[ propertyId ]( context, options, id );
	end

	local pattern = p.findPattern( propertyId )
	if pattern then
		local link = mw.ustring.gsub( pattern, '$1', id );

		if not title or title == '' then
			title = id;
		end

		return '[' .. link .. ' ' .. title .. ']';
	end

	return id
end

function p.P212( context, options, id )
	if id:match("^[%s-0-9X]*$") or id:match("^%s*ISBN[%s-0-9X]*$") then
		return '[[Special:Booksources/' .. id .. '|' .. id .. ']]';
	else
		local frame = mw.getCurrentFrame();
		if id:match("<br") or id:match("\*") then
			return frame:expandTemplate{ title = 'Некорректный ISBN', args = { ['1']=id, noprefix='1', nolink='1' } };
		else
			return frame:expandTemplate{ title = 'Некорректный ISBN', args = { ['1']=id, noprefix='1' } };
		end
	end
end

function p.P267( context, options, id )
	local frame = mw.getCurrentFrame();
	return frame:expandTemplate{ title = 'АТХ', args = { id } };
end

function p.P345( context, options, id )
	local prefix = options and options.prefix
    local number = id
    if not string.match( id, '^%d' ) then
    	prefix = string.sub( id, 1, 2 )
    	number = string.sub( id, 3 )
	end
    local label = 'ID ' .. number
    if prefix == 'co' then
		return '[[IMDbCompany:' .. number .. '|' .. label .. ']]'
    end
    if prefix == 'nm' then
		return '[[IMDbName:' .. number .. '|' .. label .. ']]'
    end
    if prefix == 'tt' then
		return '[[IMDbTitle:' .. number .. '|' .. label .. ']]'
    end

	return id;
end

function p.P884( context, options, id )
    local frame = mw.getCurrentFrame();
    local HydrologyBookTom = string.sub(id, 13, 14);
    local HydrologyBookVypusk = string.sub(id, 15, 15);

    if HydrologyBookTom == '99' then
        return '[https://verum.wiki/index.php?claster=gvr&q=' .. id .. ' ' .. id .. ']';
    else
        local ref = frame:callParserFunction{ name = '#tag:ref', args = { '((Книга:РПВ ГИ|' .. HydrologyBookTom .. '|' .. HydrologyBookVypusk .. '))' } };

        return '[https://verum.wiki/index.php?claster=gvr&q=' .. id .. ' ' .. id .. ']' .. ref;
    end
end

function p.P957( context, options, id )
	return '[[Special:Booksources/' .. id .. '|' .. id .. ']]';
end

function p.findPattern( property )
	local entity = mw.wikibase.getEntity( property:upper() );
	if entity then
		local statements = entity:getBestStatements( 'P1630' );
		for _, statement in pairs( statements ) do
			if statement.mainsnak.snaktype == 'value' then
				return statement.mainsnak.datavalue.value;
			end
		end
	end
	return nil;
end

return p;
{{bottomLinkPreText}} {{bottomLinkText}}
Модуль:Wikidata/link
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?