יחידה:Sister project links – הבדלי גרסאות

ניסיון. מויקיפדיה
אין תקציר עריכה
שורה 28: שורה 28:
local title = mw.title.getCurrentTitle().text
local title = mw.title.getCurrentTitle().text
local projectLinks = {}
local projectLinks = {}
local entity = mw.wikibase.getEntityIdForCurrentPage()


if args['חב"דפדיה'] then
if args['חב"דפדיה'] then
שורה 50: שורה 51:


for i, proj in ipairs(projects) do
for i, proj in ipairs(projects) do
if entity~=nil and (not args[proj['arg']] or args[proj['arg']]==nil) and proj['name'] then
if proj['name'] == 'commons' then
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
if commonCat~=nil and commonCat~='' then
commonCat = mw.ustring.format('Category:%s', commonCat)
end
args[proj['arg']] = commonCat
args['שם ' .. proj['arg']] = title
else
args[proj['arg']] = mw.wikibase.sitelink(entity, proj['name'])
end
end
if args[proj['arg']] then
if args[proj['arg']] then
local t = projectsTemplate[proj['template']]
local t = projectsTemplate[proj['template']]