Modul:InfoboxActor
Documentația acestui modul poate fi creată la Modul:InfoboxActor/doc
local getArgs = require('Modul:Arguments').getArgs
local infoboxbio = require('Modul:InfoboxBiography')
local wikidata = require('Modul:Wikidata')
local infoboxImage = require('Modul:InfoboxImage').InfoboxImage
local TableTools = require('Modul:TableTools')
local join = require('Modul:Separated entries')._main
local toWdEditLink = require('Modul:EditAtWikidata')
local set = require('Modul:Set')
local p = {}
local function processArgs(args)
local outArgs = {
doc = 'Infocaseta Actor',
wikidata = 'y',
aboveclass = 'cinema',
abovestyle = 'background-color:{{{bgcolor|#F0E68C}}}; color:#000000;',
datastyle = 'text-align:left',
}
outArgs['culoare cadru'] = 'F0E68C'
outArgs['child'] = args['embed']
outArgs['name'] = outArgs['child'] and 'Cariera actoricească' or args['nume'] or wikidata.findLabel(nil, 'ro')
if outArgs['name'] == '' then outArgs['name'] = mw.title.getCurrentTitle().text end
outArgs['image'] = args['imagine'] or args['image'] or (outArgs['child'] == nil and wikidata.findOneValueNoRef('P18'))
outArgs['imagesize'] = args['dimensiune imagine'] or args['imagesize']
outArgs['caption'] = args['descriere'] or args['descriere imagine'] or args['caption']
outArgs['birth_name'] = args['nume naștere'] or args['birth_name']
outArgs['birth_date'] = args['dată naștere'] or args['birth_date']
outArgs['birth_place'] = args['loc naștere'] or args['birth_place']
outArgs['death_date'] = args['dată deces'] or args['death_date']
outArgs['death_place'] = args['loc deces'] or args['death_place']
outArgs['citizenship'] = args['cetățenie'] or args['citizenship']
outArgs['etnie'] = args['etnie']
outArgs['parents'] = args['părinți'] or args['parents']
outArgs['spouse'] = args['căsătorit cu'] or args['spouse']
outArgs['copii'] = args['children'] or args['copii']
outArgs['partener'] = args['partener'] or args['partner']
outArgs['frați'] = args['frați']
outArgs['occupation'] = args['ocupație'] or args['occupation']
local idx = 1
outArgs['label' .. tostring(idx)] = '[[Alma mater]]'
outArgs['data' .. tostring(idx)] = args['alma mater'] or (outArgs['child'] == nil and wikidata._getValueListWithSeparator({tostring(mw.html.create('br')), 'P69'}))
idx = idx + 1
outArgs['label' .. tostring(idx)] = 'Înălțime'
outArgs['data' .. tostring(idx)] = args['înălțime']
idx = idx + 1
outArgs['label' .. tostring(idx)] = 'Alte nume'
outArgs['data' .. tostring(idx)] = args['alte nume']
idx = idx + 1
outArgs['label' .. tostring(idx)] = 'Ani de activitate'
outArgs['data' .. tostring(idx)] = args['ani de activitate'] or args['years_active']
idx = idx + 1
outArgs['label' .. tostring(idx)] = 'Roluri importante'
outArgs['data' .. tostring(idx)] = args['roluri importante']
idx = idx + 1
outArgs['label' .. tostring(idx)] = 'Influențe'
outArgs['data' .. tostring(idx)] = args['influențe']
idx = idx + 1
outArgs['label' .. tostring(idx)] = 'A influențat pe'
outArgs['data' .. tostring(idx)] = args['influențat']
idx = idx + 1
outArgs['label' .. tostring(idx)] = 'Debut'
outArgs['data' .. tostring(idx)] = args['operă_de_debut']
idx = idx + 1
outArgs['label' .. tostring(idx)] = 'Cunoscut pentru'
outArgs['data' .. tostring(idx)] = args['cunoscut pentru']
idx = idx + 1
local oscar = args['oscar']
local gglobe = args['goldenglobeawards']
local bafta = args['bafta']
local cesar = args['cesar']
local emmy = args['emmy']
local tony = args['tony']
local goya = args['goya']
local afia = args['afia']
local filmfare = args['filmfare']
local olivier = args['olivier']
local gopo = args['gopo']
local otherawards = args['alte premii']
local oscarslist = {}
local emmieslist = {}
local otherawardslist = {}
local goldenglobeslist = {}
local baftalist = {}
local tonylist = {}
local wdAwardClaims = wikidata.findBestClaimsForProperty(nil, 'P166')
if wdAwardClaims then
for wdAwardClaimIdx, eachWdAwardClaim in pairs(wdAwardClaims) do
if eachWdAwardClaim.type == 'statement' and eachWdAwardClaim.mainsnak and eachWdAwardClaim.mainsnak.snaktype == 'value' then
local awardId = eachWdAwardClaim.mainsnak.datavalue.value['numeric-id']
local awardInstanceOfs = wikidata.findBestClaimsForProperty('Q' .. tostring(awardId), 'P31')
local awardSubclassOfs = wikidata.findBestClaimsForProperty('Q' .. tostring(awardId), 'P279')
local awardSuperclasses = {}
if awardInstanceOfs then
for _,eachAward in pairs(awardInstanceOfs) do
table.insert(awardSuperclasses, eachAward)
end
end
if awardSubclassOfs then
for _,eachAward in pairs(awardSubclassOfs) do
table.insert(awardSuperclasses, eachAward)
end
end
local forWork = {}
--wikidata.findQualifierValueListForClaim(eachWdAwardClaim, 'P1686') -- for work
local forWorkQualifiers = eachWdAwardClaim.qualifiers and eachWdAwardClaim.qualifiers['P1686']
if forWorkQualifiers then for _,eachForWorkQualifier in ipairs(forWorkQualifiers) do
if eachForWorkQualifier.snaktype == 'value' then
table.insert(forWork, wikidata.findLinkToItemWithCallback(eachForWorkQualifier.datavalue.value.id, true, nil, function() return wikidata.findTitleOfWork(eachForWorkQualifier.datavalue.value.id) end))
end
end end
local pointInTime = eachWdAwardClaim.qualifiers and eachWdAwardClaim.qualifiers['P585'] -- point in time
local pointInTimeDate = nil
local pointInTimeStr = nil
if pointInTime == nil or #pointInTime == 0 or pointInTime[1].snaktype ~= 'value' then
local subjectOfSnak = eachWdAwardClaim.qualifiers and eachWdAwardClaim.qualifiers['P805'] --subject of
if subjectOfSnak and subjectOfSnak[1] and subjectOfSnak[1].snaktype == 'value' then
local rawPointInTime = wikidata.findBestClaimsForProperty('Q' .. tostring(subjectOfSnak[1].datavalue.value['numeric-id']), 'P585') --point in time
if rawPointInTime and rawPointInTime[1] then
pointInTimeDate = wikidata.extractDateFromClaim(rawPointInTime[1])
end
end
elseif pointInTime and pointInTime[1] then
pointInTimeDate = wikidata.extractDateFromClaim(pointInTime[1])
end
if pointInTimeDate then
pointInTimeStr = '[[' .. pointInTimeDate.year .. ']]'
end
local awardName = wikidata.printSnak(eachWdAwardClaim.mainsnak)
local awardSpecification = ''
if pointInTimeStr then
awardSpecification = awardSpecification .. ' (' .. pointInTimeStr .. ')'
end
if forWork and #forWork > 0 then
forWork.separator = ', '
forWork.conjunction = ' și '
awardSpecification = awardSpecification .. ' pentru ' .. join(forWork)
end
awardSpecification = awardSpecification .. wikidata.outputReferences(eachWdAwardClaim)
local supertype = 'other'
local addedToList = false
for _,eachAwardsuperclassClaim in pairs(awardSuperclasses) do
if eachAwardsuperclassClaim.type == 'statement' and eachAwardsuperclassClaim.mainsnak.snaktype == 'value' then
local typeId = eachAwardsuperclassClaim.mainsnak.datavalue.value['numeric-id']
if typeId == 19020 then --oscar
awardName = mw.ustring.gsub(awardName, '|Premiul Oscar pentru ', '|')
awardName = mw.ustring.gsub(awardName, '|%s*(%a)', function(m1) return '|' .. mw.ustring.upper(m1) end)
table.insert(oscarslist, awardName .. awardSpecification)
addedToList = true
elseif typeId == 1011547 then -- golden globe
awardName = mw.ustring.gsub(awardName, '|Premiul Globul de Aur pentru ', '|')
awardName = mw.ustring.gsub(awardName, '|%s*(%a)', function(m1) return '|' .. mw.ustring.upper(m1) end)
set.insert(goldenglobeslist, awardName .. awardSpecification)
addedToList = true
elseif typeId == 732997 then --bafta
awardName = mw.ustring.gsub(awardName, '|Premiul BAFTA pentru ', '|')
awardName = mw.ustring.gsub(awardName, '|%s*(%a)', function(m1) return '|' .. mw.ustring.upper(m1) end)
table.insert(baftalist, awardName .. awardSpecification)
addedToList = true
elseif typeId == 123737 or typeId == 1044427 then --emmy
table.insert(emmieslist, awardName .. awardSpecification)
addedToList = true
elseif typeId == 191874 then --tony
awardName = mw.ustring.gsub(awardName, '|Premiul Tony pentru ', '|')
awardName = mw.ustring.gsub(awardName, '|%s*(%a)', function(m1) return '|' .. mw.ustring.upper(m1) end)
table.insert(tonylist, awardName .. awardSpecification)
addedToList = true
end
end
end
if not addedToList then
table.insert(otherawardslist, awardName .. awardSpecification)
end
end
end
end
if #oscarslist > 0 then
oscarslist.separator = tostring(mw.html.create('br'))
oscar = join(oscarslist) .. toWdEditLink.displayMessage('P166')
end
if #emmieslist > 0 then
emmieslist.separator = tostring(mw.html.create('br'))
emmy = join(emmieslist) .. toWdEditLink.displayMessage('P166')
end
if #goldenglobeslist > 0 then
goldenglobeslist.separator = tostring(mw.html.create('br'))
gglobe = join(goldenglobeslist) .. toWdEditLink.displayMessage('P166')
end
if #baftalist > 0 then
baftalist.separator = tostring(mw.html.create('br'))
bafta = join(baftalist) .. toWdEditLink.displayMessage('P166')
end
if #tonylist > 0 then
tonylist.separator = tostring(mw.html.create('br'))
tony = join(tonylist) .. toWdEditLink.displayMessage('P166')
end
if otherawards == nil and #otherawardslist > 0 then
otherawardslist.separator = tostring(mw.html.create('br'))
otherawards = join(otherawardslist) .. toWdEditLink.displayMessage('P166')
end
if oscar then
outArgs['header' .. tostring(idx)] = '[[Premii Oscar]]'
idx = idx + 1
outArgs['data' .. tostring(idx)] = oscar
idx = idx + 1
end
if gglobe then
outArgs['header' .. tostring(idx)] = '[[Premii Globul de Aur]]'
idx = idx + 1
outArgs['data' .. tostring(idx)] = gglobe
idx = idx + 1
end
if bafta then
outArgs['header' .. tostring(idx)] = '[[Premiile BAFTA|Premii BAFTA]]'
idx = idx + 1
outArgs['data' .. tostring(idx)] = bafta
idx = idx + 1
end
if cesar then
outArgs['header' .. tostring(idx)] = '[[Premiul César|Premii César]]'
idx = idx + 1
outArgs['data' .. tostring(idx)] = cesar
idx = idx + 1
end
if emmy then
outArgs['header' .. tostring(idx)] = '[[Premii Emmy]]'
idx = idx + 1
outArgs['data' .. tostring(idx)] = emmy
idx = idx + 1
end
if tony then
outArgs['header' .. tostring(idx)] = '[[Premiile Tony|Premii Tony]]'
idx = idx + 1
outArgs['data' .. tostring(idx)] = tony
idx = idx + 1
end
if goya then
outArgs['header' .. tostring(idx)] = '[[Premii Goya]]'
idx = idx + 1
outArgs['data' .. tostring(idx)] = goya
idx = idx + 1
end
if afia then
outArgs['header' .. tostring(idx)] = '[[Australian Film Institute Awards|Premii AFI]]'
idx = idx + 1
outArgs['data' .. tostring(idx)] = afia
idx = idx + 1
end
if filmfare then
outArgs['header' .. tostring(idx)] = '[[Premii Filmfare]]'
idx = idx + 1
outArgs['data' .. tostring(idx)] = filmfare
idx = idx + 1
end
if olivier then
outArgs['header' .. tostring(idx)] = '[[Premii Laurence Olivier]]'
idx = idx + 1
outArgs['data' .. tostring(idx)] = olivier
idx = idx + 1
end
if otherawards then
outArgs['header' .. tostring(idx)] = 'Alte premii'
idx = idx + 1
outArgs['data' .. tostring(idx)] = otherawards
idx = idx + 1
end
if gopo then
outArgs['header' .. tostring(idx)] = '[[Premiile Gopo|Premii Gopo]]'
idx = idx + 1
outArgs['data' .. tostring(idx)] = gopo
idx = idx + 1
end
outArgs['signature'] = args['signature'] or args['semnătură']
local embeddedIdsPresent = TableTools.affixNums(args, 'embedded')
if embeddedIdsPresent then
for _,eachEmbeddedId in pairs(embeddedIdsPresent) do
outArgs['data' .. tostring(idx)] = args['embedded' .. tostring(eachEmbeddedId)]
idx = idx + 1
end
end
return outArgs
end
p.fromArgs = function(args)
local processedArgs = processArgs(args)
return infoboxbio.displayInfoboxFromArgs(processedArgs)
end
p.fromFrame = function(frame)
local args = getArgs(frame)
return p.fromArgs(args)
end
return p