יחידה:Sister project links – הבדלי גרסאות
הסרת wikibase תגית: שוחזרה |
|||
שורה 85: | שורה 85: | ||
local title = mw.title.getCurrentTitle().text | local title = mw.title.getCurrentTitle().text | ||
local projectLinks = {} | local projectLinks = {} | ||
local | local entity = mw.wikibase.getEntityIdForCurrentPage() | ||
if args['ויקיפדיה'] then | if args['ויקיפדיה'] then | ||
local t = projectsTemplate['wikipedia'] | local t = projectsTemplate['wikipedia'] | ||
שורה 159: | שורה 154: | ||
if entity~=nil and (not args[proj['arg']] or args[proj['arg']]==nil) and proj['name'] then | if entity~=nil and (not args[proj['arg']] or args[proj['arg']]==nil) and proj['name'] then | ||
if proj['name'] == 'commons' then | if proj['name'] == 'commons' then | ||
local | local commonCat = mw.wikibase.getBestStatements( entity, 'P373' ) | ||
commonCat = commonCat and commonCat[1] and commonCat[1].mainsnak and commonCat[1].mainsnak.datavalue and commonCat[1].mainsnak.datavalue.value | commonCat = commonCat and commonCat[1] and commonCat[1].mainsnak and commonCat[1].mainsnak.datavalue and commonCat[1].mainsnak.datavalue.value | ||
if commonCat~=nil and commonCat~='' then | if commonCat~=nil and commonCat~='' then | ||
שורה 174: | שורה 162: | ||
args['שם ' .. proj['arg']] = title | args['שם ' .. proj['arg']] = title | ||
else | else | ||
args[proj['arg']] = mw.wikibase.sitelink(entity, proj['name']) | |||
end | end | ||
end | end |