|
|
| Line 1: |
Line 1: |
| local p = {} | | local getArgs = require('Modul:Arguments').getArgs |
| | | local infoboxBio = require('Modul:InfoboxBiography') |
| local infobox = require('Modul:InfoboxBiography') | | local TableTools = require('Modul:TableTools') |
| local wikidata = require('Modul:Wikidata') | | local wikidata = require('Modul:Wikidata') |
| local infoboxImage = require('Modul:InfoboxImage').InfoboxImage | | local editAtWd = require('Modul:EditAtWikidata').displayMessage |
| local bda = require('Modul:BirthDateAndAge')
| |
| local lc = require('Modul:LocationAndCountry')
| |
| local SeparatedEntries = require('Modul:Separated entries')
| |
| local join = SeparatedEntries._main
| |
| local DateUtils = require('Modul:DateUtils')
| |
| local StringUtils = require('Modul:StringUtils') | | local StringUtils = require('Modul:StringUtils') |
| local TableTools = require('Modul:TableTools') | | local p = {} |
| local Set = require('Modul:Set') | | local argscnt = 1 |
| local wdLinker = require('Modul:EditAtWikidata')
| |
| local getArgs = require('Modul:Arguments').getArgs
| |
| local collapsibleList = require('Modul:Collapsible list').display
| |
| local printTimestampForClaim = require('Modul:WikidataUtils/Time/Interval').printTimestampForClaim
| |
| | |
| local _br_ = tostring(mw.html.create('br'))
| |
| local nbsp = mw.text.decode(' ', true)
| |
|
| |
|
| local function smallTextInBrackets(text) | | local function addLabel(ibargs, label) |
| return tostring(mw.html.create('small'):wikitext(StringUtils._encloseString(text, '(', ')'))) | | ibargs['label' .. tostring(argscnt)] = label |
| end | | end |
| | | local function addHeader(ibargs, header) |
| local function extractDataAndNumberFromMultiParam(argName, paramNames) | | ibargs['header' .. tostring(argscnt)] = header |
| local actualParamName = nil | | argscnt = argscnt + 1 |
| local actualParamNumber
| |
| local prevParamName = nil
| |
| for paramIndex = 1, #paramNames do
| |
| local nlStart, nlEnd = mw.ustring.find(argName, paramNames[paramIndex])
| |
| if nlStart == 1 then
| |
| actualParamName = mw.ustring.sub(argName, 1, nlEnd)
| |
| local presumedIndex = mw.ustring.find(argName, "%d+$") or (1 + #(paramNames[paramIndex]))
| |
| local indexStr = mw.text.trim(mw.ustring.sub(argName, presumedIndex, #argName) or "")
| |
| local headingUnderscores = mw.ustring.match(indexStr, '^_+')
| |
| if headingUnderscores then
| |
| indexStr = mw.ustring.sub(indexStr, #headingUnderscores)
| |
| end
| |
| if indexStr == "" then
| |
| actualParamNumber = 1
| |
| elseif mw.ustring.match(indexStr, "^%d+$") then
| |
| actualParamNumber = 1 + tonumber(indexStr)
| |
| else
| |
| actualParamName = prevParamName
| |
| end
| |
| prevParamName = actualParamName
| |
| end
| |
| end
| |
| if not actualParamName then return nil, nil end
| |
| return actualParamName, actualParamNumber
| |
| end | | end |
| | | local function addData(ibargs, data) |
| local function extractQualifierShortNames(claim, qualifierId) | | ibargs['data' .. tostring(argscnt)] = data |
| if claim == nil or claim.qualifiers == nil or qualifierId == nil or claim.qualifiers[qualifierId] == nil then return {} end | | argscnt = argscnt + 1 |
| local nameList = {}
| |
| if claim.qualifiers and claim.qualifiers[qualifierId] then
| |
| for qualIdx,qualifier in ipairs(claim.qualifiers[qualifierId]) do
| |
| local name = nil
| |
| if qualifier.datatype == 'wikibase-item' and qualifier.datavalue and qualifier.datavalue.type == 'wikibase-entityid' then
| |
| local QID = StringUtils._prependIfMissing(tostring(qualifier.datavalue.value['numeric-id']), 'Q')
| |
| name = wikidata.findOneValueNoRef('P1813', QID) -- short name
| |
| local link = nil
| |
| if name == nil then
| |
| link = wikidata.printSnak(qualifier)
| |
| else
| |
| link = wikidata.findLinkToItemWithCallback(QID, false, nil, function() return name end)
| |
| end
| |
| link = link .. wikidata.outputReferences(qualifier)
| |
| table.insert(nameList, link)
| |
| end
| |
| end
| |
| end
| |
| return nameList
| |
| end | | end |
|
| |
|
| local function makeListCollapsibleIfTwoLarge(list, label, limit) | | local function fromArray(args) |
| if #list < limit then | | local ibargs = {['culoare cadru'] = 'CCBBEE', ['culoare text'] = '000', aboveclass = 'regalitate', wikidata = 'y', doc = args['caller'] or 'Infocaseta Regalitate', default_title = 'Domnia' } |
| return SeparatedEntries.br(list)
| | local origargs = TableTools.shallowClone(args) |
| else | | local numberedargs = TableTools.numData(origargs, true) |
| return collapsibleList(true, 'border:none; padding:0;', '', tostring(#list) .. ' ' .. label, 'text-align: left;', list) | | local unnumberedargs = nil |
| | if origargs['succesiune'] or origargs['domnie'] then |
| | unnumberedargs = { succesiune = origargs['succesiune'], domnie = origargs['domnie'], ['încoronare'] = origargs['încoronare'] or origargs['incoronare'], |
| | predecesor = origargs['predecesor'], succesor = origargs['succesor'], regent = origargs['regent'] } |
| | table.insert(numberedargs, 1, unnumberedargs) |
| end | | end |
| end
| | |
| | | ibargs['subheader1'] = origargs['titlu'] |
| local function computeArguments(origArgs)
| | ibargs['subheaderstyle'] = 'background-color:#dedede;' |
| local processedArgs = {} | | |
| local functii = {} | | ibargs['name'] = origargs['nume'] |
| local embedded = {} | | ibargs['image'] = origargs['image'] or origargs['imagine'] |
| for argK, argV in pairs(origArgs) do | | ibargs['image_size'] = origargs['image_size'] or origargs['mărime'] |
| if argV ~= nil and mw.ustring.len(mw.text.trim(argV)) > 0 then | | ibargs['caption'] = origargs['descriere'] |
| processedArgs[argK] = mw.text.trim(argV)
| | ibargs['spouse'] = origargs['soț'] or origargs['casatorit cu'] or origargs['căsătorit cu'] |
| | ibargs['spouse-type'] = origargs['spouse-type'] |
| | ibargs['children'] = origargs['urmași'] |
| | ibargs['birth_name'] = origargs['nume complet'] |
| | ibargs['father'] = origargs['tată'] or origargs['tatal'] |
| | ibargs['mother'] = origargs['mamă'] or origargs['mama'] |
| | if ibargs['father'] or ibargs['mother'] then |
| | ibargs['parents'] = table.concat(TableTools.compressSparseArray({ibargs['father'], ibargs['mother']}), tostring(mw.html.create('br'))) |
| | end |
| | ibargs['siblings'] = origargs['frați'] |
| | ibargs['birth_date'] = origargs['data nașterii'] or origargs['data nasterii'] |
| | ibargs['death_date'] = origargs['data decesului'] or origargs['data mortii'] or origargs['data morții'] |
| | ibargs['birth_place'] = origargs['locul nașterii'] or origargs['locul nasterii'] |
| | ibargs['death_place'] = origargs['locul decesului'] or origargs['locul mortii'] or origargs['locul morții'] |
| | ibargs['burial_place'] = origargs['locul înmormântării'] or origargs['înmormântat'] |
| | ibargs['burial_date'] = origargs['data înmormântării'] |
| | ibargs['occupation'] = origargs['ocupație'] |
| | ibargs['religion'] = origargs['religie'] |
| | ibargs['signature'] = origargs['semnătură'] or origargs['semnatura'] |
| | |
| | local capitalizeTitlesInList = function(list) |
| | local capitalizedList = {} |
| | if list then |
| | for _,eachElement in ipairs(list) do |
| | table.insert(capitalizedList, StringUtils._capitalize({eachElement})) |
| | end |
| end | | end |
| | return capitalizedList |
| end | | end |
| local q = origArgs.q or mw.wikibase.getEntityIdForCurrentPage()
| |
|
| |
| local fem = wikidata.isFemale(q)
| |
|
| |
|
| for argK, argV in pairs(processedArgs) do | | local royalTitle = origargs['titluri'] or origargs['altetitulaturi'] or table.concat(capitalizeTitlesInList(wikidata.getTimestampedValueList(nil, 'P97')), tostring(mw.html.create('br'))) |
| local presumedFunctionParamName, presumedFunctionParamNumber = extractDataAndNumberFromMultiParam(argK, {"functia", "funcție", "office"})
| |
| if presumedFunctionParamName and presumedFunctionParamNumber and type(presumedFunctionParamNumber) == 'number' then
| |
| if not functii[presumedFunctionParamNumber] then functii[presumedFunctionParamNumber] = {} end
| |
| functii[presumedFunctionParamNumber].denumire = argV
| |
| end
| |
| | | |
| local presumedOrderParamName, presumedOrderParamNumber = extractDataAndNumberFromMultiParam(argK, {"ordine", "order"})
| | local royalFamily = origargs['casa'] or origargs['casa regala'] or origargs['casă regală'] or origargs['casa regală'] or table.concat(capitalizeTitlesInList(wikidata.getTimestampedValueList(nil, 'P53')), tostring(mw.html.create('br'))) |
| if presumedOrderParamName and presumedOrderParamNumber and type(presumedOrderParamNumber) == 'number' then
| | local royalAnthem = origargs['imn regal'] or wikidata.findOneValue('P85') |
| if not functii[presumedOrderParamNumber] then functii[presumedOrderParamNumber] = {} end
| | local heirApparent = origargs['moștenitor'] or origargs['mostenitor'] |
| functii[presumedOrderParamNumber].ordine = argV
| | |
| end
| | if royalTitle or royalFamily or royalAnthem then |
| | | addHeader(ibargs, 'Apartenență nobiliară') |
| local presumedNomParamName, presumedNomParamNumber = extractDataAndNumberFromMultiParam(argK, {"nominalizat", "candidat", "nominee", "candidate"}) | | if royalTitle then |
| if presumedNomParamName and presumedNomParamNumber and type(presumedNomParamNumber) == 'number' then | | addLabel(ibargs, 'Titluri') |
| if not functii[presumedNomParamNumber] then functii[presumedNomParamNumber] = {} end | | addData(ibargs, royalTitle) |
| functii[presumedNomParamNumber].nom = argV
| |
| end | | end |
| | | if royalFamily then |
| local presumedStartParamName, presumedStartParamNumber = extractDataAndNumberFromMultiParam(argK, {"inceput", "început", "term_start"})
| | addLabel(ibargs, 'Familie nobiliară') |
| if presumedStartParamName and presumedStartParamNumber and type(presumedStartParamNumber) == 'number' then
| | addData(ibargs, royalFamily) |
| if not functii[presumedStartParamNumber] then functii[presumedStartParamNumber] = {} end
| |
| functii[presumedStartParamNumber].startTime = argV
| |
| end | | end |
| | | if royalAnthem then |
| local presumedEndParamName, presumedEndParamNumber = extractDataAndNumberFromMultiParam(argK, {"sfarsit", "sfârșit", "term_end"})
| | addLabel(ibargs, 'Imn regal') |
| if presumedEndParamName and presumedEndParamNumber and type(presumedEndParamNumber) == 'number' then
| | addData(ibargs, royalAnthem) |
| if not functii[presumedEndParamNumber] then functii[presumedEndParamNumber] = {} end
| |
| functii[presumedEndParamNumber].endTime = argV
| |
| end | | end |
| | | if heirApparent then |
| local presumedVpParamName, presumedVpParamNumber = extractDataAndNumberFromMultiParam(argK, {"vice_presedinte", "vice_președinte", "vicepreședinte", "vicepresedinte", "vicepresident"})
| | addLabel(ibargs, 'Moștenitor') |
| if presumedVpParamName and presumedVpParamNumber and type(presumedVpParamNumber) == 'number' then
| | addData(ibargs, heirApparent) |
| if not functii[presumedVpParamNumber] then functii[presumedVpParamNumber] = {} end
| |
| functii[presumedVpParamNumber].vp = argV
| |
| end
| |
| | |
| local presumedVpmParamName, presumedVpmParamNumber = extractDataAndNumberFromMultiParam(argK, {"vice_prim_ministru", "viceprimeminister"})
| |
| if presumedVpmParamName and presumedVpmParamNumber and type(presumedVpmParamNumber) == 'number' then
| |
| if not functii[presumedVpmParamNumber] then functii[presumedVpmParamNumber] = {} end
| |
| functii[presumedVpmParamNumber].vpm = argV
| |
| end
| |
| | |
| local presumedDptyParamName, presumedDptyParamNumber = extractDataAndNumberFromMultiParam(argK, {"deputy", "deputat", "loctiitor", "locțiitor"})
| |
| if presumedDptyParamName and presumedDptyParamNumber and type(presumedDptyParamNumber) == 'number' then
| |
| if not functii[presumedDptyParamNumber] then functii[presumedDptyParamNumber] = {} end
| |
| functii[presumedDptyParamNumber].deputy = argV
| |
| end
| |
| | |
| local presumedPresParamName, presumedPresParamNumber = extractDataAndNumberFromMultiParam(argK, {"presedinte", "președinte", "president"})
| |
| if presumedPresParamName and presumedPresParamNumber and type(presumedPresParamNumber) == 'number' then
| |
| if not functii[presumedPresParamNumber] then functii[presumedPresParamNumber] = {} end
| |
| functii[presumedPresParamNumber].president = argV
| |
| end
| |
| | |
| local presumedPmParamName, presumedPmParamNumber = extractDataAndNumberFromMultiParam(argK, {"primministru", "prim_ministru", "primeminister"})
| |
| if presumedPmParamName and presumedPmParamNumber and type(presumedPmParamNumber) == 'number' then
| |
| if not functii[presumedPmParamNumber] then functii[presumedPmParamNumber] = {} end
| |
| functii[presumedPmParamNumber].pm = argV
| |
| end
| |
| | |
| local presumedMnrchParamName, presumedMnrchParamNumber = extractDataAndNumberFromMultiParam(argK, {"monarh", "monarch"})
| |
| if presumedMnrchParamName and presumedMnrchParamNumber and type(presumedMnrchParamNumber) == 'number' then
| |
| if not functii[presumedMnrchParamNumber] then functii[presumedMnrchParamNumber] = {} end
| |
| functii[presumedMnrchParamNumber].monarch = argV
| |
| end
| |
| | |
| local presumedPredParamName, presumedPredParamNumber = extractDataAndNumberFromMultiParam(argK, {"predecesor", "predecessor"})
| |
| if presumedPredParamName and presumedPredParamNumber and type(presumedPredParamNumber) == 'number' then | |
| if not functii[presumedPredParamNumber] then functii[presumedPredParamNumber] = {} end
| |
| functii[presumedPredParamNumber].pred = argV | |
| end
| |
| | |
| local presumedSuccParamName, presumedSuccParamNumber = extractDataAndNumberFromMultiParam(argK, {"succesor", "successor"})
| |
| if presumedSuccParamName and presumedSuccParamNumber and type(presumedSuccParamNumber) == 'number' then
| |
| if not functii[presumedSuccParamNumber] then functii[presumedSuccParamNumber] = {} end
| |
| functii[presumedSuccParamNumber].succ = argV
| |
| end
| |
| | |
| local presumedCircParamName, presumedCircParamNumber = extractDataAndNumberFromMultiParam(argK, {"circumscriptia", "circumscripția"})
| |
| if presumedCircParamName and presumedCircParamNumber and type(presumedCircParamNumber) == 'number' then
| |
| if not functii[presumedCircParamNumber] then functii[presumedCircParamNumber] = {} end | |
| functii[presumedCircParamNumber].circumscription = argV
| |
| end
| |
| | |
| local presumedEmbeddedParamName, presumedEmbeddedParamNumber = extractDataAndNumberFromMultiParam(argK, {"embedded"})
| |
| if presumedEmbeddedParamName and presumedEmbeddedParamNumber and type(presumedEmbeddedParamNumber) == 'number' then
| |
| embedded[presumedEmbeddedParamNumber] = argV
| |
| end | | end |
| end | | end |
| if table.maxn(functii) == 0 then
| |
| local wikidataPositions = wikidata.findSortedClaimsForProperty(q, 'P39')
| |
| if wikidataPositions then
| |
| for psnIdx = 1,#wikidataPositions do
| |
| if wikidata.isClaimTrue(wikidataPositions[psnIdx]) and wikidata.hasValueSnak(wikidataPositions[psnIdx]) then
| |
| local posn = {}
| |
| posn.q = StringUtils._prependIfMissing(wikidataPositions[psnIdx].mainsnak.datavalue.value['numeric-id'], 'Q')
| |
|
| |
|
| local orderValues = wikidata.findQualifierValueListForClaim(wikidataPositions[psnIdx], 'P1545')
| | local fem = args['f'] or args['femeie'] or wikidata.isFemale() |
| posn.orders = {}
| | |
|
| | if not numberedargs or #numberedargs == 0 then |
| if orderValues then
| | local wdPositionClaims = wikidata.findClaimsForProperty(nil, 'P39') or {} |
| for _,eachRawOrder in ipairs(orderValues) do
| | for _,eachClaim in ipairs(wdPositionClaims) do |
| if eachRawOrder and mw.text.trim(eachRawOrder) ~= '' then
| | if eachClaim.mainsnak.snaktype == 'value' then |
| if eachRawOrder == '1' then table.insert(posn.orders, 'primul')
| | local positionQid = eachClaim.mainsnak.datavalue.value['numeric-id'] |
| else table.insert(posn.orders, 'al ' .. eachRawOrder .. '-lea')
| | local linktoPosition = wikidata.findLinkToItem('Q' .. tostring(positionQid), true, fem, false) .. ' ' .. editAtWd('P39') |
| end
| | addHeader(ibargs, linktoPosition) |
| end
| | local reignTimes = {} |
| | if eachClaim.qualifiers then |
| | if eachClaim.qualifiers['P580'] and eachClaim.qualifiers['P580'][1] then |
| | if eachClaim.qualifiers['P580'][1].snaktype == 'value' then |
| | table.insert(reignTimes, wikidata.printSnak(eachClaim.qualifiers['P580'][1])) |
| | elseif eachClaim.qualifiers['P580'][1].snaktype == 'unknownvalue' then |
| | table.insert(reignTimes, '?') |
| end | | end |
| end | | end |
|
| | if eachClaim.qualifiers['P582'] and eachClaim.qualifiers['P582'][1] then |
| local roPosnLabel = mw.wikibase.getLabelByLang(posn.q, 'ro') | | if eachClaim.qualifiers['P582'][1].snaktype == 'value' then |
| if roPosnLabel and #posn.orders == 0 then roPosnLabel = StringUtils._capitalize({roPosnLabel}) end
| | table.insert(reignTimes, wikidata.printSnak(eachClaim.qualifiers['P582'][1])) |
| local posnTitleParts = {}
| | elseif eachClaim.qualifiers['P582'][1].snaktype == 'unknownvalue' then |
| if wikidataPositions[psnIdx].qualifiers and (wikidataPositions[psnIdx].qualifiers['P642'] or wikidataPositions[psnIdx].qualifiers['P2389']) then
| | table.insert(reignTimes, '?') |
| table.insert(posnTitleParts, roPosnLabel or wikidata.findNativeOrEnglishLabel(posn.q, #posnTitleParts == 0))
| |
| table.insert(posnTitleParts, 'în')
| |
| local listOfQualValues = wikidataPositions[psnIdx].qualifiers['P642']
| |
| and wikidata.findQualifierValueListForClaim(wikidataPositions[psnIdx], 'P642')
| |
| or wikidata.findQualifierValueListForClaim(wikidataPositions[psnIdx], 'P2389')
| |
| table.insert(posnTitleParts, table.concat(listOfQualValues, ', ')) | |
| else
| |
| table.insert(posnTitleParts,
| |
| (mw.wikibase.sitelink(posn.q) or wikidata.loadOneValueInChain({posn.q, 'P2354'}))
| |
| and wikidata.findLinkToItem(posn.q, #posn.orders == 0, fem, false)
| |
| or roPosnLabel or wikidata.findNativeOrEnglishLabel(posn.q, #posn.orders == 0)) | |
| end
| |
| table.insert(posnTitleParts, wdLinker.displayMessage('P39', q))
| |
| posn.denumire = table.concat(posnTitleParts, ' ')
| |
|
| |
| for _,startTimeQual in ipairs(wikidataPositions[psnIdx].qualifiers and wikidataPositions[psnIdx].qualifiers['P580'] or {}) do
| |
| if (wikidata.isValueSnak(startTimeQual)) then
| |
| posn.startTime = DateUtils.extractDateFromWikidataSnak(startTimeQual)
| |
| end | | end |
| end | | end |
| for _,endTimeQual in ipairs(wikidataPositions[psnIdx].qualifiers and wikidataPositions[psnIdx].qualifiers['P582'] or {}) do | | if #reignTimes == 0 and eachClaim.qualifiers['P585'] and eachClaim.qualifiers['P585'][1] then |
| if (wikidata.isValueSnak(endTimeQual)) then | | if eachClaim.qualifiers['P585'].snaktype == 'value' then |
| posn.endTime = DateUtils.extractDateFromWikidataSnak(endTimeQual)
| | table.insert(reignTimes, wikidata.printSnak(eachClaim.qualifiers['P585'][1])) |
| if posn.endTime.precision == 9 then
| | elseif eachClaim.qualifiers['P585'].snaktype == 'unknownvalue' then |
| posn.endTime.month = 12
| | table.insert(reignTimes, '?') |
| posn.endTime.day = 31
| |
| elseif posn.endTime.precision == 10 then | |
| posn.endTime = DateUtils.addDaysToDate({day = 1, month = 1 + (posn.endTime.month % 12), year = (posn.endTime.month < 12) and posn.endTime.year or (posn.endTime.year + 1) }, -1)
| |
| posn.endTime.precision = 10
| |
| end | |
| end | | end |
| end | | end |
| | | if #reignTimes > 0 then |
| posn.refs = wikidata.getReferences(wikidataPositions[psnIdx]) | | addLabel(ibargs, 'Domnie') |
| posn.legislatures = wikidata.findQualifierValueListForClaim(wikidataPositions[psnIdx], 'P2937')
| | addData(ibargs, table.concat(reignTimes, mw.text.decode(' – ', true))) |
| posn.parlGroups = wikidata.findQualifierValueListForClaim(wikidataPositions[psnIdx], 'P4100')
| |
| posn.elections = wikidata.findQualifierValueListForClaim(wikidataPositions[psnIdx], 'P2715')
| |
| | |
| posn.predecessors = wikidata.findQualifierValueListForClaim(wikidataPositions[psnIdx], 'P1365')
| |
| posn.successors = wikidata.findQualifierValueListForClaim(wikidataPositions[psnIdx], 'P1366')
| |
| | |
| posn.circumscription = table.concat(extractQualifierShortNames(wikidataPositions[psnIdx], 'P768'), tostring(mw.html.create('br')))
| |
|
| |
| posn.headsofstate = wikidata.findQualifierValueListForClaim(wikidataPositions[psnIdx], 'P35')
| |
| posn.cabinets = wikidata.findQualifierValueListForClaim(wikidataPositions[psnIdx], 'P5054')
| |
|
| |
| table.insert(functii, posn)
| |
| end
| |
| end
| |
|
| |
| local foldedPositions = { }
| |
| for psnIdx,psn in ipairs(functii) do
| |
| local foldedPosition = { q = psn.q, posns = {}, denumire = psn.denumire, refs = {}, isnew = true }
| |
| for foldedPsnIdx,foldedPsn in ipairs(foldedPositions) do
| |
| if foldedPsn.q == functii[psnIdx].q then
| |
| foldedPosition = foldedPsn
| |
| break
| |
| end | | end |
| end
| | if eachClaim.qualifiers['P1365'] and eachClaim.qualifiers['P1365'][1] then |
| psn.denumire = nil
| | addLabel(ibargs, 'Predecesor') |
| table.insert(foldedPosition.posns, psn)
| | if eachClaim.qualifiers['P1365'][1].snaktype == 'value' then |
| if foldedPosition.isnew then
| | addData(ibargs, wikidata.printSnak(eachClaim.qualifiers['P1365'][1])) |
| foldedPosition.isnew = false
| | elseif eachClaim.qualifiers['P1365'][1].snaktype == 'novalue' then |
| table.insert(foldedPositions, foldedPosition)
| | addData(ibargs, 'nimeni') |
| end
| | else |
| end
| | addData(ibargs, '?') |
|
| |
| for foldedPsnIdx,foldedPsn in ipairs(foldedPositions) do
| |
| table.sort(foldedPsn.posns, function(a, b) return DateUtils.compare(a.startTime, b.startTime) < 0 end)
| |
| local mergedPsns = { foldedPsn.posns[1] }
| |
| for psnIdx = 2,#foldedPsn.posns do
| |
| local mergedPsnIdx = 1
| |
| local merged = false
| |
| while mergedPsnIdx <= #mergedPsns do
| |
| local eachMergedPsn = mergedPsns[mergedPsnIdx]
| |
| if eachMergedPsn.circumscription == foldedPsn.posns[psnIdx].circumscription and
| |
| DateUtils.compare(DateUtils.addDaysToDate(eachMergedPsn.endTime, 7), foldedPsn.posns[psnIdx].startTime) > -1 then
| |
| eachMergedPsn.endTime = foldedPsn.posns[psnIdx].endTime
| |
| for hash,cargs in pairs(foldedPsn.posns[psnIdx].refs) do
| |
| eachMergedPsn[hash] = eachMergedPsn[hash] or cargs
| |
| end
| |
| Set.union(eachMergedPsn.refs, foldedPsn.posns[psnIdx].refs)
| |
| eachMergedPsn.orders = Set.valueUnion(eachMergedPsn.orders, foldedPsn.posns[psnIdx].orders)
| |
| eachMergedPsn.parlGroups = Set.valueUnion(eachMergedPsn.parlGroups, foldedPsn.posns[psnIdx].parlGroups)
| |
| eachMergedPsn.elections = Set.valueUnion(eachMergedPsn.elections, foldedPsn.posns[psnIdx].elections)
| |
| eachMergedPsn.legislatures = Set.valueUnion(eachMergedPsn.legislatures, foldedPsn.posns[psnIdx].legislatures)
| |
| eachMergedPsn.successors = foldedPsn.posns[psnIdx].successors
| |
| eachMergedPsn.headsofstate = Set.valueUnion(eachMergedPsn.headsofstate, foldedPsn.posns[psnIdx].headsofstate)
| |
| eachMergedPsn.cabinets = Set.valueUnion(eachMergedPsn.cabinets, foldedPsn.posns[psnIdx].cabinets)
| |
| merged = true
| |
| break
| |
| end | | end |
| mergedPsnIdx = mergedPsnIdx + 1
| |
| end | | end |
| if not merged then | | if eachClaim.qualifiers['P1366'] and eachClaim.qualifiers['P1366'][1] then |
| table.insert(mergedPsns, foldedPsn.posns[psnIdx]) | | addLabel(ibargs, 'Succesor') |
| | if eachClaim.qualifiers['P1366'][1].snaktype == 'value' then |
| | addData(ibargs, wikidata.printSnak(eachClaim.qualifiers['P1366'][1])) |
| | elseif eachClaim.qualifiers['P1366'][1].snaktype == 'novalue' then |
| | addData(ibargs, 'nimeni') |
| | else |
| | addData(ibargs, '?') |
| | end |
| end | | end |
| end
| |
| table.sort(mergedPsns, function(a, b) return DateUtils.compare(a.startTime, b.startTime) > 0 end)
| |
| foldedPsn.posns = mergedPsns
| |
| end
| |
| functii = {}
| |
| for _,eachFoldedPosn in ipairs(foldedPositions) do
| |
| local firstPosn = {}
| |
| firstPosn.denumire = eachFoldedPosn.denumire
| |
| if eachFoldedPosn.posns[1].orders and #eachFoldedPosn.posns[1].orders > 0 then
| |
| eachFoldedPosn.posns[1].orders.conjunction = ' și '
| |
| eachFoldedPosn.posns[1].orders.separator = ', '
| |
| firstPosn.denumire = StringUtils._capitalize(join(eachFoldedPosn.posns[1].orders)) .. ' ' .. firstPosn.denumire
| |
| end
| |
| local crtPosn = firstPosn
| |
| for _,eachPosn in ipairs(eachFoldedPosn.posns) do
| |
| crtPosn.startTime = DateUtils.formatDate(eachPosn.startTime)
| |
| crtPosn.startTimeRaw = eachPosn.startTime
| |
| crtPosn.endTime = DateUtils.formatDate(eachPosn.endTime)
| |
| crtPosn.endTimeRaw = eachPosn.endTime
| |
|
| |
| crtPosn.legislature = makeListCollapsibleIfTwoLarge(eachPosn.legislatures, 'legislaturi', 3)
| |
| crtPosn.pred = SeparatedEntries.br(eachPosn.predecessors)
| |
| crtPosn.succ = SeparatedEntries.br(eachPosn.successors)
| |
| crtPosn.headofstate = makeListCollapsibleIfTwoLarge(eachPosn.headsofstate, 'șefi de stat', 3)
| |
| crtPosn.circumscription = eachPosn.circumscription
| |
| crtPosn.cabinet = makeListCollapsibleIfTwoLarge(eachPosn.cabinets, 'cabinete', 3)
| |
| crtPosn.parlGroup = makeListCollapsibleIfTwoLarge(eachPosn.parlGroups, 'grupuri parlamentare', 3)
| |
| crtPosn.election = makeListCollapsibleIfTwoLarge(eachPosn.elections, 'scrutinuri', 3)
| |
| crtPosn.refs = wikidata.printFirstReferences(eachPosn.refs, 4)
| |
|
| |
| table.insert(functii, crtPosn)
| |
| crtPosn = {}
| |
| end | | end |
| end | | end |
| end | | end |
| end | | else |
|
| | if not numberedargs[1].succesiune then |
|
| | addHeader(ibargs, 'Domnie') |
| local childMode = (processedArgs['embed'] == 'yes' or processedArgs['embed'] == 'da')
| |
| local mainMode = not childMode
| |
| local computedArgs = { }
| |
| computedArgs.q = q
| |
| computedArgs.aboveclass = origArgs['aboveclass'] or 'biografii'
| |
| computedArgs['culoare cadru'] = origArgs['culoare cadru'] or 'E6E6FA'
| |
| computedArgs['culoare text'] = origArgs['culoare text'] or '000'
| |
| computedArgs['headerstyle'] = 'border-top-style: solid; border-color:#aaa; border-top-width: 1px; padding-top: 3px; padding-bottom: 3px'
| |
| computedArgs['subheader1'] = origArgs['subheader']
| |
|
| |
| computedArgs.embed = childMode and 'yes' or 'no'
| |
| computedArgs.doc = origArgs['doc'] or 'Infocaseta Om politic'
| |
| computedArgs.wikidata = 'y'
| |
| computedArgs['name'] = processedArgs['nume'] or processedArgs['name'] or (mainMode and (StringUtils._emptyToNil({wikidata.findLabel(q)}) or mw.title.getCurrentTitle().text))
| |
| computedArgs.default_title = 'Cariera politică'
| |
| computedArgs.parent_colspan = processedArgs['parent_colspan'] or '2'
| |
|
| |
| local imageTitle = processedArgs['imagine'] or processedArgs['image']
| |
| local imageCaption = processedArgs['caption'] or processedArgs['descriere'] or processedArgs['comentariu'] or processedArgs['Descriere']
| |
| local imageSize = processedArgs['dimensiune_imagine'] or processedArgs['imagesize'] or processedArgs['image_size'] or processedArgs['mărime']
| |
| local smallImageTitle = processedArgs['imagine_mică'] or processedArgs['smallimage']
| |
| local wdImageName, wdImageCaption
| |
| if imageTitle == nil then
| |
| wdImageTitle, wdImageCaption = wikidata.findImageAndCaption()
| |
| imageTitle = wdImageName | |
| imageCaption = wdImageCaption
| |
| end
| |
| | |
| if imageTitle and imageTitle ~= '' then computedArgs.image = infoboxImage{image=imageTitle, size = imageSize, sizedefault = frameless, suppressplaceholder='yes'}
| |
| elseif smallImageTitle then computedArgs.image = '[[Fișier:' .. smallImageTitle .. ']]' end
| |
| computedArgs.caption = imageCaption
| |
|
| |
| local crtLineIndex = 1
| |
|
| |
| if origArgs['extra_header'] then
| |
| local extraDataIdxes = TableTools.affixNums(origArgs, 'extra_data')
| |
| if #extraDataIdxes > 0 then
| |
| computedArgs['header' .. tostring(crtLineIndex)] = origArgs['extra_header'] | |
| crtLineIndex = crtLineIndex + 1
| |
| for _,eachExtraDataIdx in ipairs(extraDataIdxes) do
| |
| computedArgs['data' .. tostring(crtLineIndex)] = origArgs['extra_data' .. tostring(eachExtraDataIdx)]
| |
| computedArgs['label' .. tostring(crtLineIndex)] = origArgs['extra_label' .. tostring(eachExtraDataIdx)]
| |
| crtLineIndex = crtLineIndex + 1
| |
| end
| |
| end | | end |
| end
| | for _,eachReign in ipairs(numberedargs) do |
|
| | if eachReign.succesiune then |
| local prevPosition = nil
| | addHeader(ibargs, eachReign.succesiune) |
| for functionIdx = 1,table.maxn(functii) do
| |
| if functii[functionIdx] then
| |
| if functii[functionIdx].denumire or functii[functionIdx].ordine then | |
| if prevPosition == nil or prevPosition.denumire == nil or prevPosition.denumire ~= functii[functionIdx].denumire then | |
| computedArgs['header' .. tostring(crtLineIndex)] = (functii[functionIdx].ordine or '') .. ' ' .. (functii[functionIdx].denumire or '')
| |
| crtLineIndex = crtLineIndex + 1
| |
| end
| |
| end | | end |
| if functii[functionIdx].nom then | | if eachReign.domnie then |
| computedArgs['label' .. tostring(crtLineIndex)] = 'Candidat' | | addLabel(ibargs, 'Domnie') |
| computedArgs['data' .. tostring(crtLineIndex)] = functii[functionIdx].nom | | addData(ibargs, eachReign.domnie) |
| crtLineIndex = crtLineIndex + 1
| |
| end | | end |
| if functii[functionIdx].startTime and functii[functionIdx].endTime then | | if eachReign.domnie or eachReign.succesiune then |
| computedArgs['data' .. tostring(crtLineIndex)] = "'''În funcție'''<br/>" .. functii[functionIdx].startTime .. ' – ' .. functii[functionIdx].endTime .. (functii[functionIdx].refs or '') | | if eachReign['încoronare'] then |
| crtLineIndex = crtLineIndex + 1
| | addLabel(ibargs, eachReign['cor-type'] or 'Încoronare') |
| elseif functii[functionIdx].startTime then
| | addData(ibargs, eachReign['încoronare']) |
| local startDate = functii[functionIdx].startTimeRaw or DateUtils.parseDate(mw.ustring.gsub(mw.ustring.gsub(functii[functionIdx].startTime, "%[%[", ""), "%]%]", ""))
| | end |
| if startDate and DateUtils.compare(os.date('*t'), startDate) < 0 then | | if eachReign.predecesor then |
| computedArgs['data' .. tostring(crtLineIndex)] = 'Va prelua funcția' | | addLabel(ibargs, eachReign['pred-type'] or 'Predecesor') |
| else
| | addData(ibargs, eachReign.predecesor) |
| computedArgs['data' .. tostring(crtLineIndex)] = 'Deținător actual' | |
| end | | end |
| computedArgs['style' .. tostring(crtLineIndex)] = 'background-color: #eeeeff;' | | if eachReign.succesor then |
| crtLineIndex = crtLineIndex + 1
| | addLabel(ibargs, eachReign['suc-type'] or 'Succesor') |
| computedArgs['data' .. tostring(crtLineIndex)] = "'''Funcție asumată'''<br/>" .. functii[functionIdx].startTime .. (functii[functionIdx].refs or '')
| | addData(ibargs, eachReign.succesor) |
| crtLineIndex = crtLineIndex + 1
| | end |
| end
| | if eachReign.regent then |
| if functii[functionIdx].vp then
| | addLabel(ibargs, eachReign['reg-type'] or 'Regent') |
| computedArgs['label' .. tostring(crtLineIndex)] = 'Vicepreședinte'
| | addData(ibargs, eachReign.regent) |
| computedArgs['data' .. tostring(crtLineIndex)] = functii[functionIdx].vp
| |
| crtLineIndex = crtLineIndex + 1
| |
| end
| |
| if functii[functionIdx].vpm then
| |
| computedArgs['label' .. tostring(crtLineIndex)] = 'Viceprim-ministru'
| |
| computedArgs['data' .. tostring(crtLineIndex)] = functii[functionIdx].vpm
| |
| crtLineIndex = crtLineIndex + 1
| |
| end
| |
| if functii[functionIdx].deputy then
| |
| computedArgs['label' .. tostring(crtLineIndex)] = 'Locțiitor'
| |
| computedArgs['data' .. tostring(crtLineIndex)] = functii[functionIdx].deputy
| |
| crtLineIndex = crtLineIndex + 1
| |
| end
| |
| if functii[functionIdx].president then
| |
| computedArgs['label' .. tostring(crtLineIndex)] = 'Președinte'
| |
| computedArgs['data' .. tostring(crtLineIndex)] = functii[functionIdx].president | |
| crtLineIndex = crtLineIndex + 1
| |
| end
| |
| if functii[functionIdx].pm then
| |
| computedArgs['label' .. tostring(crtLineIndex)] = 'Prim-ministru'
| |
| computedArgs['data' .. tostring(crtLineIndex)] = functii[functionIdx].pm | |
| crtLineIndex = crtLineIndex + 1
| |
| end
| |
| if functii[functionIdx].monarch then
| |
| computedArgs['label' .. tostring(crtLineIndex)] = 'Monarh'
| |
| computedArgs['data' .. tostring(crtLineIndex)] = functii[functionIdx].monarch
| |
| crtLineIndex = crtLineIndex + 1
| |
| end
| |
| if functii[functionIdx].headofstate then
| |
| computedArgs['label' .. tostring(crtLineIndex)] = 'Șef al statului'
| |
| computedArgs['data' .. tostring(crtLineIndex)] = functii[functionIdx].headofstate
| |
| crtLineIndex = crtLineIndex + 1
| |
| end
| |
| if functii[functionIdx].cabinet then
| |
| computedArgs['label' .. tostring(crtLineIndex)] = 'Guvern'
| |
| computedArgs['data' .. tostring(crtLineIndex)] = functii[functionIdx].cabinet
| |
| crtLineIndex = crtLineIndex + 1
| |
| end
| |
| if functii[functionIdx].pred then
| |
| computedArgs['label' .. tostring(crtLineIndex)] = 'Precedat de'
| |
| computedArgs['data' .. tostring(crtLineIndex)] = functii[functionIdx].pred
| |
| crtLineIndex = crtLineIndex + 1
| |
| end
| |
| if functii[functionIdx].succ then
| |
| computedArgs['label' .. tostring(crtLineIndex)] = 'Succedat de'
| |
| computedArgs['data' .. tostring(crtLineIndex)] = functii[functionIdx].succ
| |
| crtLineIndex = crtLineIndex + 1
| |
| end
| |
| if functii[functionIdx].circumscription then
| |
| computedArgs['label' .. tostring(crtLineIndex)] = 'Circumscripția'
| |
| computedArgs['data' .. tostring(crtLineIndex)] = functii[functionIdx].circumscription
| |
| crtLineIndex = crtLineIndex + 1
| |
| end
| |
| if functii[functionIdx].legislature then
| |
| computedArgs['label' .. tostring(crtLineIndex)] = 'Legislatură'
| |
| computedArgs['data' .. tostring(crtLineIndex)] = functii[functionIdx].legislature
| |
| crtLineIndex = crtLineIndex + 1
| |
| end
| |
| if functii[functionIdx].parlGroup then
| |
| computedArgs['label' .. tostring(crtLineIndex)] = 'Grup parlamentar'
| |
| computedArgs['data' .. tostring(crtLineIndex)] = functii[functionIdx].parlGroup
| |
| crtLineIndex = crtLineIndex + 1
| |
| end
| |
| if functii[functionIdx].election then
| |
| computedArgs['label' .. tostring(crtLineIndex)] = fem and 'Aleasă în' or 'Ales în'
| |
| computedArgs['data' .. tostring(crtLineIndex)] = functii[functionIdx].election
| |
| crtLineIndex = crtLineIndex + 1
| |
| end
| |
|
| |
| prevPosition = functii[functionIdx]
| |
| end
| |
| end
| |
| if table.maxn(functii) > 0 then
| |
| computedArgs['data' .. tostring(crtLineIndex)] = tostring(mw.html.create('hr'))
| |
| crtLineIndex = crtLineIndex + 1
| |
| end
| |
|
| |
| local wikidataGender = wikidata.findOneValueNoRef('P21', q)
| |
| local gender = nil
| |
| if wikidataGender then
| |
| if mw.ustring.find(wikidataGender, 'femeie') then gender = 'f'
| |
| else gender = 'm' end
| |
| end
| |
| computedArgs['birth_date'] = processedArgs['data_nasterii'] or processedArgs['data_nașterii'] or processedArgs['birth_date']
| |
| computedArgs['birth_name'] = processedArgs['nume_la_naștere'] or processedArgs['birth_name'] or processedArgs['birthname']
| |
| computedArgs['death_date'] = processedArgs['data_decesului'] or processedArgs['death_date']
| |
| computedArgs['birth_place'] = processedArgs['locul_nasterii'] or processedArgs['locul_nașterii'] or processedArgs['birth_place']
| |
| computedArgs['death_place'] = processedArgs['locul_decesului'] or processedArgs['death_place']
| |
| | |
| local awards = processedArgs['premii'] or processedArgs['awards']
| |
| if awards == nil then
| |
| if processedArgs['ordine și medalii românești'] and processedArgs['ordine și medalii străine'] then
| |
| awards = table.concat({processedArgs['ordine și medalii românești'], processedArgs['ordine și medalii străine']}, tostring(mw.html.create('br')))
| |
| else if processedArgs['ordine și medalii românești'] then
| |
| awards = processedArgs['ordine și medalii românești']
| |
| else if processedArgs['ordine și medalii străine'] then awards = processedArgs['ordine și medalii străine'] end
| |
| end
| |
| end
| |
| end
| |
| if mainMode and awards == nil then
| |
| local wikidataAwards = wikidata.findClaimsForProperty(nil, 'P166')
| |
| if wikidataAwards and #wikidataAwards > 0 then
| |
| local awardsList = {}
| |
| for _idx,eachClaim in ipairs(wikidataAwards) do
| |
| if _idx < 10 and eachClaim.mainsnak.snaktype == 'value' then
| |
| local award = wikidata.printSnak(eachClaim.mainsnak) .. wikidata.outputReferences(eachClaim.mainsnak) | |
| local fromList = {}
| |
| if eachClaim.qualifiers then
| |
| for _,eachQualProp in ipairs({'P1027', 'P642'}) do
| |
| if eachClaim.qualifiers[eachQualProp] then
| |
| for _,eachQual in ipairs(eachClaim.qualifiers[eachQualProp]) do
| |
| table.insert(fromList, wikidata.printSnak(eachQual))
| |
| end
| |
| end
| |
| end
| |
| if #fromList > 0 then
| |
| award = award .. ' de la ' .. table.concat(fromList, ', ')
| |
| end
| |
| end
| |
| local awardTimestamp = printTimestampForClaim(eachClaim)
| |
| if awardTimestamp and mw.ustring.len(mw.text.trim(awardTimestamp)) > 2 then
| |
| award = award .. nbsp .. smallTextInBrackets(awardTimestamp)
| |
| end
| |
| table.insert(awardsList, award)
| |
| end | | end |
| end | | end |
| local lineBr = tostring(mw.html.create('br'))
| | |
| awards = table.concat(awardsList, lineBr)
| |
| if #wikidataAwards > 10 then
| |
| awards = awards .. lineBr .. wdLinker.displayMessageWithCustomText('P166', q, tostring(mw.html.create('small'):wikitext('...mai multe...'))) | |
| end
| |
| end | | end |
| end
| |
| if awards then
| |
| computedArgs['label' .. tostring(crtLineIndex)] = 'Premii'
| |
| computedArgs['data' .. tostring(crtLineIndex)] = awards
| |
| crtLineIndex = crtLineIndex + 1
| |
| end | | end |
| | | |
| local parties = processedArgs['partid'] or processedArgs['party'] | | return infoboxBio.displayInfoboxFromArgs(ibargs) |
| if parties == nil then
| |
| local wikidataParties = wikidata.findSortedClaimsForProperty(nil, 'P102')
| |
| if wikidataParties and #wikidataParties > 0 then
| |
| local partiesList = {}
| |
| for partyIdx=1,#wikidataParties do
| |
| local crtEntry = ''
| |
| if wikidataParties[partyIdx].mainsnak.snaktype == 'value' then
| |
| crtEntry = wikidata.findLinkToItemWithCallback(wikidataParties[partyIdx].mainsnak.datavalue.value['numeric-id'], true, function(entityObject)
| |
| local entityObjectQId = entityObject and StringUtils._prependIfMissing(tostring(entityObject.id), 'Q')
| |
| local returnValueCandidate = nil
| |
| if entityObject and entityObject.claims and entityObject.claims['P1813'] and #(entityObject.claims['P1813']) > 0 then
| |
| local inPartyEndDate = nil
| |
| if wikidataParties[partyIdx].qualifiers and wikidataParties[partyIdx].qualifiers['P582'] and wikidataParties[partyIdx].qualifiers['P582'][1] then
| |
| inPartyEndDate = DateUtils.extractDateFromWikidataSnak(wikidataParties[partyIdx].qualifiers['P582'][1])
| |
| end
| |
| | |
| local returnValueRank = mw.wikibase.entity.claimRanks.RANK_DEPRECATED --initial rank is lowest, so that practically anything is accepted here
| |
| local returnValueEndDate = inPartyEndDate and {year = 1, month = 1, day = 1} or os.date('*t')
| |
| for _,eachPartyShortNameClaim in ipairs(entityObject.claims['P1813']) do
| |
| if eachPartyShortNameClaim.type == 'statement' and eachPartyShortNameClaim.mainsnak.snaktype == 'value' and eachPartyShortNameClaim.mainsnak.datavalue.value.language == 'ro' then
| |
| | |
| local namingEndDate = {} -- empty date
| |
| if eachPartyShortNameClaim.qualifiers and eachPartyShortNameClaim.qualifiers['P582'] and #(eachPartyShortNameClaim.qualifiers['P582']) > 0 then
| |
| namingEndDate = DateUtils.extractDateFromWikidataSnak(eachPartyShortNameClaim.qualifiers['P582'][1])
| |
| end
| |
| if inPartyEndDate == nil then
| |
| --in this case, we don't have a time reference to get the party name, so we get the best we've got: the most recent among those with the highest rank
| |
| local candidateRank = mw.wikibase.entity.claimRanks['RANK_' .. mw.ustring.upper(eachPartyShortNameClaim.rank)]
| |
| if candidateRank > returnValueRank then
| |
| --we found a candidate with a better rank
| |
| returnValueCandidate = eachPartyShortNameClaim.mainsnak.datavalue.value.text
| |
| returnValueEndDate = namingEndDate
| |
| returnValueRank = candidateRank
| |
| elseif candidateRank == returnValueRank then
| |
| --same rank, we now care about which is more recent
| |
| if returnValueEndDate ~= nil then
| |
| if DateUtils.compare(namingEndDate, returnValueEndDate) > 0 then
| |
| --the naming end date is more recent than the end date of the candidate return value
| |
| returnValueCandidate = eachPartyShortNameClaim.mainsnak.datavalue.value.text
| |
| returnValueEndDate = namingEndDate
| |
| --else not interested: examined date is older than what we already have
| |
| end
| |
| --else not interested: we have one value without end date, which means it's current
| |
| end
| |
| --else not interested: lower rank
| |
| end
| |
| else
| |
| --in this case, we want the one with the oldest end date, but newer than the time reference
| |
| if namingEndDate and DateUtils.compare(namingEndDate, inPartyEndDate) >= 0 then
| |
| -- the naming end date is more recent than the time reference
| |
| if DateUtils.compare(namingEndDate, returnValueEndDate) < 0 then
| |
| --the naming end date is older than the current candidate return value
| |
| returnValueCandidate = eachPartyShortNameClaim.mainsnak.datavalue.value.text
| |
| returnValueEndDate = namingEndDate
| |
| --else not interested: we have a candidate that is already closer to the time reference than this one
| |
| end
| |
| --else not interested: either not dated or ended before the time reference
| |
| end
| |
| end
| |
| --else not interested: unknown or no value, or foreign language
| |
| end
| |
| end --for
| |
| if not returnValueCandidate then returnValueCandidate = wikidata.findOneValue('P1813', entityObjectQId) end
| |
| end
| |
| return returnValueCandidate
| |
| end)
| |
| elseif wikidataParties[partyIdx].mainsnak == 'novalue' then
| |
| crtEntry = "''Niciunul''"
| |
| end
| |
|
| |
| crtEntry = crtEntry .. nbsp .. smallTextInBrackets(printTimestampForClaim(wikidataParties[partyIdx]))
| |
| if crtEntry ~= '' then table.insert(partiesList, crtEntry) end
| |
| end
| |
| parties = table.concat(partiesList, tostring(mw.html.create('br')))
| |
| if #partiesList > 0 then parties = parties .. ' ' .. wdLinker.displayMessage('P102', q) end
| |
| end
| |
| end
| |
| if parties then
| |
| computedArgs['label' .. tostring(crtLineIndex)] = 'Partid politic'
| |
| computedArgs['data' .. tostring(crtLineIndex)] = parties
| |
| crtLineIndex = crtLineIndex + 1
| |
| end
| |
| local ideology = wikidata._getValueListWithSeparator({_br_, 'P1142'})
| |
| if ideology and ideology ~= '' then
| |
| computedArgs['label' .. tostring(crtLineIndex)] = 'Ideologie'
| |
| computedArgs['data' .. tostring(crtLineIndex)] = StringUtils._appendToString({
| |
| ideology,
| |
| wdLinker.displayMessage('P1142', q)
| |
| })
| |
| crtLineIndex = crtLineIndex + 1
| |
| end
| |
| computedArgs['label' .. tostring(crtLineIndex)] = 'Alte afilieri'
| |
| computedArgs['data' .. tostring(crtLineIndex)] = processedArgs['alte afilieri'] or processedArgs['otherparty']
| |
| crtLineIndex = crtLineIndex + 1
| |
| computedArgs['label' .. tostring(crtLineIndex)] = 'Grup europarlamentar'
| |
| computedArgs['data' .. tostring(crtLineIndex)] = processedArgs['grup_europarlamentar']
| |
| crtLineIndex = crtLineIndex + 1
| |
| computedArgs['label' .. tostring(crtLineIndex)] = 'Rezidență'
| |
| computedArgs['data' .. tostring(crtLineIndex)] = processedArgs['rezidenta'] or processedArgs['rezidență'] or processedArgs['residence']
| |
| crtLineIndex = crtLineIndex + 1
| |
| computedArgs['spouse'] = processedArgs['sot'] or processedArgs['soț'] or processedArgs['spouse'] or processedArgs['sotia'] or processedArgs['soție']
| |
| | |
| computedArgs['partener'] = processedArgs['partener'] or processedArgs['parteneră']
| |
| computedArgs['children'] = processedArgs['copii'] or processedArgs['children']
| |
| computedArgs['parents'] = processedArgs['părinți'] or processedArgs['parents']
| |
| computedArgs['siblings'] = processedArgs['frati'] or processedArgs['frați']
| |
| computedArgs['avere'] = processedArgs['avere'] or processedArgs['net_worth']
| |
| | |
| local alma_mater = processedArgs['alma_mater']
| |
| if mainMode and alma_mater == nil then
| |
| local wikidataAlmaMater = wikidata.findValueListWithQualifiersInBrackets(nil, 'P69', false, {'$P512', '$P812', '$P582'}, {' în ', ', '})
| |
| if wikidataAlmaMater then alma_mater = table.concat(wikidataAlmaMater, tostring(mw.html.create('br'))) end
| |
| end
| |
| if alma_mater then
| |
| computedArgs['label' .. tostring(crtLineIndex)] = '[[Alma mater]]'
| |
| computedArgs['data' .. tostring(crtLineIndex)] = alma_mater
| |
| crtLineIndex = crtLineIndex + 1
| |
| end
| |
| computedArgs['label' .. tostring(crtLineIndex)] = 'Cunoscut' .. (gender == nil and '(ă)' or gender == 'f' and 'ă' or '') .. ' pentru'
| |
| computedArgs['data' .. tostring(crtLineIndex)] = processedArgs['cunoscut_pentru']
| |
| crtLineIndex = crtLineIndex + 1
| |
| computedArgs['label' .. tostring(crtLineIndex)] = 'Societăți'
| |
| computedArgs['data' .. tostring(crtLineIndex)] = processedArgs['societăți']
| |
| crtLineIndex = crtLineIndex + 1
| |
| computedArgs['label' .. tostring(crtLineIndex)] = 'Organizații'
| |
| computedArgs['data' .. tostring(crtLineIndex)] = processedArgs['organizații']
| |
| crtLineIndex = crtLineIndex + 1
| |
| computedArgs['occupation'] = processedArgs['ocupatia'] or processedArgs['ocupație'] or processedArgs['occupation']
| |
| computedArgs['label' .. tostring(crtLineIndex)] = 'Profesie'
| |
| computedArgs['data' .. tostring(crtLineIndex)] = processedArgs['profesia'] or processedArgs['profesie'] or processedArgs['profession']
| |
| crtLineIndex = crtLineIndex + 1
| |
| computedArgs['nationality'] = processedArgs['nationalitatea'] or processedArgs['naționalitate'] or processedArgs['nationality']
| |
| computedArgs['ethnicity'] = processedArgs['etnie'] or processedArgs['ethnicity']
| |
| computedArgs['citizenship'] = processedArgs['cetatenie'] or processedArgs['cetățenie'] or processedArgs['citizenship']
| |
| computedArgs['religion'] = processedArgs['religie'] or processedArgs['religia'] or processedArgs['confesiune'] or processedArgs['religion']
| |
| computedArgs['signature'] = processedArgs['semnătură'] or processedArgs['semnatura'] or processedArgs['signature']
| |
| crtLineIndex = crtLineIndex + 1
| |
| computedArgs['data' .. tostring(crtLineIndex)] = processedArgs['note'] or processedArgs['footnotes']
| |
| crtLineIndex = crtLineIndex + 1
| |
| for embeddedIdx = 1, table.maxn(embedded) do
| |
| if embedded[embeddedIdx] then
| |
| computedArgs['data' .. tostring(crtLineIndex)] = embedded[embeddedIdx]
| |
| crtLineIndex = crtLineIndex + 1
| |
| end
| |
| end
| |
| return computedArgs
| |
| end | | end |
|
| |
|
| p.show = function(frame)
| | local function fromFrame(frame) |
| local infoboxArguments = computeArguments(getArgs(frame)) | | local args = getArgs(frame) |
| return infobox.displayInfoboxFromArgs(infoboxArguments) | | return fromArray(args) |
| end | | end |
|
| |
|
| p.fromArray = computeArguments | | p.fromFrame = fromFrame |
| | | p.fromArray = fromArray |
| return p | | return p |