وحدة:Wikidata2 sub modules/otheruseخصائص متنوعة: قوالب
أمثلة1
2
3جلب مكان الولادة (P19) مع تقع في التقسيم الإداري (P131) حتى الوصول إلى البلد (P17).
local p = {}
local sortclaims
function isvalid(x)
if x and x ~= "" then return x end
return nil
end
function ifd ( fii , opt )
if isvalid(opt) then
if opt == 'club' then
if fii == 'Q476028' then
return fii
end
elseif opt == 'team' then
if fii == 'Q6979593' or fii == 'Q23895910' or fii == 'Q23847779' then
return fii
end
else
return fii
end
end
end
function p.foot( claims , options)
local formattedStatements = {}
local statementsraw = {}
if sortclaims == nil then
sortclaims = require("Module:Wikidata2/sort_claims")
end
if isvalid(options.sortingproperty) and sortclaims.sorting_methods[options.sortbynumber] then
claims = sortclaims.sortbyqualifiernumber(claims, {}, options)
end
if claims then
for i, statement in pairs( claims ) do
options.num = i
local va = formatOneStatement( statement, nil , options )
if va.v then
table.insert( formattedStatements, va.v )
end
table.insert( statementsraw, va.raw )
end
end
local tot = mw.text.listToText( formattedStatements, options.separator, options.conjunction )
if tot == '' then tot = nil end
if options.raw and options.raw ~= '' then
return statementsraw
end
if options.numberofclaims and options.numberofclaims ~= '' then
return #formattedStatements
end
return tot
end
function p.awards( datavalue, datatype, options ) -- used by template:ص.م/سطر جوائز ويكي بيانات
if datatype == 'wikibase-item'
then
local value= datavalue.value
local image = formatStatements( {property ='P2425' , entityId = value.id
, noref =options.noref , size ='30', image ='yes', noref='true' , firstvalue='true'})
local image2 = formatStatements( {property ='P154' , entityId = value.id
, noref =options.noref , size ='30', image ='yes', noref='true' , firstvalue='true'})
local categoryid = formatStatements( {property ='P2517', entityId = value.id, noref ='true'
, firstvalue='true',separator='',conjunction='',formatting ='raw'})
local categoryid2 = formatStatements( {property ='P910', entityId = value.id, noref ='true'
, firstvalue='true',separator='',conjunction='',formatting ='raw'})
if not image or image == '' then image =image2 end
if not categoryid or categoryid == '' then categoryid = categoryid2 end
local category = mw.wikibase.sitelink( categoryid )
local s = formatEntityId( value.id, options ).value
if s and s ~= '' then
if image and image ~= '' then
s = image ..' ' .. s
end
if category and category ~= ''
then
return s.. ' [[' ..category ..']]'
else
return s
end
end
else return ''
end
end
function p.getpropertyfromvalue( datavalue ,datatype , options)
if datatype == 'wikibase-item'
then
local value= datavalue.value
local caca = formatStatements( {
property =options.prop2 , entityId = value.id
, noref =options.noref , rank=options.rank
, size =options.size , image =options.image
, noref='true' , firstvalue='true'
, propertyimage =options.prop3
}
)
local asdf = formatEntityId( value.id, options ).value
if asdf and asdf ~= '' then
if caca and caca ~= ''
then
return caca ..' '.. asdf
else return asdf
end
end
else return 'datatype isn\'t wikibase-item'
end
end
--[[
this is like p.formatPlaceWithQualifiers in ru:Модуль:Wikidata/Places
]]
function p.PlacesWithLocatedIn( datavalue, datatype, options )
if datatype == 'wikibase-item'
then
function P131 (id,formatting,p)
st = formatStatements( {property =p or 'P131' , entityId = id, noref ='t', firstvalue='true',formatting=formatting})
--if id == st then st = nil end
return st
end
local value= datavalue.value
local v = formatEntityId( value.id, options ).value
local P1 = P131(value.id,'')
local P1id = P131(value.id,'raw')
local P2 = P131(P1id,'')
local P2id = P131(P1id,'raw')
local P3 = P131(P2id,'')
local P3id = P131(P2id,'raw')
local P4 = P131(P3id,'')
--table.insert(tt , v)
function dd (s1 ,s2 ,s3 )
if s1 and s1 ~= '' then
if s2 and s2 ~= ''
then
return s1 .. '، '.. s2
else
if s1 == s3
then return s1
else return s1 .. '، '.. s3
end
end
end
end
if v and v ~= ''
then
val = dd(v,dd(P1
,dd(
P2,dd(P3
,P4
, P131(P3id,'','P17')
)
, P131(P2id,'','P17')
)
, P131(P1id,'','P17')
)
, P131(value.id,'','P17')
)
end
return val
else
return 'datatype isn\'t wikibase-item'
end
end
return p
|
Index:
pl ar de en es fr it arz nl ja pt ceb sv uk vi war zh ru af ast az bg zh-min-nan bn be ca cs cy da et el eo eu fa gl ko hi hr id he ka la lv lt hu mk ms min no nn ce uz kk ro simple sk sl sr sh fi ta tt th tg azb tr ur zh-yue hy my ace als am an hyw ban bjn map-bms ba be-tarask bcl bpy bar bs br cv nv eml hif fo fy ga gd gu hak ha hsb io ig ilo ia ie os is jv kn ht ku ckb ky mrj lb lij li lmo mai mg ml zh-classical mr xmf mzn cdo mn nap new ne frr oc mhr or as pa pnb ps pms nds crh qu sa sah sco sq scn si sd szl su sw tl shn te bug vec vo wa wuu yi yo diq bat-smg zu lad kbd ang smn ab roa-rup frp arc gn av ay bh bi bo bxr cbk-zam co za dag ary se pdc dv dsb myv ext fur gv gag inh ki glk gan guw xal haw rw kbp pam csb kw km kv koi kg gom ks gcr lo lbe ltg lez nia ln jbo lg mt mi tw mwl mdf mnw nqo fj nah na nds-nl nrm nov om pi pag pap pfl pcd krc kaa ksh rm rue sm sat sc trv stq nso sn cu so srn kab roa-tara tet tpi to chr tum tk tyv udm ug vep fiu-vro vls wo xh zea ty ak bm ch ny ee ff got iu ik kl mad cr pih ami pwn pnt dz rmy rn sg st tn ss ti din chy ts kcg ve
Portal di Ensiklopedia Dunia