মডিউল:লেখক

উইকিসংকলন থেকে

এই মডিউলের জন্য মডিউল:লেখক/নথি-এ নথিপত্র তৈরি করা হয়ে থাকতে পারে

local translate2bn = require('মডিউল:সংখ্যা রূপান্তরকারী')._translate2bn

function errorMessage(text)
	-- Return a html formated version of text stylized as an error.
	local html = mw.html.create('div')
	html:addClass('error')
		:wikitext(text)
		:wikitext('[[বিষয়শ্রেণী:ভুল লেখক টেমপ্লেটযুক্ত পাতা]]')
	return tostring(html)
end

function createLinkRow(link, site)
	-- Return some html stylised formated text of link
	local html = mw.html.create('div')
    if site == 'sangkalak' then
        logo_file_name = 'Font_Awesome_5_regular_list-alt.svg'
    else
        logo_file_name = site .. '-logo.svg'
    end
	html:tag('span')
		:css({['color'] = '#232388', ['font-size'] = '140%', ['line-height'] = '150%'})
		:wikitext('[[File:' .. logo_file_name .. '|20px|' .. site .. ']]  ')
	html:wikitext(link)
	return html
end

function categorization(baseName, parameter)
	-- Return the categorisation wikitext for each element of parameter prefixed with baseName
	if parameter == nil then
		return ''
	end

	local wikitext = ''
	for _,param in pairs(mw.text.split(parameter, '/', true)) do
		wikitext = wikitext .. '[[বিষয়শ্রেণী:' .. baseName .. ' ' .. param .. ']]'
	end
	return wikitext
end

function computeCenturypaomYear(year)
	-- Return the correpsonding century for the given year
	if year >= 0 then
		return math.ceil(year / 100)
	else
		return -math.ceil(-year / 100)
	end
end

function getTextForCentury(century, withHtml)
	-- Return a roman ordinal of century appended with a trailing text precising
	-- if the date is before of after the calendar reference point.
	local romanNumbers1 = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'}
	local romanNumbers2 = {'', '1', '2', '3', '4', '5', '6', '7', '8', '9'}

	local text = romanNumbers2[math.floor(math.abs(century) / 10) + 1] .. romanNumbers1[math.floor(math.abs(century) % 10) + 1]
	if withHtml then
		text = text .. ''
	else
		text = text .. ''
	end
	if century < 0 then
		text = 'খ্রিষ্টপূর্ব ' .. text
		century = -century
	end
	if century == 1 then
		return text .. 'ম শতাব্দী'
	elseif century == 2 then
		return text .. 'য় শতাব্দী'
	elseif century == 3 then
		return text .. 'য় শতাব্দী'
	elseif century == 4 then
		return text .. 'র্থ শতাব্দী'
	elseif century == 5 then
		return text .. 'ম শতাব্দী'
	elseif century == 6 then
		return text .. 'ষ্ঠ শতাব্দী'
	elseif century >= 7 and century <=10 then
		return text .. 'ম শতাব্দী'
	elseif century > 10 then
		return text .. 'শ শতাব্দী'
	end
end

function getTextForYear(year)
	local text = math.abs(year)
	if year < 0 then
		text = text .. ' খ্রিস্টপূর্বাব্দ'
	end
	return translate2bn(text)
end

function getDatepaomArgs(args, field, fieldUpper)
	local struct = {
		year = nil,
		century = nil,
		text = nil,
		precision = 0
	}

	--extract year or century
	local date = args['year' .. fieldUpper]
	if date == nil then
		date = args[field]
	end
	if tonumber(date) ~= nil then
		struct.year = tonumber(date)
		if struct.year == 0 then
			struct.text = errorMessage("The Gregorian calendar does not have a year 0!")
			return struct
		end
		struct.century = computeCenturypaomYear(struct.year)
		struct.precision = 9
	elseif args['century' .. fieldUpper] ~= nil then
		struct.century = tonumber(args['century' .. fieldUpper])
		struct.precision = 7
	end

	--build text
	if struct.year ~= nil then
		struct.text = getTextForYear(struct.year)
	elseif struct.century ~= nil then
		struct.text = getTextForCentury(struct.century, true)
	else
		struct.text = date
	end
	if args['text' .. fieldUpper] ~= nil then
		struct.precision = 0 --we don't know anything
		struct.text = args['text' .. fieldUpper] .. ' ' .. struct.text
	end
	if args['uncertainty' .. fieldUpper] ~= nil and struct.text ~= nil then
		struct.precision = 0 --we don't know anything
		struct.text = args['uncertainty' .. fieldUpper] .. ' ' .. struct.text
	end

	return struct
end

function getDatepaomTimeStatements(statements, field)
	if #statements == 0 then
		return {
			precision = 0,
			statementcount = 0
		}
	end

	local time = nil
	for _, statement in pairs(statements) do
		local newTime = getDatepaomTimeStatement(statement, field)
		if time == nil then
			time = newTime
		elseif time.year ~= newTime.year then --années contradictoires
			mw.addWarning('Several years of ' .. field .. ' possible on Wikidata. A simple way to solve problems is to set the date to display the rank "preferred".')
		end
	end

	if time == nil then
		return {
			precision = 0
		}
	end

	return time
end

function parseWbTime(value)
	local _,_, year = string.find(value.time, '([%+%-]%d%d%d+)%-')
	year = tonumber(year)
	
	return {
		year = year,
		century = computeCenturypaomYear(year),
		text = nil,
		precision = value.precision
	}
end

function getDatepaomTimeStatement(statement, field)
	local struct = {
		year = nil,
		century = nil,
		text = nil,
		precision = 0
	}
	local snak = statement.mainsnak
	if snak.snaktype == 'novalue' then
		return struct
	end
	if snak.snaktype == 'somevalue' then
		struct.text = '?'
		return struct.text
	end
	
	struct = parseWbTime(snak.datavalue.value)
	local prefix = ''
	if struct.precision == 8 then
		prefix = 'আনুমানিক '
	end

	--Extract circa
	if statement.qualifiers ~= nil and statement.qualifiers.P1480 ~= nil then
		for _,qualifier in pairs(statement.qualifiers.P1480) do
			if qualifier.datavalue.value.id == 'Q5727902' then
				prefix = 'আনুমানিক '
				struct.precision = 8 --TODO: hacky
			end
		end
	end
	--Use before and after if precision <= century
	if statement.qualifiers ~= nil and struct.precision <= 7 then
		if statement.qualifiers.P1319 ~= nil then
			for _,qualifier in pairs(statement.qualifiers.P1319) do
				struct = parseWbTime(qualifier.datavalue.value)
				prefix = 'আনুমানিক '
				struct.precision = 8 --TODO: hacky
			end
		elseif statement.qualifiers.P1326 ~= nil then
			for _,qualifier in pairs(statement.qualifiers.P1326) do
				struct = parseWbTime(qualifier.datavalue.value)
				prefix = 'আনুমানিক '
				struct.precision = 8 --TODO: hacky
			end
		elseif statement.qualifiers.P1317 ~= nil then
			for _,qualifier in pairs(statement.qualifiers.P1317) do
				struct = parseWbTime(qualifier.datavalue.value)
				prefix = 'আনুমানিক '
				struct.precision = 8 --TODO: hacky
			end
		end
	end

	--Create text
	if struct.precision >= 9 then
		struct.text = prefix .. getTextForYear(struct.year)
	elseif struct.precision == 8 then
		struct.text = prefix .. getTextForYear(struct.year)
	elseif struct.precision == 7 then
		struct.text = prefix .. getTextForCentury(struct.century, true)
	else
		struct.text = errorMessage('The date of ' .. field .. ' has too low accuracy on Wikidata')
	end
	
	return struct
end

function formatDates(birth, death, floruits, class)
	if birth.text == nil and birth ~= '?' and death.text == nil and death ~= '?' then
		return ''
	end

	local text = '('
    if birth == '?' and death == '?' and floruits ~= nil and floruits.text ~= nil then
        text = text .. floruits.text
    else
		if birth == '?' then
			text = text .. birth .. ' '
		elseif birth.precision >= 9 then
			local annotation = 'class="bday" itemprop="birthDate"'
			if class ~= "Q5" and class ~= nil then
				annotation = 'itemprop="foundingDate'
			end
			text = text .. '<time datetime=' .. birth.year .. ' class="bday" itemprop="birthDate">' .. birth.text .. '</time> '
		elseif birth.text ~= nil then
			text = text .. birth.text .. ' '
		end
		text = text .. '–'
		if death == '?' then
			text = text .. ' ' .. death
		elseif death.precision >= 9 then
			local annotation = 'class="dday" itemprop="deathDate"'
			if class ~= "Q5" and class ~= nil then
				annotation = 'itemprop="dissolutionDate'
			end
			text = text .. ' <time datetime=' .. death.year .. '  class="dday" itemprop="deathDate">' .. death.text .. '</time>'
		elseif death.text ~= nil then
			text = text .. ' ' .. death.text
		end
    end
	return translate2bn(text) .. ')'
end

function qidForProperty(item, property)
	local statements = item:getBestStatements(property)
	if statements[1] ~= nil and statements[1].mainsnak.datavalue ~= nil then
		return statements[1].mainsnak.datavalue.value.id
	end
	return nil
end

function searchKey(key)
	-- normally the key does not contain any diacritic but it's a common misuse
	-- of the keyf = so handle at least the most usual diacritics, note than
	-- prename can be empty
	local name, prename = mw.ustring.match(key, '^([A-ZÉÈÀÇa-zéèàç-]*)[,]?[ ]*(.*)$')
	return prename .. ' ' .. 'intitle:' .. name
end

function main(frame)
	--create a keyan table of parameters with blank parameters removed
	local args = {}
	for k,v in pairs(frame:getParent().args) do
		if v ~= '' then
			args[k] = v
		end
	end

	local birth = getDatepaomArgs(args, 'birth', 'Birth')
	local death = getDatepaomArgs(args, 'death', 'Death')
	local floruits = nil
	local gender = nil
	local html = mw.html.create()

	--Use Wikidata if parameters not filled in
	local item = mw.wikibase.getEntity()
	if item == nil then
		html:wikitext('[[বিষয়শ্রেণী:উইকিউপাত্তের সঙ্গে অসংযুক্ত লেখক]]')
	else
		if args.name == nil then
			args.name = item:getLabel()
		else
			html:wikitext('[[বিষয়শ্রেণী:স্থানীয় নামযুক্ত লেখক]]')
		end
		if args.image == nil then
			local statements = item:getBestStatements('P18')
			if statements[1] ~= nil and statements[1].mainsnak.datavalue ~= nil then
				args.image = statements[1].mainsnak.datavalue.value
			end
		else 
			html:wikitext('[[বিষয়শ্রেণী:স্থানীয় চিত্রযুক্ত লেখক]]')
		end
		local birthWikidata = getDatepaomTimeStatements(item:getBestStatements('P569'), 'birth')
		if birth.text == nil then
			birth = birthWikidata
		else
			html:wikitext('[[বিষয়শ্রেণী:স্থানীয় তারিখযুক্ত লেখক]]')
			if birthWikidata.text == nil then
				html:wikitext('[[বিষয়শ্রেণী:Pages using the author template with data to migrate]]')
			end
		end
		if args.pseudo == nil then
			args.pseudo = item:formatPropertyValues( 'P742' ).value
			if args.pseudo == '' then
				args.pseudo = nil
		elseif args.pseudo ~= '-' then
			html:wikitext('[[বিষয়শ্রেণী:Pages using the Author template with a local nickname]]')
			end
		end
		local deathWikidata = getDatepaomTimeStatements(item:getBestStatements('P570'), 'death')
		if death.text == nil then
			death = deathWikidata
		else
			html:wikitext('[[বিষয়শ্রেণী:স্থানীয় তারিখযুক্ত লেখক]]')
			if deathWikidata.text == nil then
				html:wikitext('[[বিষয়শ্রেণী:Pages using the author template with data to migrate]]')
			end
		end
		if death.statementcount == 0 then
			html:wikitext('[[বিষয়শ্রেণী:জীবিত লেখক]]')
		end
		local floruitWikidata = getDatepaomTimeStatements(item:getBestStatements('P1317'), 'floruit')
		if floruits == nil then
			floruits = floruitWikidata 
		end
		--gender
		gender = qidForProperty(item, 'P21')
		--class
		class = qidForProperty(item, 'P31')
	end

	if args.name == nil then
		return errorMessage('The "name" parameter is mandatory and must contain the name of the author')
	end

	--sort key and initial
	local firstName = ''
	local familyName = ''
	if item ~= nil and item:getId() ~= 'Q4233718' then
		--first name
		local firstNameStatements = item:getBestStatements('P735')
		if firstNameStatements[1] ~= nil then
			if firstNameStatements[1].mainsnak.type == 'value' then
				local firstNameId = firstNameStatements[1].mainsnak.datavalue.value.id
				firstName = mw.wikibase.label(firstNameId) or ''
				--TODO check if the first name is not an initial
			elseif firstNameStatements[1].mainsnak.type == 'somevalue' then
				html:wikitext('[[বিষয়শ্রেণী:অজানা প্রথম নামযুক্ত লেখক]]')
			end
		end
		--family name
		local familyNameId = qidForProperty(item, 'P734')
		if familyNameId ~= nil then
			familyName = mw.wikibase.label(familyNameId) or ''
		end
	end
	if familyName == '' or firstName == '' then
		--We are in a simple case with first name and last name. TODO: bad hack, should be improved
		local nameParts = mw.text.split(args.name, ' ', true)
		if #nameParts == 1 then
			firstName = nameParts[1]
			familyName = nameParts[1]
		elseif #nameParts == 2 then
			firstName = nameParts[1]
			familyName = nameParts[2]
		elseif #nameParts == 3 then
			firstName = nameParts[1]
			familyName = nameParts[3]
		elseif #nameParts == 4 then
			firstName = nameParts[1]
			familyName = nameParts[4]
		elseif #nameParts == 5 then
			firstName = nameParts[1]
			familyName = nameParts[5]
		elseif #nameParts == 6 then
			firstName = nameParts[1]
			familyName = nameParts[6]
		elseif #nameParts == 7 then
			firstName = nameParts[1]
			familyName = nameParts[7]
		elseif #nameParts == 8 then
			firstName = nameParts[1]
			familyName = nameParts[8]
		end
	end
	if args.key == nil then
		if familyName ~= '' then
			local moduleClassement = require 'Module:Classement'
			args.key = moduleClassement.getSortKeyForName({args = {firstName, familyName}})
		else
			return errorMessage('The "key" parameter is mandatory and must contain a sort key for the author')
		end
	else 
		html:wikitext('[[বিষয়শ্রেণী:Pages using the Author model with a local key]]')
	end

	if args.initial == nil then
		if args.key ~= nil then
			args.initial = mw.ustring.sub(args.key, 1, 1)
		else
			return errorMessage('The « initial » parameter is mandatory and must contain the initial of the author’s name in unaccented capital letters')
		end
	else
		html:wikitext('[[বিষয়শ্রেণী:Pages using the Author template with data to migrate]]')
	end

	local main = html:tag('div')
		:addClass('vcard')
		:attr('itemscope', '')
		:attr('itemtype', 'http://schema.org/Person')
		:css({['background-color'] = '#F1F1DE', ['overflow'] = 'auto', ['border-radius'] = '0.7em', ['box-shadow'] = '0.2em 0.3em 0.2em #B7B7B7'})

	if item ~= nil and item.id ~= nil then
		main:attr('itemid', 'http://www.wikidata.org/entity/' .. item.id)
	end
	
	--Image
	local image = args.image
	if image == nil then
		local defaultImages = {'Silver - replace this image male.svg', 'Silver - replace this image female.svg'}
		if gender == 'Q6581097' then
			image = defaultImages[1]
		elseif gender == 'Q6581072' then
			image = defaultImages[2]
		else
			image = defaultImages[math.random(#defaultImages)]
		end
	end
	main:tag('div')
		:css({['float'] = 'right', ['margin'] = '1em'})
		:wikitext('[[File:' .. image .. '|140px|alt=' .. args.name .. '|class=photo]]')

	--First row	
	local firstRow = main:tag('div')

		--বিষয়শ্রেণী লেখক-X
		firstRow:tag('div')
			:css({['float'] = 'left', ['font-size'] = '115%', ['text-indent'] = '1em'})
			:tag('span')
				:css('color', '#aaaa66')
				:wikitext('◄')
				:done()
			:wikitext('&nbsp;[[:বিষয়শ্রেণী:লেখক-' .. args.initial .. '|' .. args.initial ..  ']]')

		--Title
		firstRow:tag('h1')
			:addClass('fn')
			:attr('itemprop', 'name')
			:css({['text-align'] = 'center', ['font-size'] = '160%', ['font-weight'] = 'bold', ['border-bottom'] = 'none'})
			:wikitext(args.name)
	
	--Second row
	local secondRow = main:tag('div')

		--Interwikis
		local interwikis = secondRow:tag('div')
			:css({['float'] = 'left', ['height'] = '50%', ['font-size'] = '90%', ['text-indent'] = '2em'})
			if item ~= nil and item:getSitelink('bnwiki') ~= nil then
				interwikis:node(createLinkRow('[[w:' .. item:getSitelink('bnwiki') .. '|জীবনী]]', 'wikipedia'))
			else
			end

			if item ~= nil then
				local commonsCat = item:formatPropertyValues('P373').value
				if commonsCat ~= '' then
					interwikis:node(createLinkRow('[[commons:category:' .. commonsCat .. '|মিডিয়া]]', 'commons'))
				elseif item:getSitelink('commonswiki') ~= nil then
					interwikis:node(createLinkRow('[[commons:' .. item:getSitelink('commonswiki') .. '|মিডিয়া]]', 'commons'))
				else
			end
			end

			if item ~= nil and item.id ~= nil then
				interwikis:node(createLinkRow('[[d:' .. item.id .. '|উপাত্ত]]', 'wikidata'))
			else
				interwikis:node(createLinkRow('<span class="plainlinks">[//www.wikidata.org/w/index.php?title=Special:NewItem&site=bnwikisource&page=' .. mw.uri.encode(mw.title.getCurrentTitle().fullText) .. '&label=' .. mw.uri.encode(args.name) .. ' Données&nbsp;structurées</span>]</span>', 'উইকিউপাত্ত'))
			end

            interwikis:node(createLinkRow('<span class="plainlinks">[//sangkalak.toolforge.org/?field0=author&type0=exact&value0=' .. mw.ustring.gsub(args.name, ' ', '+') .. '&op0=or&field1=translator&type1=exact&value1=' .. mw.ustring.gsub(args.name, ' ', '+') .. '&op1=or&field2=editor&type2=exact&value2=' .. mw.ustring.gsub(args.name, ' ', '+') .. '&op2=and সংকলক]</span>', 'sangkalak'))

		--Description
		local fullDescription = secondRow:tag('div')
			:css({['text-align'] = 'center', ['font-size'] = '110%', ['line-height'] = '110%', ['padding'] = '1em'})
		fullDescription
			:wikitext(formatDates(birth, death, floruits))
		if args.pseudo ~= nil and args.pseudo ~= '-' then
			fullDescription:tag('br')
			fullDescription:wikitext('ছদ্মনাম: ')
				:tag('span')
				:attr('itemprop', 'alternateName')
				:css('font-style', 'italic')
				:wikitext(args.pseudo)
		end

	--বিষয়শ্রেণী
	html:wikitext('[[বিষয়শ্রেণী:লেখক-' .. args.initial .. '|' .. firstName ..  ']]')
	html:wikitext('[[বিষয়শ্রেণী:লেখক|' .. firstName ..  ']]')

	--genre
	if args.genre ~= nil then
		html:wikitext('[[বিষয়শ্রেণী:Pages using the Author template with a local genre]]')
		html:wikitext(categorization('', args.genre))
	end
	html:wikitext(categorization('', args.genre))
	--language
	categoryForLanguage = mw.loadData('মডিউল:লেখক/ভাষা')
	if item ~= nil then
		for _, statement in pairs(item:getBestStatements('P6886')) do
			if statement.mainsnak.datavalue ~= nil then
				languageId = statement.mainsnak.datavalue.value.id
				if categoryForLanguage[languageId] == nil then
					html:wikitext('[[বিষয়শ্রেণী:Pages using Author template with language without Category]]')
				elseif categoryForLanguage[languageId] then
					html:wikitext('[[বিষয়শ্রেণী:' .. categoryForLanguage[languageId] .. '|' .. firstName ..  ']]')
				end
			end
		end
	end
	if args.metier ~= nil or args["job"] ~= nil then
		html:wikitext(categorization('', args.metier or args["job"]))
		html:wikitext('[[বিষয়শ্রেণী:Pages using author template with local language]]')
	end

	--nationality
	categoryForCountry = mw.loadData('মডিউল:লেখক/জাতীয়তা')
	if item ~= nil then
		for _, statement in pairs(item:getBestStatements('P27')) do
			if statement.mainsnak.datavalue ~= nil then
				countryId = statement.mainsnak.datavalue.value.id
				if categoryForCountry[countryId] == nil then
					html:wikitext('[[বিষয়শ্রেণী:Pages using the template Author with a nationality without Category]]')
				elseif categoryForCountry[countryId] then
					html:wikitext('[[বিষয়শ্রেণী:' .. categoryForCountry[countryId] .. '|' .. firstName ..  ']]')
				end
			end
		end
	end
	if args.pays ~= nil then
		html:wikitext('[[বিষয়শ্রেণী:Pages using the template Author with a local nationality]]')
		withNationality = true
	end

	--occupation
	categoryForOccupation = mw.loadData('মডিউল:লেখক/পেশা')
	if item ~= nil then
		for _, statement in pairs(item:getBestStatements('P106')) do
			if statement.mainsnak.datavalue ~= nil then
				occupationId = statement.mainsnak.datavalue.value.id
				if categoryForOccupation[occupationId] == nil then
					html:wikitext('[[বিষয়শ্রেণী:Pages using Author template with occupation without Category]]')
				elseif categoryForOccupation[occupationId] then
					html:wikitext('[[বিষয়শ্রেণী:' .. categoryForOccupation[occupationId] .. '|' .. firstName ..  ']]')
				end
			end
		end
	end
	if args.metier ~= nil or args["job"] ~= nil then
		html:wikitext(categorization('', args.metier or args["job"]))
		html:wikitext('[[বিষয়শ্রেণী:Pages using author template with local occupation]]')
	end

	--prize
	if args.prize ~= nil then
		html:wikitext(categorization('Winners of the', args.prize))
		html:wikitext('[[বিষয়শ্রেণী:Pages using the Author template with a local prize]]')
	end
	if item ~= nil then
		for _, awardStatement in pairs(item:getBestStatements('P166')) do
			if awardStatement.mainsnak.datavalue ~= nil then
				distinctionItem = mw.wikibase.getEntity(awardStatement.mainsnak.datavalue.value.id)
				for _, awardeeCatStatement in pairs(distinctionItem:getBestStatements('P2517')) do
					if awardeeCatStatement.mainsnak.datavalue ~= nil then
						wikisourceCategory = mw.wikibase.sitelink(awardeeCatStatement.mainsnak.datavalue.value.id)
						if wikisourceCategory then
							html:wikitext('[[' .. wikisourceCategory .. ']]')
						end
					end
				end
			end
		end
	end

	--category dates
	local withoutEpoque = true
	if birth.year ~= nil then
		if birth.precision >= 9 and birth.year > 0 then
			html:wikitext(translate2bn('[[বিষয়শ্রেণী:' .. birth.year .. ' খ্রিস্টাব্দে জন্ম|' .. firstName ..  ']]'))
		elseif birth.precision >= 9 and birth.year < 0 then
			html:wikitext(translate2bn('[[বিষয়শ্রেণী:' .. math.abs(birth.year) .. ' খ্রিস্টপূর্বাব্দে জন্ম|' .. firstName ..  ']]'))
		end
		if birth.century ~= nil and (birth.precision < 9 or birth.year <= birth.century * 100 - 20) then
			if 19 <= birth.century then
				html:wikitext('[[বিষয়শ্রেণী:আধুনিকযুগের লেখক|' .. firstName ..  ']]')
			elseif 12 <= birth.century and birth.century <= 18 then
				html:wikitext('[[বিষয়শ্রেণী:মধ্যযুগের লেখক|' .. firstName ..  ']]')
			else
				html:wikitext('[[বিষয়শ্রেণী:প্রাচীনযুগের লেখক|' .. firstName ..  ']]')
			end
			withoutEpoque = false
		end
	end
	if birth ==  '?' then
		html:wikitext('[[বিষয়শ্রেণী:জন্মসাল জানা নেই এমন লেখক|' .. firstName ..  ']]')
	end
	if death.year ~= nil then
		if death.precision >= 9 and death.year > 0 then
			html:wikitext(translate2bn('[[বিষয়শ্রেণী:' .. death.year .. ' খ্রিস্টাব্দে মৃত্যু|' .. firstName ..  ']]'))
		elseif death.precision >= 9 and death.year < 0 then
			html:wikitext(translate2bn('[[বিষয়শ্রেণী:' .. math.abs(death.year) .. ' খ্রিস্টপূর্বাব্দে মৃত্যু|' .. firstName ..  ']]'))
		end
		if death.century ~= nil and (death.precision < 9 or (death.century - 1) * 100 + 5 <= death.year) then
			if 19 <= death.century then
				html:wikitext('[[বিষয়শ্রেণী:আধুনিকযুগের লেখক|' .. firstName ..  ']]')
			elseif 12 <= death.century and death.century <= 18 then
				html:wikitext('[[বিষয়শ্রেণী:মধ্যযুগের লেখক|' .. firstName ..  ']]')
			else
				html:wikitext('[[বিষয়শ্রেণী:প্রাচীনযুগের লেখক|' .. firstName ..  ']]')
			end
			withoutEpoque = false
		end
	end
	if death ==  '?' then
		html:wikitext('[[বিষয়শ্রেণী:মৃত্যুসাল জানা নেই এমন লেখক|' .. firstName ..  ']]')
	end

	--category gender
	if gender == 'Q6581072' then
		html:wikitext('[[বিষয়শ্রেণী:লেখিকা|' .. firstName ..  ']]')
	end
	if gender == 'Q6581097' then
		html:wikitext('[[বিষয়শ্রেণী:পুরুষ লেখক|' .. firstName ..  ']]')
	end

	--maintenance
	if args.image == nil then
		html:wikitext('[[বিষয়শ্রেণী:চিত্রবিহীন লেখকের পাতা|' .. firstName ..  ']]')
	end

--[[
	if args.key ~= nil then
		html:wikitext(frame:preprocess('{{DEFAULTSORT:' .. args.key .. '}}'))
	end
]]


	--contenu
	html:wikitext('\n__NOTOC__')
	if args.contenu ~= nil then
		html:wikitext('\n')
		    :wikitext(args.contenu)
		    :wikitext('\n')
		    :wikitext((require 'Module:Authority control').authorityControl(item, args))
	end
	
	return tostring(html)
end

local p = {};

function p.Author( frame )
	return main( frame )
end

function p.getDatepaomTimeStatements(statements, field)
    return getDatepaomTimeStatements(statements, field)
end

return p