Module:Wikidata/link

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

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.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.p247( context, options, id )
	return '[http://nssdc.gsfc.nasa.gov/nmc/spacecraftOrbit.do?id=' .. 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.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://www.mosclassific.ru/mClass/okato_view.php?text=' .. 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://www.mosclassific.ru/mClass/oktmo_view.php?text=' .. 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://verum.wiki/index.php?claster=gvr&q=' .. 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.p1483( context, options, id )
	return '[http://kulturnoe-nasledie.ru/monuments.php?id=' .. id .. ' ' .. id .. ']';
end

return p;