Модул:Wikidata/link — разлика између измена

Iz Vojne Enciklopedije
Пређи на навигацију Пређи на претрагу
Нема описа измене
 
м (1 измена увезена)
Ред 1: Ред 1:
p = {};
p = {}


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


function p.fromModule( context, options, id )
function p.p163( context, options, id )
return p.generateLink( options[ 'property' ], id, options[ 'title' ], context, options );
return '[[' .. id .. '|Флаг]]';
end
end


function p.generateLink( propertyId, id, title, context, options )
function p.p212( context, options, id )
propertyId = propertyId:upper()
return '[[Special:Booksources/' .. id .. '|' .. id .. ']]';
end
if p[ propertyId ] then
return p[ propertyId ]( context, options, id );
end


local pattern = p.findPattern( propertyId )
function p.p231( context, options, id )
if pattern then
return '[http://www.chemnet.com/cas/supplier.cgi?exact=dict&terms=' .. id .. ' ' .. id .. ']';
local link = mw.ustring.gsub( pattern, '$1', id );
end


if not title or title == '' then
function p.p237( context, options, id )
title = id;
return '[[' .. id .. '|Герб]]';
end
end
 
return '[' .. link .. ' ' .. title .. ']';
end


return id
function p.p247( context, options, id )
return '[http://nssdc.gsfc.nasa.gov/nmc/spacecraftOrbit.do?id=' .. id .. ' ' .. id .. ']';
end
end


function p.P212( context, options, id )
function p.p267( context, options, id )
return '[[Special:Booksources/' .. id .. '|' .. id .. ']]';
local frame = mw.getCurrentFrame()
return frame:expandTemplate{ title = 'АТХ', args = { id } };
end
end


function p.P267( context, options, id )
function p.p296( context, options, id )
local frame = mw.getCurrentFrame();
return '[http://osm.sbin.ru/esr/esr:' .. id .. ' ' .. id .. ']';
return frame:expandTemplate{ title = 'АТХ', args = { id } };
end
end


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


function p.P721( context, options, id )
function p.p377( context, options, id )
return '[http://www.n2yo.com/satellite/?s=' .. id .. ' ' .. id .. ']';
end
 
function p.p628( context, options, id )
return '[http://www.codexalimentarius.net/gsfaonline/additives/results.html?searchBy=ins&ins=' .. id .. ' ' .. id .. ']';
end
 
function p.p661( context, options, id )
return '[//www.chemspider.com/Chemical-Structure.' .. id .. '.html ' .. id .. ']';
end
 
function p.p662( context, options, id )
return '[http://pubchem.ncbi.nlm.nih.gov/summary/summary.cgi?cid=' .. id .. ' ' .. id .. ']';
end
 
function p.p685( context, options, id )
return '[http://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=Info&id=' .. id .. ' ' .. id .. ']';
end
 
function p.p715( context, options, id )
return '[http://www.drugbank.ca/drugs/DB' .. id .. ' ' .. id .. ']';
end
 
function p.p721( context, options, id )
local label = '';
local label = '';
     for i = mw.ustring.len( id ), 1, -3 do
     for i = mw.ustring.len( id ), 1, -3 do
Ред 79: Ред 95:
end
end


function p.P764( context, options, id )
function p.p764( context, options, id )
local label = '';
local label = '';
     for i = mw.ustring.len( id ), 1, -3 do
     for i = mw.ustring.len( id ), 1, -3 do
Ред 94: Ред 110:
end
end


function p.P884( context, options, id )
function p.p815( context, options, id )
local frame = mw.getCurrentFrame();
return '[http://www.itis.gov/servlet/SingleRpt/SingleRpt?search_topic=TSN&search_value=' .. id .. ' ' .. id .. ']';
local HydrologyBook = string.sub(id, 13, 15)
end
local ref = frame:callParserFunction{ name = '#tag:ref', args = { '{{Книга:РПВ ГИ|' .. string.sub(HydrologyBook, 1, 2) .. '|' .. string.sub(HydrologyBook, 3) .. '}}' } }
 
return id .. ref;
function p.p830( context, options, id )
return '[http://www.eol.org/pages/' .. id .. ' ' .. id .. ']';
end
 
function p.p884( context, options, id )
return '[http://vwo.osm.rambler.ru/?page=findname&name=' .. id .. ' ' .. id .. ']';
end
end


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


function p.findPattern( property )
function p.p961( context, options, id )
local entity = mw.wikibase.getEntity( property:upper() );
return '[http://www.ipni.org/ipni/idPlantNameSearch.do?id=' .. id .. ' ' .. id .. ']';
if entity then
end
local statements = entity:getBestStatements( 'P1630' );
 
for _, statement in pairs( statements ) do
function p.p962( context, options, id )
if statement.mainsnak.snaktype == 'value' then
return '[http://www.mycobank.org/Biolomics.aspx?Table=Mycobank&MycoBankNr_=' .. id .. ' ' .. id .. ']';
return statement.mainsnak.datavalue.value;
end
end
 
end
function p.p959( context, options, id )
end
return '[http://www.bucknell.edu/msw3/browse.asp?id=' .. id .. ' ' .. id .. ']';
return nil;
end
 
function p.p1070( context, options, id )
return '[http://www.theplantlist.org/tpl1.1/record/' .. id .. ' ' .. id .. ']';
end
 
function p.p1146( context, options, id )
return '[http://www.iaaf.org/athletes/athlete=' .. id .. '/ ' .. id .. ']';
end
 
function p.p1258( context, options, id )
return '[http://www.rottentomatoes.com/' .. id .. '/ подробнее]';
end
 
function p.p1483( context, options, id )
return '[http://kulturnoe-nasledie.ru/monuments.php?id=' .. id .. ' ' .. id .. ']';
end
 
function p.p1883( context, options, id )
return '[http://declarator.org/person/' .. id .. '/ ' .. id .. ']';
end
end


return p;
return p;

Верзија на датум 1. новембар 2020. у 14:02

Документацију овог модула можете да направите на страници Модул:Wikidata/link/док

p = {}

function p.fromTemplate( frame )
	local args = frame.args;
	local propertyId = args[1];
	local id = args[2];
	return p[propertyId]( nil, nil, id );
end

function p.p163( context, options, id )
	return '[[' .. id .. '|Флаг]]';
end

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

function p.p231( context, options, id )
	return '[http://www.chemnet.com/cas/supplier.cgi?exact=dict&terms=' .. id .. ' ' .. id .. ']';
end

function p.p237( context, options, id )
	return '[[' .. id .. '|Герб]]';
end

function p.p247( context, options, id )
	return '[http://nssdc.gsfc.nasa.gov/nmc/spacecraftOrbit.do?id=' .. id .. ' ' .. id .. ']';
end

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

function p.p296( context, options, id )
	return '[http://osm.sbin.ru/esr/esr:' .. id .. ' ' .. id .. ']';
end

function p.p345( context, options, id )
    local number = string.sub( id, 3 )
    local label = 'ID ' .. number
    if string.match( id, '^ch' ) then
		return '[[IMDbCharacter:' .. number .. '|' .. label .. ']]'
    end
    if string.match( id, '^co' ) then
		return '[[IMDbCompany:' .. number .. '|' .. label .. ']]'
    end
    if string.match( id, '^nm' ) then
		return '[[IMDbName:' .. number .. '|' .. label .. ']]'
    end
    if string.match( id, '^tt' ) then
		return '[[IMDbTitle:' .. number .. '|' .. label .. ']]'
    end

	return id;
end

function p.p377( context, options, id )
	return '[http://www.n2yo.com/satellite/?s=' .. id .. ' ' .. id .. ']';
end

function p.p628( context, options, id )
	return '[http://www.codexalimentarius.net/gsfaonline/additives/results.html?searchBy=ins&ins=' .. id .. ' ' .. id .. ']';
end

function p.p661( context, options, id )
	return '[//www.chemspider.com/Chemical-Structure.' .. id .. '.html ' .. id .. ']';
end

function p.p662( context, options, id )
	return '[http://pubchem.ncbi.nlm.nih.gov/summary/summary.cgi?cid=' .. id .. ' ' .. id .. ']';
end

function p.p685( context, options, id )
	return '[http://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=Info&id=' .. id .. ' ' .. id .. ']';
end

function p.p715( context, options, id )
	return '[http://www.drugbank.ca/drugs/DB' .. id .. ' ' .. id .. ']';
end

function p.p721( context, options, id )
	local label = '';
    for i = mw.ustring.len( id ), 1, -3 do
    	if ( i ~= mw.ustring.len( id ) ) then
    		label = ' ' .. label;
    	end
    	if ( i - 2 <= 0 ) then
        	label = mw.ustring.sub( id, 0, i ) .. label;
    	else
        	label = mw.ustring.sub( id, i - 2, i ) .. label;
        end
    end
	return '[http://classif.spb.ru/classificators/view/okt.php?st=A&kr=1&kod=' .. id .. ' ' .. label .. ']';
end

function p.p764( context, options, id )
	local label = '';
    for i = mw.ustring.len( id ), 1, -3 do
    	if ( i ~= mw.ustring.len( id ) ) then
    		label = ' ' .. label;
    	end
    	if ( i - 2 <= 0 ) then
        	label = mw.ustring.sub( id, 0, i ) .. label;
    	else
        	label = mw.ustring.sub( id, i - 2, i ) .. label;
        end
    end
	return '[http://classif.spb.ru/classificators/view/tma.php?st=A&kr=1&kod=' .. id .. ' ' .. label .. ']';
end

function p.p815( context, options, id )
	return '[http://www.itis.gov/servlet/SingleRpt/SingleRpt?search_topic=TSN&search_value=' .. id .. ' ' .. id .. ']';
end

function p.p830( context, options, id )
	return '[http://www.eol.org/pages/' .. id .. ' ' .. id .. ']';
end

function p.p884( context, options, id )
	return '[http://vwo.osm.rambler.ru/?page=findname&name=' .. id .. ' ' .. id .. ']';
end

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

function p.p961( context, options, id )
	return '[http://www.ipni.org/ipni/idPlantNameSearch.do?id=' .. id .. ' ' .. id .. ']';
end

function p.p962( context, options, id )
	return '[http://www.mycobank.org/Biolomics.aspx?Table=Mycobank&MycoBankNr_=' .. id .. ' ' .. id .. ']';
end

function p.p959( context, options, id )
	return '[http://www.bucknell.edu/msw3/browse.asp?id=' .. id .. ' ' .. id .. ']';
end

function p.p1070( context, options, id )
	return '[http://www.theplantlist.org/tpl1.1/record/' .. id .. ' ' .. id .. ']';
end

function p.p1146( context, options, id )
	return '[http://www.iaaf.org/athletes/athlete=' .. id .. '/ ' .. id .. ']';
end

function p.p1258( context, options, id )
	return '[http://www.rottentomatoes.com/' .. id .. '/ подробнее]';
end

function p.p1483( context, options, id )
	return '[http://kulturnoe-nasledie.ru/monuments.php?id=' .. id .. ' ' .. id .. ']';
end

function p.p1883( context, options, id )
	return '[http://declarator.org/person/' .. id .. '/ ' .. id .. ']';
end

return p;