ናብ ትሕዝቶ ኪድ

ሞድዩል:ሓበሬታ ሰብ

ካብ ዊኪፐድያ፣ ናጻ ኢንሳይክሎፐድያ

Documentation for this module may be created at ሞድዩል:ሓበሬታ ሰብ/doc

local z = {}

local arguments    -- Table of arguments with which the function is called 
local argument={}  -- Arguments, not counting those with no data
local Entity       -- Table with the data in Wikidata of the person.
local somePropertyLinkWikidata -- For some property there is neither the label nor the link showing something of the form d:...

local getDataWikidata -- true if data should be obtained from Wikidata

-- External modules and functions
local ModuleTime            = require('Module:Time')
local   age                 = ModuleTime.age
local ModuleInfobox         = require('Module:Infobox')
local ModuleTextFormat      = require('Module:Text format')
local   inMultipleLines     = ModuleTextFormat.inMultipleLines
local   inBrackets          = ModuleTextFormat.inBrackets
local ModuleIdentifiers     = require('Module:Identifiers')
local ModulePage            = require('Module:Page')
local ModuleWikidataFormats = require('Module:Wikidata/Formats')
local   URLFormat           = ModuleWikidataFormats.URLFormat
local   periodFormat        = ModuleWikidataFormats.periodFormat
local   idFormat            = ModuleWikidataFormats.idFormat
local ModuleWikidata        = require('Module:Wikidata')
local   wikidataPencil      = ModuleWikidata.addLinkback
local   categorizeWikidata  = ModuleWikidata.categorize
local getPropertyWikidata = ModuleWikidata.getProperty
local tableElement          = require('Module:Tables').element
local toLinkURL             = require('Module:URL').toLink
local withoutFlag           = require('Module:Flag').withoutFlag

-- Constants
local inUppercase    = {['textFormat'] = 'uppercase', ['linkback']='yes', ['highestRank'] = 'yes'}
local inUppercaseO   = {['textFormat'] = 'uppercase', ['conjunction']=' ወይ ', ['linkback']='yes', ['highestRank'] = 'yes'}
local notOrderedList = {['list'] = 'not ordered', ['linkback']='yes', ['highestRank'] = 'yes'} --, ['mustExist'] = 'yes'
--local place           = {['conjunction']=' ወይ ', ['value-module'] = 'Wikidata/Place format', ['value-function'] = 'placeFormat', ['linkback']='yes'}
local mustExist     = {['mustExist'] = 'yes', ['textFormat'] = 'uppercase', ['linkback']='yes', ['highestRank'] = 'yes'}
local withPeriod      = {['list'] = 'not ordered', ['textFormat'] = 'uppercase', ['qualifying'] = periodFormat, toOrder='ብዕለት', ['linkback']='yes', ['highestRank'] = 'yes'}
local withPeriodMustExist = {['list'] = 'not ordered', ['textFormat'] = 'uppercase', ['qualifying'] = periodFormat, toOrder='ብዕለት', ['mustExist'] = 'yes', ['linkback']='yes', ['highestRank'] = 'yes'}
local withoutLinkup = {['link']='no', ['linkback']='yes', ['highestRank'] = 'yes'}
local withoutPencil   = {['highestRank'] = 'yes'}
local normal     = {['linkback']='yes', ['highestRank'] = 'yes'}

-- Formats according to the type of header

local formats={
    ['ብንቡር'] = {['infoboxTitleStyle'] = 'background-color:#8DB1C3;color:#FFF'}, 
    ['inherit']     = {['infoboxTitleStyle'] = 'background-color:#E6E6FA;color:#000'},    
    --['ተዋሳኢ']       = {['infoboxTitleStyle'] = ''},
    ['ተጻዋታይ ቸስ'] = {['infoboxTitleStyle'] = 'background-color:#d38d47;color:#FFF'},
    ['ስነ ጥበበኛ']     = {['infoboxTitleStyle'] = 'background-color:#8DB1C3;color:#FFF'},
    ['ጠፈርተኛ']  = {['infoboxTitleStyle'] = 'background-color:transparent;'},
    ['መዚ']   = {['infoboxTitleStyle'] = 'background-color:transparent;', ['sectionsTitleStyle'] ='background-color:#E6E6FA;'},
    ['ሲነማ']        = {['infoboxTitleStyle'] = 'background-color:#f9e999'}, 
    ['ነዳፊ']   = {['infoboxTitleStyle'] = 'background-color:#ED8;color:#000'},
    ['ጸሓፊ']    = {['infoboxTitleStyle'] = 'background-color:#4c6099;color:#FFF'},
    ['ተጻዋታይ ኩዕሶ እግሪ']  = {['infoboxTitleStyle'] = 'background-color:#CC8;color:#000'},
    ['ወተሃደራዊ']     = {['infoboxTitleStyle'] = 'background-color:#b0c4de;color:#000'},
    ['ሞደል']      = {['infoboxTitleStyle'] = 'background-color:#9F9;color:#000'},
    --
    -- Music
    --
    ['ደራፊ']    = {['infoboxTitleStyle'] = 'background-color:#f0e68c'}, -- Soloist of Template:Music artist sheet/Color selection
    ['ሙዚቀኛ']      = {['infoboxTitleStyle'] = 'background-color:#F4BF92'}, -- non-vocal_instrumentalist (members of non-vocal groups, as well as instrumental soloists and conductors)
    ['ካልእ ሙዚቃ'] = {['infoboxTitleStyle'] = 'background-color:#BFE0BF'}, -- other_staff (producers, composers, engineers)
    --
    ['ሃይማኖታዊ']   = {['infoboxTitleStyle'] = 'background-color:#ffde00; color:#000'},
    ['ጋዜጠኛ']  = {['infoboxTitleStyle'] = 'background-color:#ED8;color:#000'},
    ['ተለቪዥን']  = {['infoboxTitleStyle'] = 'background-color:#ED8;color:#000'},
    ['ተዋጋኢ ብዕራይ']      = {['infoboxTitleStyle'] = 'background-color: #800000; color: white'},
    ['ጸወታ ቪድዮ']  = {['infoboxTitleStyle'] = 'background-color:#CCF;color:#000'},
    ['ዩትዩበር']    = {['infoboxTitleStyle'] = 'background-color:#B60000;color:#fff'},
}

local name = ''

function isodate(x)
 return x.time
end

function z.Infobox(frame)
    ModuleWikidata:setFrame(frame)  --It doesn't work if you put ModuleWikidata.setFrame(frame)    
    -- Get a copy of the arguments by removing the arguments with no value
    -- and leaving those with the value "no" blank (but not nil)
    argument = getArgumentsWithValue(frame) -- Do not put local. It's global.

    --Determine whether to get data from Wikidata

    if argument['wikidata'] == 'no' and (argument['ዕለተ ሞት'] or argument['ቦታ ሞት']
        or argument['ዝጠፍኣሉ ዕለት'] or argument['ዝጠፍኣሉ ቦታ']
        ) then
        getDataWikidata = false
        Entity = nil
    else
        getDataWikidata = true
        -- Get the data of the page where the Wikidata infobox is inserted.
        Entity   = mw.wikibase.getEntityObject(argument['id']) or {}
    end

    --Determine data for the infobox
    local education = argument['ትምህርቲ'] or property('P512',withoutLinkup)
    local almamater = argument['ኣደ ቤት ትምህርቲ'] or argument['ኣደ_ቤት_ትምህርቲ'] or argument['ኣደቤትትምህርቲ'] or argument['ኣልማ ማተር'] or argument['ኣልማ_ማተር'] or argument['ኣልማማተር'] or argument['alma mater'] or argument['alma_mater'] or argument['almamater']
            or property('P69', { ['textFormat'] = 'uppercase', ['list'] = 'not ordered', ['value-function']='ዝተማህረ ኣብ', ['value-module'] = 'Wikidata/Education formats', ['toOrder'] = 'ብዕለት', ['linkback']='yes'})

	local gender = property('P21', {['link']='no', ['linkback']='no'})
    if gender == 'ጓል ኣንስተይቲ' or gender == 'ስግረ ጾተኛ ሰበይቲ' then
        labelActiveYears = 'ዓመታት ንጥፍቲ'
        labelKnownBy = 'ፍልጥቲ ብ'
        labelInfluences = 'ዝተጸልወት ብ'
        labelchampion     = '[[ሻምፕዮንነት ዓለም ቸስ|ሻምፕዮን ዓለም]]'
        labelStudentOf    = 'ተማሃሪት ናይ'
        labelEducatedIn   = 'ዝተማህረት ኣብ'
        functionOccupation    = formatOccupationFemale
        labelReveredIn  = 'ዝኽበረት ኣብ'
    else
        labelActiveYears = 'ዓመታት ንጡፍ'
        labelKnownBy = 'ፍሉጥ ብ'
        labelInfluences = 'ዝተጸልወ ብ'
        labelchampion     = '[[ሻምፕዮንነት ዓለም ቸስ|ሻምፕዮን ዓለም]]'
        labelStudentOf    = 'ተማሃራይ ናይ'
        labelEducatedIn   = 'ዝተማህረ ኣብ'
        functionOccupation    = formatOccupationMale
        labelReveredIn  = 'ዝኽበር ኣብ'
    end
    --In principle it is not shown for actors.
    --artisticsection='ስነ ጥበባዊ ሞያ'

    -- Generate the offices
    local thereAreOffices
    local officesTable = {type='section'}

    if argument['ስልጣን'] then
        thereAreOffices = true

        table.insert(officesTable, {'', '<hr>'})
        table.insert(officesTable, generateoffice(argument,1,frame))

        argument['ቅድሚኡዝነበረ']= nil
        argument['ቅድሚኣዝነበረት']= nil
        argument['ተካኢ']= nil
        argument['ተካኢት']= nil
    end
    for i=2, 10 do
        if argument['ስልጣን'..i] or argument['ምጅማር'..i] then
            thereAreOffices = true
            table.insert(officesTable, generateoffice(argument,i,frame))
        end
    end

     -- Occupancy and area are only obtained from Wikidata if the occupancy and area fields are not reported.
     -- This is because for artists you can have in Wikidata as occupation "painter and sculptor" and
     -- have the area reported as "painting and sculpture".

    local occupation = argument['ስራሕ'] or argument['ሞያ']
    local area      = argument['ቦታ'] or argument['ፍሉይ ሞያ'] or argument['ፍሉይነት'] or argument['ዓውድታት']

    if not occupation and not area then
        occupation = property('P106', {['textFormat'] = 'uppercase', ['value-function']=functionOccupation, ['qualifying'] = periodFormat, ['linkback']='yes'})
        area      = property('P101', inUppercase) -- Work field
    end

    local occupationOrArea = occupation or area

    name = argument['ስም'] or argument['ሽም'] or ModulePage.pageName({disambiguate='yes'})
    local full_name   = argument['ምሉእ ስም']
    local birth_name = argument['ስም ልደት'] or property('P1477')
    local birth_name_without_pencil = argument['ስም ልደት'] or property('P1477', withoutPencil)

     -- Name in native script.
     -- Only displayed if it does not match the name or birth name or full name
    local nativeNames={type='section'}
    local nativeName, nativeNameText, nativeNameLanguage

    if argument['መበቆላዊ ስም'] then
        if argument['መበቆላዊ ስም'] ~= name and 
           argument['መበቆላዊ ስም'] ~= birth_name_without_pencil and
           argument['መበቆላዊ ስም'] ~= full_name then
           table.insert(nativeNames,{'መበቆላዊ ስም', argument['መበቆላዊ ስም']})
        end
    elseif Entity then
        -- In the case of obtaining from Wikidata there may be several native names

        local statement = tableElement(Entity, 'claims','P1559')

        if statement then
            for k,v in pairs(statement) do
                nativeName = tableElement(v, 'mainsnak', 'datavalue', 'value')
                if nativeName then
                    nativeNameText  = nativeName.text
                    nativeNameLanguage = nativeName.language
                    if nativeNameText and nativeNameLanguage and 
                       nativeNameText ~= name and 
                       nativeNameText ~= birth_name_without_pencil and
                       nativeNameText ~= full_name then
                           table.insert(nativeNames, {
                               'ስም ብ' .. mw.language.fetchLanguageName(nativeNameLanguage, 'ti') , 
                               wikidataPencil(nativeNameText,Entity.id,'P1559')
                           })
                    end
                end
            end
        end

    end

     -- Inform the data of birth, disappearance and death
     -- The order must not be altered so that in the event that the place of death or the place of disappearance is the same
     -- as the place of birth, the place of birth is linked
    local birth, disappearance, death
    local birthDateTimestamp = tableElement(Entity, 'claims', 'P569', 1, 'mainsnak', 'datavalue', 'value', 'time')
    local birthPlace    = argument['ቦታ ልደት'] or property('P19', {['conjunction']=' ወይ ', ['value-module'] = 'Wikidata/Place format', ['value-function'] = 'placeFormat', ['linkback']='yes', date=birthDateTimestamp, ['highestRank'] = 'yes'})

    local disappearancePlace  = argument['ዝጠፍኣሉ ቦታ']
    local deathDateTimestamp = tableElement(Entity, 'claims', 'P570', 1, 'mainsnak', 'datavalue', 'value', 'time')
    local deathPlace = argument['ቦታ ሞት'] or property('P20', {['conjunction']=' ወይ ', ['value-module'] = 'Wikidata/Place format', ['value-function'] = 'placeFormat', ['linkback']='yes', date = deathDateTimestamp, ['highestRank'] = 'yes'})

    death = inMultipleLines({
        argument['ዕለት ሞት'] or (getDataWikidata and inBrackets(property('P570', inUppercaseO), getAgeWikidata('P570'))), 
        deathPlace
    })

    if death then
        disappearance = inMultipleLines({
            argument['ዝጠፍኣሉ ዕለት'] or property('P746', inUppercaseO), 
            disappearancePlace
        })
    else
        disappearance = inMultipleLines({
            argument['ዝጠፍኣሉ ዕለት'] or (getDataWikidata and inBrackets(property('P746', inUppercaseO), getAgeWikidata('P746'))), 
            argument['ዝጠፍኣሉ ቦታ']
        })
    end

    if death or disappearance then
        birth = inMultipleLines({
            argument['ዕለት ልደት'] or property('P569', inUppercaseO), 
            birthPlace
        })
    else
        birth = inMultipleLines({
            argument['ዕለት ልደት'] or (getDataWikidata and inBrackets(property('P569', inUppercaseO), getAgeWikidata())), 
            birthPlace
        })
    end

    if argument['ወለዲ'] then
        parents = isLinked(argument['ወለዲ'])
    else
        father = property('P22')
        mother = property('P25')

        if father and mother then
            parents = father .. '<br/>' .. mother
            father  = nil
            mother  = nil
        end
    end

    signature = argument['ፊርማ'] or argument['ክታም'] or property('P109', {['link'] = 'no', ['linkback'] = false, ['highestRank'] = 'yes', ['one'] = 'yes'}) or ''
    if signature and signature ~= '' then
    	signature = '[[ፋይል:' .. signature .. '|175x80px]]'
    end

    -- Format of the title of the file and of the sections according to the occupation, if the person has offices or if he has died

    local Format, header

    if argument['ርእሰዋይ'] then
        header = argument['ርእሰዋይ']  -- By default use the header field of the template
    elseif thereAreOffices == true then
        header = 'መዚ'
    elseif not occupationOrArea then
        header = 'ብንቡር'
    elseif occupationOrArea:find('ተዋሳኢ') or occupationOrArea:find('ተዋሳኢት') or occupationOrArea:find('ኣፍራዪ ፊልም')
        or occupationOrArea:find('ዳይረክተር ፊልም') then
        header = 'ሲነማ'
    elseif occupationOrArea:find('ተጻዋታይ ቸስ') or argument['ኤሎ'] or chessranking then
        header = 'ተጻዋታይ ቸስ'
    elseif occupationOrArea:find('ጠፈርተኛ') then
        header = 'ጠፈርተኛ'
    elseif occupationOrArea:find('ጸሓፊ') or occupationOrArea:find('ጸሓፊ ልብ ወለድ') or 
           occupationOrArea:find('ገጣሚ') or occupationOrArea:find('ጸሓፊ ድራማ') then
        header = 'ጸሓፊ'
    elseif occupationOrArea:find('ደራፊ') then
        header = 'ደራፊ'
    elseif occupationOrArea:find('ሙዚቀኛ') then
        header = 'ሙዚቀኛ'
    elseif occupationOrArea:find('ኣወሃሃዲ ሙዚቃ') then
        header = 'ካልእ ሙዚቃ'
    elseif occupationOrArea:find('ፖለቲከኛ') or argument['ስልጣን'] then
        header = 'ብንቡር'
    elseif occupationOrArea:find('ጋዜጠኛ') then
        header = 'ጋዜጠኛ'
    elseif occupationOrArea:find('ነዳፊ') then
        header = 'ነዳፊ'
    elseif occupationOrArea:find('ኣቕራቢ') or occupationOrArea:find('ኣዳላዊ') then
        header = 'ተለቪዥን'
    elseif occupationOrArea:find('ሞደል') then
        header = 'ሞደል'
    elseif occupationOrArea:find('ወተሃደራዊ') then
        header = 'ወተሃደራዊ'
    elseif occupationOrArea:find('ጳጳስ') or occupationOrArea:find('ኣቡን') or
           occupationOrArea:find('ካርዲናል') or occupationOrArea:find('ፓትርያርክ') then
        header = 'ሃይማኖታዊ'
    elseif occupationOrArea:find('ተዋጋኢ ብዕራይ') then
        header = 'ተዋጋኢ ብዕራይ'
    elseif occupationOrArea:find('ጸወታ ቪድዮ') then
        header = 'ጸወታ ቪድዮ'
    elseif occupationOrArea:find('ዩትዩበር') then
        header = 'ዩትዩበር'
    else
        header = 'ብንቡር'
    end

    local DiaconalOrder
    if argument['ድያቆናት ብ'] then
        DiaconalOrder = argument['ድያቆናት'] .. '<small> ብ' ..argument['ድያቆናት ብ'].. '</small>'
    else
        DiaconalOrder = argument['ድያቆናት']
    end

    local PriestlyOrder -- ?item P793 Q41463697 Q585
    if argument['ክህነት ብ'] then
        PriestlyOrder = argument['ክህነት'] .. '<small> ብ' ..argument['ክህነት ብ'].. '</small>'
    else
        PriestlyOrder = argument['ክህነት']
    end

    local EpiscopalOrder -- ?item P793 Q125375 Q585
    if argument['ኤጲስቆጶስ ብ'] then -- ?item P793 Q125375 Q1598
        EpiscopalOrder = argument['ኤጲስቆጶስ'] .. '<small> ብ' ..argument['ኤጲስቆጶስ ብ'].. '</small>'
    else
        EpiscopalOrder = argument['ኤጲስቆጶስ']
    end

    local Cardinalate -- ?item P793 Q41154026 Q585
    if argument['መዓርግ ካርዲናል ብ'] then -- ?item P793 Q41154026 Q748
        Cardinalate = argument['መዓርግ ካርዲናል'] .. '<small> ብ' ..argument['መዓርግ ካርዲናል ብ'].. '</small>'
    else
        Cardinalate = argument['መዓርግ ካርዲናል']
    end

    local CoatOfArmsTitle, CoatOfArms
    if argument['ኣርማ'] ~= '' and (header == 'ሃይማኖታዊ' and argument['ኣርማ'] or property('P94')) then -- should we use P237 instead?
        CoatOfArms = argument['ኣርማ'] or property('P94', {})
        CoatOfArmsTitle = 'ኣርማ'
    else
        CoatOfArmsTitle = ''
    end
    local CoatOfArmsMotto = argument['ጭርሖ'] or property('P1451')
    if CoatOfArmsMotto and argument['ዝተተርጎመ ጭርሖ'] then
        CoatOfArmsMotto = CoatOfArmsMotto .. '<small style="display: block;"> ብ' ..argument['ዝተተርጎመ ጭርሖ'].. '</small>'
    end

    Format = formats[header] or {}

    local infoboxTitleStyle, sectionsTitleStyle

    infoboxTitleStyle  = Format['infoboxTitleStyle']
    sectionsTitleStyle = Format['sectionsTitleStyle'] or Format['infoboxTitleStyle']

    if thereAreOffices == true then
        officesoccupied        = ''
    else
        officesoccupied = argument['ዝተታሕዘ ስልጣን'] or property('P39', {['list'] = 'not ordered', ['textFormat'] = 'uppercase', 
            toOrder='ብዕለት', 
            ['linkback']='yes',
            ['value-function'] = ModuleWikidataFormats.officeFormat
        })
    end

	if argument['ደረጃ'] or argument['ኣርከን'] then
    	chessranking= (argument['ደረጃ'] or argument['ኣርከን']) .. frame:preprocess('<ref> [http://ratings.fide.com/toplist.phtml ደረጃ ኤፍ.ኣይ.ዲ.ኢ.] </ref>')
	end
	
	local webSite
	if argument['መርበብ'] or argument['ገጽ መርበብ'] or argument['ዌብሳይት'] or argument['መርበብ ሓበሬታ'] or argument['መርበብሓበሬታ'] then
		webSite = noExtend(toLinkURL(argument['መርበብ'] or argument['ገጽ መርበብ'] or argument['ዌብሳይት'] or argument['መርበብ ሓበሬታ'] or argument['መርበብሓበሬታ']))
	else
		webSite = property('P856', {['value-function'] = URLFormat, ['linkback']='yes', ['highestRank'] = 'yes'})
	end
	
	local victims = argument['ግዳያት']
	if victims then
		local ValidOccupationsVictims = {'Q484188', 'Q14886050', 'Q26267537', 'Q1154323'} -- serial killer, terrorist, serial rapist and hit-and-run killer
		for k,v in pairs(ValidOccupationsVictims) do
			local snak = property('P106', {['value-function'] = idFormat})
			if snak and snak:match(v) then
				victims = argument['ግዳያት']
				break
			else
				victims = ''
			end
		end
	end
	
    -- Image and image footer
    local image = argument['ምስሊ']  or argument['ስእሊ'] or argument['ፎቶ']
    local imageFooter

    if image then
        imageFooter = argument['እግረዋይ ምስሊ'] or argument['እግረዋይምስሊ'] or
                      argument['መግለጺ'] or
                      argument['እግረዋይ ፎቶ'] or argument['እግረዋይፎቶ'] or
                      argument['ጽሑፍምስሊ'] or argument['ጽሑፍ_ምስሊ'] or
                      argument['እግረዋይ ፎቶ']
    else
        image, imageFooter = getImageWikidata()
        -- Pending obtaining the footer of the qualifier P2096
    end

	local related = argument['ተዛመድቲ'] or ''
	if related and mw.ustring.len(related) > 200 then
		related = ''
	end
    local Infobox = {
        wikidata        = not getDataWikidata and 'no',
        class           = 'biography vcard',

        -- Title
        headertype   = 'ሰብ',
        title        = name,
        --backgroundcolor = backgroundcolor, -- Not used
        titlestyle   = infoboxTitleStyle,
        --Image
        --At the moment there is no line as in the writer's file after the image
        image        = image,
        ['imagesize']= argument['መጠን ምስሊ'] or argument['መጠን'] or 
                          argument['መጠን ምስሊ'] or argument['መጠንምስሊ'] or
                          argument['መጠን ፎቶ'] or 
                          '220px', -- or '200px' in the writer infobox, 192 in the artist infobox. I take default 220, the size of thumb
        footer             = imageFooter,
        -- Pending: in the writer tab the text is placed between <small> and in the artist tab the font-size:smaller style is used
        --Labels and data
        labelstyle  = 'width:33%', -- 25% in the writer's infobox. Unspecified in the person
                          --'padding:0.2em 1.0em 0.2em 0.2em; background-color:transparent; line-height:1.2em;', -- In the original person infobox
        datastyle     = 'line-height:1.3em; vertical-align:middle;',
        officesTable,
        {type='section',
            ['title']   = 'ውልቃዊ ሓበሬታ',   -- See the noble infobox or the designer infobox
            titlestyle = sectionsTitleStyle,
            {'ምሉእ ስም',                                      -- only if it does not match with:
                (full_name ~= name) and                      --    - the name displayed in the infobox title
                (full_name ~= birth_name_without_pencil) and --    - or with birth name
                full_name},
            {'ስም ልደት', -- only if it does not match the name displayed in the infobox title
                (birth_name_without_pencil ~= name) 
                and birth_name},
            nativeNames,
            {'ሃይማኖታዊ ስም', argument['ሃይማኖታዊ ስም'] or property('P1635')},
            {'ሳጓ',              argument['ሳጓ'] or property('P1449')},
            {'ካልእ&nbsp;ኣስማት', argument['ካልእ ኣስማት'] or argument['ካልእ ስም'], 
                                   class='nickname'},
            {'ልደት',         birth},
            {'ምጥፋእ',       disappearance},
            {'ሞት',      death},
            {'ጠንቂ ሞት', ifItsNot(argument['ጠንቂ ሞት'] or
                                   property('P509', inUppercase) or 
                                   property('P1196', inUppercase), 'ተፈጥሮኣዊ ጠንቅታት')}, -- circumstances of death
            {'ቀብሪ',  argument['መዕረፊ ቦታ'] or property('P119', {['value-module'] = 'Wikidata/Place format', ['textFormat'] = 'uppercase', ['linkback'] = 'yes'}) },

            {'መንበሪ ገዛ',     withoutFlag(argument['መንበሪ ገዛ'] or 
                               argument['መንበሪ_ሃገር'] or
                               argument['መንበሪ_ቦታ']) or
                               property('P551', {['mustExist'] = 'yes', ['linkback']='yes', ['highestRank'] = 'yes'}),
                               class='label'},
            {'ዜግነት',   withoutFlag(argument['ዜግነት']) or --The demonym is missing
                               require('Module:Wikidata/Country formats').nationalityFormat(tableElement(Entity,'claims','P27'),{ 
                                   ['textFormat'] = 'uppercase',
                                   ['property'] = 'P27', 
                                   ['linkback']='yes', ['entityId']=tableElement(Entity,id)}), 
                               class='category'},
            {'ዓሌት',          --property('P172', inUppercase) or 
                               argument['ዓሌት'] or argument['ዓሌታዊ ጉጅለ'],
                               class='category'},
            {'ሃይማኖት',       argument['ሃይማኖት'] or property('P140', mustExist)},
            {'ቋንቋ ኣደ',  argument['ቋንቋ ኣደ'] or argument['ቋንቋ_ኣደ'] or property('P103', inUppercase)},
        },
        {type='section',
            titlestyle = sectionsTitleStyle,
            ['title']   = 'ኣካላዊ ባህርያት',
            {'ቁመት',             argument['ቁመት'] or property('P2048', {['value-function']='magnitude', ['value-module'] = 'Wikidata/Magnitude format', ['linkback']='yes'})},
            {'ክብደት',               argument['ክብደት'] or property('P2067', {['value-function']='magnitude', ['value-module'] = 'Wikidata/Magnitude format', ['linkback']='yes'})},
            {'ዓቐናት', argument['ዓቐናት']},
            {'ዓይኒ', argument['ሕብሪ ዓይኒ'] or property('P1340', inUppercase)},
            {'ጸጉሪ', argument['ሕብሪ ጸጉሪ'] or property('P1884', inUppercase)},
            {'[[ምዕባይ ጡብ|ተፈጥሮኣዊ ጡብ]]', argument['ተፈጥሮኣዊ ጡብ']},
            --{'[[ጾታዊ ዝንባለ]]', property('P91', inUppercase) or argument['ጾታዊ ዝንባለ']}
          },
        {type='section',
            -- Family. 
            titlestyle  = sectionsTitleStyle,
            ['title']    = 'ስድራ', -- See the noble infobox

        -- In the case of the spouse, the argument takes precedence until the qualifiers are shown.
            class       ='plainlist', -- Show lists without bullets
            {'ስድራ', property('P53', mustExist)},
            {(parents and 'ወለዲ') or (father and 'ኣቦ') or 'ኣዶ', -- Show parents, father or mother as reported both or only one of them
                parents or father or mother},
            {'በዓል ቤት',    isLinked(argument['በዓል ቤት'] or
                           property('P26', withPeriod))},
            {'በዓልቲ ቤት',    isLinked(argument['በዓልቲ ቤት'] or
                           property('P26', withPeriod))},               
            {'ጽምዲ',     isLinked(argument['ጽምዲ'] or property('P451', withPeriod))},
            {'ቆልዑ',      isLinked(argument['ቆልዑ']) or
                           property('P40', {['list'] = 'not ordered', ['mustExist'] = 'yes', ['linkback']='yes'}) or
                           property('P1971', withoutLinkup)
            },
            {'ኣባላት ስድራ', isLinked(argument['ኣባላት ስድራ'])},
        },
        {type='section',
            ['title']   = 'ትምህርቲ',
            titlestyle = sectionsTitleStyle,
            {'ትምህርቲ',  education},
            {labelEducatedIn, almamater, class='plainlist'},
            {'ድሕረ ምረቓ',   argument['ድሕረ ምረቓ']},
            {'ዶክተራዊ ድርሳን', 
                inBrackets(
                    (argument['ኣድራሻ መርበብ ሓበሬታ ድርሳን'] and toLinkURL(argument['ኣድራሻ መርበብ ሓበሬታ ድርሳን'], ModuleTextFormat.inItalics(argument['ኣርእስቲ ድርሳን']))-- If the url is informed
                    ) or (not argument['ኣድራሻ መርበብ ሓበሬታ ድርሳን'] and ModuleTextFormat.inItalics(argument['ኣርእስቲ ድርሳን']) -- If the url is not informed
                    ) 
                , argument['ዓመት ድርሳን'])
            },
            {'ዶክተራዊ ተቖጻጻሪት', argument['ዶክተራዊ ተቖጻጻሪት']},
            {'ዶክተራዊ ተቖጻጸርቲ'  , argument['ዶክተራዊ ተቖጻጸርቲ']},
            {'ዶክተራዊ ተቖጻጻሪ' , argument['ዶክተራዊ ተቖጻጻሪ'] or property('P184')},
            {labelStudentOf, argument['ተማሃራይ ናይ'] or  property('P1066', withPeriodMustExist), class='plainlist'},
        },
        {type='section',
            ['title'] = 'ሞያዊ ሓበሬታ',
            titlestyle = sectionsTitleStyle,
            {'ሞያ',      occupation, class='role'},
            {'ቦታ',           area},
            {labelActiveYears,  argument['ዓመታት ንጡፍ'] or argument['ዓመታት ንጥፍቲ'] or argument['ዓመታትንጡፍ'] or 
                               argument['እዋን'] or argument['እዋን'] or
                               argument['ግዜ'] or argument['ዓመታት ንጥፈት'] or
                               periodFormat({ -- the pencil is missing
                                   ['P580']={[1]=tableElement(Entity, 'claims','P2031',1,'mainsnak')},
                                   ['P582']={[1]=tableElement(Entity, 'claims','P2032',1,'mainsnak')}
                               })},
            {labelKnownBy,  argument['ፍሉጥ ብ'] or argument['ፍሉጥ']},
            {'ዝተታሕዙ ስልጣናት',    officesoccupied,class='plainlist'}, -- politicians or in companies
            {'ኣሰያይማ',        argument['ኣሰያይማ']},
            
            {'ደሞዝ',            argument['ደሞዝ']},
            {'ጥሪት',         argument['ጥሪት'] or argument['ሃብቲ']},
            
            {'ኩባንያ',            argument['ኩባንያ']},
            {'መጽናዕቲ',            argument['ስም መጽናዕቲ']}, -- Architects
            {'ኣብያተ መግቢ',       argument['ኣብያተ መግቢ']},   -- For cooks. Restaurants in which he has worked.

            {type='section',
	            ['title'] = 'ሃይማኖታዊ ሓበሬታ',
	            titlestyle = sectionsTitleStyle,
	            {'[[በዓለ ሲመት|ድያቆናዊ ስርዓት]]', DiaconalOrder},
	            {'ክህነታዊ ስርዓት', PriestlyOrder},
	            {'ኤጲስቆጶሳዊ ስርዓት', EpiscopalOrder},
	            {'ካርዲናል ኣዋጅ', Cardinalate}, 
	            {'ካርዲናል መዓርግ', argument['ካርዲናል መዓርግ']},
	            {'ቤተ ክርስትያን', argument['ቤተ ክርስትያን']},
	            {'[[ዓለማውነት]]', argument['ዓለማውነት']},
	            {'[[ኣብጽኦት]]', argument['ኣብጽኦት']},
	            {'[[ቀኖናውነት]]', argument['ቀኖናውነት'] or property('P411', inUppercase)},
	            {'በዓል', argument['በዓል'] or property('P841')},
	            {'ባህርያት', argument['ባህርያት']},
	            {labelReveredIn, argument['ዝኽበር ኣብ'] or property('P1049')},
	            {'ምጉይታት', argument['ምጉይታት'] or property('P417')},
	            {'ቅዱስ ቦታ', argument['ቅዱስ ቦታ']},
            },
            -- Artistic section (actors and, presenters?)
            {type='section',
                ['title']   = artisticsection,
                titlestyle = sectionsTitleStyle,
                {'ናይ መጀመርታ ተራ'    , argument['ናይ መጀመርታ ተራ']},
                {'ናይ መጀመርታ ዓመት' , argument['ናይ መጀመርታ ተራ'] and argument['ናይ መጀመርታ ዓመት']},
                --{'ዓመት ምውጻእ', argument['ዓመት ምውጻእ'] or property('P2032')},
                {'ፊልምታት'    , argument['ብዝሒ ፊልምታት']},
                {'ተኸታታሊ'        , argument['ተኸታታሊ']},
            },
            {'ኣስራሒ',      argument['ኣስራሒ'] or
                               argument['ትካል_ስራሕ'] or
                               argument['ስም_መጽናዕቲ'] or
                               property('P108', withPeriod),
                               class       ='plainlist'},
            --Teachers
            {'ዶክተራዊ ተማሃሮ',   argument['ዶክተራዊ ተማሃሮ'] or property('P185', mustExist)},
            {(occupationOrArea and occupationOrArea:find('መምህር') and 'ተማሃሮ'), argument['ተማሃሮ'] or property('P802', mustExist)},

            -- Journalists, presenters and video bloggers
            {type='section',
                {'መራኸቢ ብዙሃን',          argument['መራኸቢ ብዙሃን']}, -- Sometimes informed with the meaning of area and others with the employer
                {'መትረብ',          argument['መትረብ']},
                {'መደባት',      argument['መደባት'] or argument['መደብ']},
            },
            -- Video bloggers, especially youtubers
            {type='section',
                {'ቪድዮታት', argument['ቪድዮታት']},
                {'ተመዝገብቲ', argument['ተመዝገብቲ']},
                {'ጠቕላላ ትርኢታት', argument['ጠቕላላ ትርኢታት']},
            },
            -- Occupation (writers, artists, journalists, designers, etc.)
            -- Artistic information
            {type='section',
                plural(argument['ምንቅስቓስ'] or argument['ምንቅስቓሳት'] or 
                    property('P135', {
                        ['value-module'] = 'Wikidata/Movement format', 
                        ['value-function'] = 'movementFormat', 
                        ['linkback']='yes', 
                        ['qualifying'] = periodFormat,
                        ['highestRank'] = 'yes',
                        toOrder='ብዕለት', ['textFormat'] = 'uppercase',}), 'ምንቅስቓስ', 'ምንቅስቓሳት'),
                {'ስም ብርዒ', argument['ስም ብርዒ'] or argument['ካልእ ስም'] or property('P742')},
                {'ስነ ጽሑፋዊ ቋንቋ',  argument['ስነ_ጽሑፋዊ_ቋንቋ']},
                plural(argument['ጾታ'] or argument['ጾታ'] or property('P136', inUppercase), 'ጾታ', 'ጾታታት'),
                plural(argument['መሳርሒ'] or property('P1303', inUppercase), 'መሳርሒ', 'መሳርሒታት'),
                {'ዓይነት ደሃይ', argument['ደሃይ'] or argument['ዓይነት ደሃይ'] or property('P412', inUppercase)},
                plural(argument['ትካል መዝገብ'] or property('P264', withPeriod), 'ትካል መዝገብ', 'ትካላት መዝገብ', 'plainlist'),
            },
            -- Notable works. They are put in italics for the moment but it is incorrect in the case of architects.
            {'ፍሉጣት ስራሕቲ', argument['ብሉጻት ስራሕቲ'] or
                               argument['ፍሉጣት ስራሕቲ'] or argument['ፍሉጣት_ስራሕቲ'] or
                               argument['ስራሕቲ'] or
                               argument['ተወከልቲ_ፕሮጀክታት'] or property('P800',{['link']='yes', ['list'] = 'not ordered',  ['mustExist'] = 'yes', ['textFormat']='italics', ['linkback']='yes'}),
                               class='plainlist'
            },
            {'ተወከልቲ ፕሮጀክታት', argument['ተወከልቲ ፕሮጀክታት']},
            {'ተዛመድቲ ስነ ጥበባውያን', related},
            {'[[ምጥቃስ ደራሲ|ኣሕጽሮተ ቃል ኣብ ስነ ዕጽዋት]]',
                argument['ኣሕጽሮተ ቃል ኣብ ስነ ዕጽዋት'] or property('P428')},
            {'[[ምጥቃስ ደራሲ|ኣሕጽሮተ ቃል ኣብ ስነ እንስሳታት]]',
                argument['ኣሕጽሮተ ቃል ኣብ ስነ እንስሳታት'] or property('P835')},
            {'[[ምጥቃስ ደራሲ|ኣሕጽሮተ ቃል ኣብ ስነ ኮኾብ]]',
                argument['ኣሕጽሮተ ቃል ኣብ ስነ ኮኾብ']},
                
            --{'', collapsibleList(labelInfluences, argument['ዝተጸልወ ብ'] or 
            --         argument['ጽልዋታት'], frame)},
            --{'',         collapsibleList('ጽልዋ ኣሕዲሩ(ራ) ን', argument['ጽልዋ ኣሕዲሩ(ራ) ን'] or argument['ጽልዋ ኣሕዲሩ'], frame)},

            -- Military
            {'ተኣማንነት', argument['ተኣማንነት'] or property('P945', inUppercase)},
            {'ወተሃደራዊ ጨንፈር', argument['ጨንፈር'] or property('P241', inUppercase)},
            {'ወተሃደራዊ ሓድነት', argument['ሓድነት'] or property('P7779', inUppercase)},
            {'ትእዛዛት', argument['ትእዛዛት']},
            {'[[ወተሃደራዊ መዓርግ]]', argument['መዓርግ'] or property('P410', withPeriod), class='plainlist'},
            {'ግርጭታት', argument['ግርጭታት'] or argument['ውግኣት'] or property('P607', inUppercase)},
            -- Astronauts (a subtype of military)
            {'ተልእኾታት ጠፈር', argument['ተልእኾታት ጠፈር'] or property('P450')},
            {'ኣብ ጠፈር ዝነበረ ግዜ', argument['ግዜ ጠፈር']},

            {'ፖለቲካዊ ሰልፊ',   argument['ፖለቲካዊ ሰልፊ'] or argument['ሰልፊ'] or property('P102', withPeriod), class='plainlist'},
            {'ሃይማኖታዊ ስርዓት', argument['ምእመናን'] or property('P611', inUppercase)},
            {'ምትእስሳራት',   argument['ምትእስሳራት'] or property('P1416')},
            {'ኣባል ናይ', argument['ኣባል ናይ'] or argument['ማሕበር ሰራሕተኛታት'] or property('P463', withPeriodMustExist), class='plainlist'},
            {'ማእከል ማሕበር ሰራሕተኛታት', argument['ማእከል ማሕበር ሰራሕተኛታት'], class='plainlist'},
            -- Web
            {'መርበብ ሓበሬታ', webSite},
        },

        {type='section',
            ['title']   = 'ስፖርታዊ ሞያ',   -- See the noble infobox or the designer infobox
            titlestyle = sectionsTitleStyle,
            {'ስፖርት', argument['ስፖርት'] or property('P641', inUppercase)},
            {'ወኪል ናይ', argument['ወኪል'] or property('P1532', withPeriod)},
        },
        {type='section',
            ['title']  = 'መግለጺ መንነት ተጻዋታይ',
            titlestyle = sectionsTitleStyle,
            {'ጸወታታት', argument['ጸወታታት']  or property('P2416')},
            {'ደረጃ', argument['ደረጃ']  or property('P413')},
            {'ቁጽሪ', argument['ቁጽሪ']  or property('P1618')},
            {'ጋንታታት', argument['ጋንታታት'] or property('P54')},
            {'ሊጋት',  argument['ሊጋት']   or property('P118')},
            {'ምምራጽ', argument['ምምራጽ']},
            {'ተዓዋቲ መዳልያ', argument['ኦሎምፒካዊ ተዓዋቲ መዳልያ']},
            {'ኣሰልጣኒ', argument['ኣሰልጣኒ'] or property('P6087')},
            {'መድረኻት ፈነወ',  argument['መድረኽ']},
        },
		{type='section',
			['title'] = 'መዳልያታት',
			titlestyle = sectionsTitleStyle,
			{'', argument['መዳልያታት'] },
		},
        {type='section',
            ['title'] = 'ገበናዊ ሓበሬታ',
            titlestyle = sectionsTitleStyle,
            {'ገበናዊ ክስታት', argument['ገበናዊ ክስታት']  or property('P1399'), class='plainlist'},
            -- P2632 can be used in any of the two parameters below
            {'ፍርዲ',               argument['ፍርዲ']},
            {'መቕጻዕታዊ ኩነት',       argument['መቕጻዕታዊ ኩነት']},
            {'ግዳያት',              victims},
        },

        -- With label/data as in the writer and artist infoboxes instead of as in the person infobox
        {'ፊርማ', signature },

        {type='section',
            title       ='መዘኻኸሪታት',
            titlestyle='border-top:1px solid #c0c0c0;text-align:left',
            {'', argument['መዘኻኸሪታት'], datastyle='text-align:left;font-size:90%; line-height:1.2em'}
        },
        -- Hypothetical section, images below are not displayed within a section
        {'',
            CoatOfArmsTitle or '',
            datastyle = 'text-align: center; font-weight: bold;' .. (sectionsTitleStyle or ''),
        },
        bottomimage = CoatOfArms,
        ['bottomimagesize'] = '110px',
        bottomfooter = CoatOfArmsMotto,
        --{'ምንጪ ታሪኽ ህይወት', argument['ምንጪታሪኽህይወት']},
        entity = argument['id'], -- for the final link to wikidata
    }

    categories = {}

    if  argument['መዕረፊ_ቦታ'] or --renamed
        argument['ዶክተራዊ_ተቖጻጻሪት'] or --renamed
        argument['ዶክተራዊ_ተቖጻጸርቲ'] or --renamed
        argument['ዶክተራዊ_ተቖጻጻሪ'] or --renamed
        argument['ድርሳን_ኣድራሻ_መርበብ_ሓበሬታ'] or --renamed
        argument['ድርሳን_ኣርእስቲ'] or --renamed
        argument['ድርሳን_ዓመት'] or --renamed
        argument['ኣሕጽሮተ ቃል ኣብ ስነ ኮኾብ']
        or argument['ምንጪታሪኽህይወት'] --to be deleted
        or argument['ኢመይል'] --to be deleted
        then
            table.insert(categories, '[[Category:Wikipedia:ካብቲ ናይ ሰብ ሓበሬታ ሞደል ክትክእዎ ዘለኩም መለክዒታት ዘለዎም ገጻት ]]')
    end

	local Lifetime = require('Module:Lifetime')
	-- table.insert(categories, Lifetime.catLivingStatus(argument['ዕለት ልደት'], argument['ዕለት ሞት'], true ) )
	table.insert(categories, Lifetime.catSexGenderIdentity())

    if argument['ኣርእስታት ክፍልታት'] == '' then -- "no" when calling the infobox
        --if true then return require('Module:Tables').tostring(Infobox) end
        deleteSectionTitles(Infobox)
    end

    namespace = mw.title.getCurrentTitle().namespace
    if categories[1] and (namespace == 0 or namespace == 104) then
        return ModuleInfobox.infobox(Infobox) .. table.concat(categories)
    else
        return ModuleInfobox.infobox(Infobox)
    end
end

function deleteSectionTitles (board)
    if board.type == 'section' then
        board.title = nil
    end
    for k, v in pairs( board ) do
        if type(v) == 'table' then
            deleteSectionTitles(v)
        end
    end
    --if true then return require('Module:Tables').tostring(board) end
end

function generateoffice(argument,number,frame)
    info=number --two variables are required for the first parameter
    if number == 1 then number ='' end --if it's the first office, then it doesn't have a number
    if argument ['ስልጣን'..number] == nil then title=''
    elseif argument['ኣርማ'..number] == nil then title=argument['ስልጣን'..number] -- if it does not have a coat of arms then leave it blank, if it does have a coat of arms put it
    else   title='[[File:'..argument['ኣርማ'..number]..'|44x40px]]<br />'..argument['ስልጣን'..number] end
    if argument['ወረዳ'..number] then title = title..'<br /><small>ብ'..argument['ወረዳ'..number]..'</small>' end
    if argument['ኣምባሳደርናይ'..number] then title = title .. frame:preprocess('<br /> {{flagdeco|'.. argument['ኣምባሳደርናይ'..number] ..'|size=44x40px}}') end--{{flagdeco|{{{ኣምባሳደርናይ}}}|size=44x40px}} 
    if argument['ሃገር'..number] then title = title .. frame:preprocess('{{flagdeco|'.. argument['ሃገር'..number] ..'|size=44x40px}}') end
    if argument['ንኡስኣርእስቲ'..number] then title = title .. '<br /><small>'..argument['ንኡስኣርእስቲ'..number]..'</small>' end
    period = ''
    if argument['ምጅማር'..number] and argument['መወዳእታ'..number] then
        period = argument['ምጅማር'..number]..'-'.. argument['መወዳእታ'..number]
    elseif argument['መወዳእታ'..number] then
        period = 'ክሳብ ' .. argument['መወዳእታ'..number]
    elseif argument['ምጅማር'..number] then
        title = title .. '<br /> <small> ኣብዚ ሕጂ እዋን ኣብ ስልጣን</small>'
        period = 'ካብ '..argument['ምጅማር'..number]
    end

    textstring={type='section',
            ['title']=title,
            titlestyle = 'background-color:#E6E6FA;',
            {'', period},
            {'ብሓባር ምስ', argument['ብሓባርምስ'..number] },
            {'ዝተሓጽየ ብ', argument['ዝተሓጽየ'..number] },
            {'ዝተሓጽየት ብ', argument['ዝተሓጽየት'..number] },
            {'ዝተመዘዘ ብ', argument['ዝተመዘዘ'..number] },            
            {'ዝተመዘዘት ብ', argument['ዝተመዘዘት'..number] },
            {'[[ንጉስ]]', argument['ንጉስ'..number] },
            {'[[ንጉስ|ንግስቲ]]', argument['ንግስቲ'..number] },
            {'[[ፕረዚደንት]]', argument['ፕረዚደንት'..number] },
            {'[[ቀዳማይ ሚኒስተር]]', argument['ቀዳማይሚኒስተር'..number] },
            {'[[ቀዳማይ ሚኒስተር|ቀዳመይቲ ሚኒስተር]]', argument['ቀዳመይቲሚኒስተር'..number] },
            {'[[ቻንስለር]]', argument['ቻንስለር'..number] },
            {'[[ኣመሓዳሪ]]', argument['ኣመሓዳሪ'..number] },
            {'[[ከንቲባ]]', argument['ከንቲባ'..number] },
            {'[[መራሒ መንግስቲ]]', argument['መራሒ'..number] },
            {'[[መራሒ መንግስቲ|መራሒት መንግስቲ]]', argument['መራሒት'..number] },
            {'[[ካቢነ]]', argument['ካቢነ'..number] },           
            {'[[ካቢነ|ቤት ምኽሪ ሚኒስተራት]]', argument['ቤትምኽሪ'..number] },            
            {'ጸሓፊ', argument['ጸሓፊ'..number]},
            {'ጸሓፊት', argument['ጸሓፊት'..number]},
            {'[[ምክትል ፕረዚደንት]]', argument['ምክትልፕረዚደንት'..number] },
            {'[[ምክትል ቀዳማይ ሚኒስተር]]', argument['ምክትልቀዳማይሚኒስተር'..number] },
            {'[[ምክትል ቀዳማይ ሚኒስተር|ምክትል ቀዳመይቲ ሚኒስተር]]', argument['ምክትልቀዳመይቲሚኒስተር'..number] },
            {'ምክትል ቻንስለር', argument['ምክትልቻንስለር'..number]},
            {'[[ምክትል ኣመሓዳሪ]]', argument['ምክትልኣመሓዳሪ'..number] },
            {'[[ምክትል ኣመሓዳሪ|ምክትል ኣመሓዳሪት]]', argument['ምክትልኣመሓዳሪት'..number] },            
            {'[[ለተናል ኣመሓዳሪ]]', argument['ለተናል'..number] },
            {'ምክትል ከንቲባ', argument['ምክትልከንቲባ'..number] },
            {'ምክትል መራሒ መንግስቲ', argument['ምክትልመራሒ'..number]},
            {'ቅድሚኡ ዝነበረ', argument['ቅድሚኡዝነበረ'..number]},
            {'ቅድሚኣ ዝነበረት', argument['ቅድሚኣዝነበረት'..number]},
            {'ተካኢ', argument['ተካኢ'..number]},
            {'ተካኢት', argument['ተካኢት'..number]},
            {argument[info..'data1'], argument[info..'data2'] },
            {argument[info..'data3'], argument[info..'data4'] },
            {'','<hr>'}
        }
return textstring

end
-- Function that returns the list of the values of a property in Wikidata formatted
function property(propertyId,options)
    -- Do not get any Wikidata properties for deceased people if accessed with wikidata=no parameter
    if not getDataWikidata then
        return
    end

    if Entity and Entity.claims and Entity.claims[propertyId] then
        if not options then
            options = {['linkback']='yes'}
        end

        options.entityId = Entity.id
        --if propertyId =='P1477' then return require('Module:Tables').tostring(Entity) end -- MISSING
        options.property = propertyId

        propertyValue = getPropertyWikidata(options,Entity.claims[propertyId])

        if not propertyValue then
            return
        end

        if propertyValue:match('%[%[:d:') then
          somePropertyLinkWikidata = true
        end

        return propertyValue
    end
end

function collapsibleList(title, list, frame)
    if not list then
        return
    end
    previousformat='background:transparent'
    return frame:preprocess('{{Collapsible list|title=' .. title .. 
        --'|frame_style=border:0; padding:0; border-top:1px solid #c0c0c0;' ..
        '|frame_style=border:0; padding:0;' ..
        '|title_style=background-color:#8DB1C3;color:#FFF; text-align:left|list_style=padding-left:33%;text-align:left; display:none|1='
        .. list .. '}}')
end

function dropdownSection(title, list, frame, titlestyle)
    if not list then
        return
    end
    return frame:preprocess('{{Dropdown section|title=' .. title .. 
        --'|border_style=border:0; padding:0; border-top:1px solid #c0c0c0;' ..
        '|data=<div style="text-align:left;margin: 1px; padding: 2px; border:1px">'.. list .. '</div>|titlestyle='.. (titlestyle or '') ..';}}')
end

function isLinked(that)
    if true then return that end

    if not that then 
        return
    end

    for content in that:gmatch("%[%[(.+)]]") do
        if not content:match('^:d:') and
           not content:match('^Category:') then
            return that
        end
    end
end

function maleOccupationFormat(value, options, frame, qualifiers)
    local occupationLink, occupationLabel, occupationEntityId = ModuleWikidataFormats.getData(value)
    return ModuleWikidataFormats.toLink(occupationLink, occupationLabel, occupationEntityId, options)
end

function femaleOccupationFormat(value, options, frame, qualifiers)
    local occupationLink, occupationLabel, occupationEntityId = ModuleWikidataFormats.getData(value)

    -- Wikidata will not be accessed for the most frequent occupations.
    local femaleOccupationsTable={
        ['Q15253558'] = 'ተጣባቒት',
        ['Q1476215' ] = 'ተጣባቒት ሰብኣዊ መሰላት',
        ['Q33999'   ] = 'ተዋሳኢት',
        ['Q10800557'] = 'ተዋሳኢት ፊልም',
        ['Q2259451' ] = 'ተዋሳኢት ትያትር',
        ['Q10798782'] = 'ተዋሳኢት ተለቪዥን',
        ['Q2405480' ] = 'ተዋሳኢት ደሃይ',
        ['Q488111'  ] = 'ተዋሳኢት ስእለ ጽዩፍ',
        ['Q10873124'] = 'ተጻዋቲት ቸስ',
        ['Q42973'   ] = 'ስነ ሃናጺት',
        ['Q483501'  ] = 'ስነ ጥበባዊት',
        ['Q482980'  ] = 'ደራሲት',
        ['Q5716684' ] = 'ሳዕሳዒት',
        ['Q177220'  ] = 'ደራፊት',
        ['Q15212951'] = 'ሰራሒት ፊልም',
        ['Q36834'   ] = 'ኣወሃሃዲት ሙዚቃ',
        ['Q18939491'] = 'ጸሓፊት መዝገበ ዕለት',
        ['Q5322166' ] = 'ነዳፊት',
        ['Q214917'  ] = 'ጸሓፊት ተዋስኦ',
        ['Q43845'   ] = 'ነጋዲት',
        ['Q36180'   ] = 'ጸሓፊት',
        ['Q1281618' ] = 'ቀራጺት',
        ['Q11900058'] = 'ዳህሳሲት',
        ['Q33231'   ] = 'ሰኣሊት',
        ['Q4379701 '] = 'ሞያዊ ተጻዋቲት',
        ['Q4610556' ] = 'ሞደል',
        ['Q1028181' ] = 'ቀባኢት',
        ['Q49757'   ] = 'ገጣሚት',
        ['Q270389'  ] = 'ኣቕራቢት ዜና',
        ['Q947873'  ] = 'ኣቕራቢት ተለቪዥን',
        ['Q549322'  ] = 'ተዋጋኢት ብዕራይ',
        ['Q333634'  ] = 'ተርጓሚት',
    }

    local occupationLabelCorrected = femaleOccupationsTable[occupationEntityId]

    if occupationLabelCorrected then
        return ModuleWikidataFormats.toLink(occupationLink, occupationLabelCorrected, occupationEntityId, options)
    else
        -- Occupation is not in the table above. Attempting to retrieve property P2522 on Wikidata for occupation
        occupationLabelCorrected = ModuleWikidata.getPropertyInTigrinya(occupationEntityId, 'P2521') or occupationLabel
        return ModuleWikidataFormats.toLink(occupationLink, occupationLabelCorrected, occupationEntityId, options)
    end
end

function getQualifierValue(Property, Qualifying, propertyValue)
    -- Get the value of the first property qualifier with the received value 
    if not Entity or not Entity.claims or not Entity.claims[Property] then
        return
    end

    for k,v in pairs(Entity.claims[Property]) do
        if v.mainsnak
           and v.mainsnak.datavalue
           and v.mainsnak.datavalue.value
           and v.mainsnak.datavalue.value['numeric-id'] == propertyValue
           and v.qualifiers
           and v.qualifiers[Qualifying]
           and v.qualifiers[Qualifying][1]
           and v.qualifiers[Qualifying][1].datavalue then 
            return v.qualifiers[Qualifying][1].datavalue.value
        end
    end
end

function getArgumentsWithValue(frame)
    local original

    if frame == mw.getCurrentFrame() then
        original = frame:getParent().args
    else
        original = frame.args or frame
    end
    
    local copy= {}

    for k,v in pairs(original) do
        if v == 'no' and k ~= 'wikidata' then
            --If "no" is valid, leave the argument blank so as not to obtain the value
            --from Wikidata
            copy[k] = ''
        elseif v~='' then
            --If it is blank leave it to nil to get the Wikidata value 
            -- if there is no other argument with a similar name
            copy[k] = original[k]
        end
    end
    
    return copy
end

function getImageWikidata()
    local image, imageValue, imageFooters, k, imageFooter
    if not Entity then
        return
    end

    --  Get the first image in Wikidata of the person
    local image = tableElement(Entity, 'claims','P18')
	
    if not image then
        return
    end

	image = require('Module:Wikidata').filterStatementByRank(image)[1]

    -- Get image name
    imageValue =  tableElement(image, 'mainsnak','datavalue','value') -- For example, image.jpg

    -- Get image footers, one per language
    imageFooters =  tableElement(image, 'qualifiers','P2096')

    -- Find the footer in Tigrinya (the one with datavalue.value.language = "ti")
    if imageFooters then
        for k,imageFooter in pairs(imageFooters) do
            if imageFooter.datavalue.value.language=='ti' then
                -- return the image and the text of the image footer in Tigrinya
                return imageValue, imageFooter.datavalue.value.text
            end
        end
    end

    -- If there is no footer in Tigrinya, check if there is a date specified for the image
    imageFooters = tableElement(image, 'qualifiers', 'P585')

    if imageFooters and imageFooters[1] then
    	if imageFooters[1].datavalue and imageFooters[1].datavalue.value then
			return imageValue, name .. ' ብ' .. require('Module:Wikidata/Date').FormatDateTime(imageFooters[1].datavalue.value, {['dateFormat']='ዓመት',['link']='no'})
		else
			return imageValue, name
		end
    end

    -- No image footer in Tigrinya
    return imageValue
end

function getDateWikidata(property)
    local dateStatements = tableElement(Entity, 'claims', property)

    -- Do not return age if there are none or if there are multiple dates.
    if not dateStatements or dateStatements[2] then
        return
    end

    local dateStatement = dateStatements[1]

    if not dateStatement then
        return
    end

    local dateValue = tableElement(dateStatement, 'mainsnak', 'datavalue', 'value')

    if not dateValue then
        return
    end

    --Accuracy must reach to the day
    if dateValue.accuracy ~= 11 then
        return
    end

    local iso = dateValue.time

    if not iso then
        return
    end

    local Date = {}

    Date.calendar = dateValue.calendarmodel
    Date.year     = tonumber(iso:sub(1, 5))
    Date.month    = tonumber(iso:sub(7,8))
    Date.day      = tonumber(iso:sub(10,11))

    return Date
end

function getAgeWikidata(endProperty)
    local birthDate = getDateWikidata('P569')

    if not birthDate then
        return
    end

    if endProperty then
        local endDate = getDateWikidata(endProperty)

        if endDate and
           endDate.calendar == birthDate.calendar then

            return age(birthDate, endDate)
        end
    else
        return age(birthDate)
    end
end

function noExtend(that)
    if not that then
        return
    end

    return '<div style="width:14.66em;overflow:hidden;text-overflow:ellipsis;white-space: nowrap;">' .. that .. '</div>'
end

function plural(that, singular, plural, pClass)
    if not that then
        return {}
    elseif that:match(',') or that:match('</li><li>') then
        return {plural, that, class=pClass}
    else
        return {singular, that, class=pClass}
    end
end

function ifItsNot(that, value)
    if not that then
        return
    end

    if not that:match(value) then
        return that
    end
end

return z