Халыып:Тиэкистуһунан
| Аата суох |
| Ошибка скрипта: Модуля «Атын төрүттэр» не существует.local currentProject = 'sahwikisource';
local otherSources = { { id = 'Q20078554', argument = 'БСЭ1', title = 'БСЭ1', project = 'sahwikisource', titleVT = 'БСЭ1/$1', titleDO = 'БСЭ1/$1'},
{ id = 'Q4086271', argument = 'БЭАН', title = 'БЭАН', project = 'sahwikisource', titleVT = 'БЭАН/$1', titleDO = 'БЭАН/$1'},
{ id = 'Q4091878', argument = 'БЭЮ', title = 'БЭЮ', project = 'sahwikisource', titleVT = 'БЭЮ/$1', titleDO = 'БЭЮ/$1'},
{ id = 'Q4114391', argument = 'ВЭ', title = 'ВЭ', project = 'sahwikisource', titleVT = 'ВЭ/ВТ/$1', titleDO = 'ВЭ/ДО/$1'},
{ id = 'Q19147760', argument = 'ГСС', title = 'ГСС', project = 'sahwikisource', titleVT = 'ГСС/ДО/$1', titleDO = 'ГСС/ДО/$1'},
{ id = 'Q4173137', argument = 'ЕЭБЕ', title = 'ЕЭБЕ', project = 'sahwikisource', titleVT = 'ЕЭБЕ/$1', titleDO = 'ЕЭБЕ/$1'},
{ id = 'Q19180675', argument = 'МЭСБЕ', title = 'МЭСБЕ', project = 'sahwikisource', titleVT = 'МЭСБЕ/$1', titleDO = 'МЭСБЕ/$1'},
{ id = 'Q19190511', argument = 'НЭС', title = 'НЭС', project = 'sahwikisource', titleVT = 'НЭС/$1', titleDO = 'НЭС/$1'},
{ id = 'Q19211082', argument = 'ПБЭ', title = 'ПБЭ', project = 'sahwikisource', titleVT = 'ПБЭ/ВТ/$1', titleDO = 'ПБЭ/ДО/$1'},
{ id = 'Q1960551', argument = 'РБС', title = 'РБС', project = 'sahwikisource', titleVT = 'РБС/ВТ/$1', titleDO = 'РБС/ДО/$1'},
{ id = 'Q19217220', argument = 'РЭСБ', title = 'РЭСБ', project = 'sahwikisource', titleVT = 'РЭСБ/$1', titleDO = 'РЭСБ/$1'},
{ id = 'Q1970746', argument = 'ТСД', title = 'ТСД', project = 'sahwikisource', titleVT = 'ТСД/$1', titleDO = 'ТСД/$1/ДО'},
{ id = 'Q20078551', argument = 'ТЭ1', title = 'ТЭ1', project = 'sahwikisource', titleVT = 'ТЭ1/$1', titleDO = 'ТЭ1/$1'},
{ id = 'Q4532135', argument = 'ЭЛ', title = 'ЭЛ', project = 'sahwikisource', titleVT = 'ЭЛ/ВТ/$1', titleDO = 'ЭЛ/ДО/$1'},
{ id = 'Q602358', argument = 'ЭСБЕ', title = 'ЭСБЕ', project = 'sahwikisource', titleVT = 'ЭСБЕ/$1', titleDO = 'ЭСБЕ/$1/ДО'},
{ id = 'Q590208', argument = 'ADB', title = 'ADB', project = 'dewikisource', projectCode = 'de:', prefix='ADB:', suffix= },
{ id = 'Q19077875', argument = 'AC', title = 'American Cycl. (1879)', project = 'enwikisource', projectCode = 'en:', prefix='The American Cyclopædia (1879)/', suffix= },
{ id = 'Q19037977', argument = 'AMB', title = 'American Med. Biogr. (1920)', project = 'enwikisource', projectCode = 'en:', prefix='American Medical Biographies/', suffix= },
{ id = 'Q12912667', argument = 'ACAB-1', title = 'Appletons\' (1887—1901)', project = 'enwikisource', projectCode = 'en:', prefix='Appletons\' Cyclopædia of American Biography/', suffix= },
{ id = 'Q20096917', argument = 'Британника-9', title = 'Britannica (9-th)', project = 'enwikisource', projectCode = 'en:', prefix='Encyclopædia Britannica, Ninth Edition/', suffix= },
{ id = 'Q867541', argument = 'Британника', title = 'Britannica (11-th)', project = 'enwikisource', projectCode = 'en:', prefix='1911 Encyclopædia Britannica/', suffix= },
{ id = 'Q15987490', argument = 'Британника-12', title = 'Britannica (12-th)', project = 'enwikisource', projectCode = 'en:', prefix='1922 Encyclopædia Britannica/', suffix= },
{ id = 'Q302556', argument = 'Catholic', title = 'Catholic Enc. (1907—13)', project = 'enwikisource', projectCode = 'en:', prefix='Catholic Encyclopedia (1913)/', suffix= },
{ id = 'Q15987216', argument = 'DNB', title = 'DNB (1885—1900)', project = 'enwikisource', projectCode = 'en:', prefix=, suffix=' (DNB00)'},
{ id = 'Q16014700', argument = 'DNB01', title = 'DNB (1901)', project = 'enwikisource', projectCode = 'en:', prefix=, suffix=' (DNB01)'},
{ id = 'Q16014697', argument = 'DNB12', title = 'DNB (1912)', project = 'enwikisource', projectCode = 'en:', prefix=, suffix=' (DNB12)'},
{ id = 'Q653922', argument = 'JE', title = 'JE (1901—06)', project = 'enwikisource', projectCode = 'en:', prefix='Jewish Encyclopedia/', suffix= },
{ id = 'Q20089963', argument = 'NIE', title = 'NIE (1902—05)', project = 'enwikisource', projectCode = 'en:', prefix='The New International Encyclopædia/', suffix= },
{ id = 'Q16082057', argument = 'NSRW', title = 'NSRW (1914)', project = 'enwikisource', projectCode = 'en:', prefix='The New Student\'s Reference Work/', suffix= }
} local function getClaimValues( entity, propertyId ) local result = {}
local claim = entity.claims[ propertyId ];
if ( claim == nil ) then
return result;
end
for _, statement in pairs( claim ) do
local mainsnak = statement.mainsnak;
if ( mainsnak ~= nil and mainsnak.datavalue ~= nil ) then
if ( mainsnak.datavalue.type == "string" ) then
result[#result+1] = mainsnak.datavalue.value;
elseif ( mainsnak.datavalue.type == "wikibase-entityid" ) then
result[#result+1] = 'Q' .. mainsnak.datavalue.value["numeric-id"];
else
result[#result+1] = mainsnak.datavalue.value;
end
end
end
return result; end local function getQualifierValues( statement, qualifierName ) local result = {}
if (statement ~= nil
and statement.qualifiers ~= nil
and statement.qualifiers[qualifierName] ~= nil) then
local qualifiers = statement.qualifiers[qualifierName];
for _, qualifier in pairs( qualifiers ) do
if (qualifier.datavalue ~= nil
and qualifier.datavalue.type ~= nil
and qualifier.datavalue.value ~= nil) then
if ( qualifier.datavalue.type == "wikibase-entityid" ) then
result[#result+1] = 'Q' .. qualifier.datavalue.value["numeric-id"];
end
end
end
end
return result;
end local p = {}; function p.populateOtherSourcesByEntityId( entityId, result ) if ( result == nil ) then
result = {};
end
if ( entityId == nil ) then
return result;
end
local entity = mw.wikibase.getEntity( entityId );
if ( entity == nil ) then
return result;
end
return p.populateOtherSourcesByEntity( entity, result ); end function p.populateOtherSourcesByEntity( entity, result ) if ( result == nil ) then
result = {};
end
if ( entity == nil or entity.claims == nil ) then
return result;
end
-- first check current item references
local describedByClaim = entity.claims[ 'P1343' ];
if ( describedByClaim ~= nil ) then
for _, statement in pairs( describedByClaim ) do
if ( statement.mainsnak ~= nil
and statement.rank ~= 'deprecated'
and statement.mainsnak.datavalue.type == "wikibase-entityid"
and statement.mainsnak.datavalue.value["numeric-id"] ~= nil ) then
local dictId = 'Q' .. statement.mainsnak.datavalue.value["numeric-id"]
for _, sourceDescription in pairs( otherSources ) do
local dictionaryShortTitle = sourceDescription.argument;
local dictinaryEntityId = sourceDescription.id;
if ( dictinaryEntityId == dictId ) then
for _, qualifierValue in pairs( getQualifierValues( statement, 'P248' ) ) do
local dictLinks = result[ dictionaryShortTitle ];
if ( dictLinks == nil ) then
dictLinks = {};
result[ dictionaryShortTitle ] = dictLinks;
end
dictLinks[ qualifierValue ] = qualifierValue;
end
end
end
end
end
end
-- check if entity have main topic item
if ( entity ) then
local parentEntityIds = getClaimValues( entity, 'P921' );
for _, parentEntityId in pairs( parentEntityIds ) do
p.populateOtherSourcesByEntityId( parentEntityId, result );
end
end
-- check if entity have edition of item
if ( entity ) then
local parentEntityIds = getClaimValues( entity, 'P629' );
for _, parentEntityId in pairs( parentEntityIds ) do
p.populateOtherSourcesByEntityId( parentEntityId, result );
end
end
return result; end local function getLink( sourceDescription, entityId ) if ( sourceDescription.project ~= currentProject ) then local entity = mw.wikibase.getEntity( entityId ); if ( not entity) then return nil; end if ( not entity.sitelinks or not entity.sitelinks[sourceDescription.project]) then return nil; end return ':' .. sourceDescription.projectCode .. entity.sitelinks[sourceDescription.project].title; end -- TODO: handle interwikis return mw.wikibase.sitelink( entityId ); end local function isNotBlank( str ) return str ~= nil and mw.ustring.len( str ) > 0; end local function getFirstCurrentTitlePart( ) local title = mw.title.getCurrentTitle().baseText;
local slashPos = mw.ustring.find( title, '/' );
if ( slashPos == nil ) then
return title;
end
return mw.ustring.sub( title, 0, slashPos - 1 );
end local function isCurrentPageDO( ) local title = mw.title.getCurrentTitle().text; return mw.ustring.find( title, '/ДО/' ) ~= nil or mw.ustring.find( title, '/ДО' ) == mw.ustring.len( title ) - 2; end local function getPageTitleFromArgument( sourceDescription, title, isDO ) if ( sourceDescription.project ~= currentProject ) then return ':' .. sourceDescription.projectCode .. sourceDescription.prefix .. title .. sourceDescription.suffix; end if ( isDO ) then
local linkDO = string.gsub(sourceDescription.titleDO, "$1", title);
local linkVT = string.gsub(sourceDescription.titleVT, "$1", title);
if ( mw.title.new( linkDO , 0 ).exists ) then
return linkDO;
end
if ( mw.title.new( linkVT , 0 ).exists ) then
return linkVT;
end
return linkDO;
end
local template = sourceDescription.titleVT; local link = string.gsub(template, "$1", title); return link; end local function getLinkFromArgument( sourceDescription, title, isDO ) return ': ' .. sourceDescription.title .. ' '; end function p.renderOtherSources( frame ) local args = frame:getParent().args; local otherSourcesIds = p.populateOtherSourcesByEntity( mw.wikibase.getEntity(), nil ); local titleFirstPart = getFirstCurrentTitlePart( ); local isDO = isCurrentPageDO(); local result = "Атын төрүттэр"; local count = 0; for _, sourceDescription in pairs( otherSources ) do
local dictArgName = sourceDescription.argument;
local id = sourceDescription.id;
if ( titleFirstPart ~= dictArgName ) then
if ( isNotBlank( args[ dictArgName ] ) ) then
mw.log( dictArgName );
-- local keyword to suppress WD output
if args[ dictArgName ] ~= '__NULL__' then
result = result .. getLinkFromArgument( sourceDescription, args[ dictArgName ], isDO ) .. ;
count = count + 1;
end
elseif ( otherSourcesIds[ dictArgName ] ~= nil ) then
local ids = otherSourcesIds[ dictArgName ];
for _, id in pairs( ids) do
result = result .. ': ' .. sourceDescription.title .. ' ';
count = count + 1;
end
end
end
end
if ( count == 0 ) then
return nil;
end
return frame:preprocess( 'Халыып:* ' .. result ); end return p; |
Ошибка скрипта: Функции «editionsList» не существует.
|