Chronos chronos left.png
Rusmed logo color.png
Chronos chronos right.png

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Module:Institution

De Commission Historique

La documentation pour ce module peut être créée à Module:Institution/doc

local pagetitle = tostring(mw.title.getCurrentTitle())

local p = {}
function p.main(frame)
	
	f = require("Module:Fonctions")
	
	local P, refer = {}, {}	
	local publications,sources, pers_pers, pers_inst, pers_act, pers_conc='','','','','',''
	local strong_links={"directeur_de_these","superieur_hierarchique","inf_hier","disciple"}
	local langue = frame:preprocess("{{int:lang}}")
	local lang = mw.getLanguage( langue )

-- Relations personnes/institutions

	local tables = 'Pers_inst'
	local fields = 'Pers_inst._pageName=Prel,Pers_inst.RefBib=Ref,Pers_inst.Date_debut=Debut,Pers_inst.Date_fin=Fin,Pers_inst.Resume_fr=Resume_fr,Pers_inst.Resume_de=Resume_de,Pers_inst.Resume_en=Resume_en,Pers_inst.Nature=Nature,Pers_inst.Objet_1=Objet_1,Pers_inst.Objet_2=Objet_2'
	local arguments = {
		where='Pers_inst.Objet_2 WITHIN "' .. pagetitle .. '" ',
		groupBy='Pers_inst.Nature,Pers_inst.Objet_1',
		orderBy='Pers_inst.Nature,Pers_inst.Objet_1',
		intro=''
	}
	local result = mw.ext.cargo.query(tables, fields, arguments)
	if next(result) then
		pers_inst = '\n=={{int:Template-Personnels_et_protagonistes}}==\n' 
		local relations = f.trie_relations(result,"Nature",langue)
		for nature, relation in pairs(relations) do
			pers_inst = pers_inst .. '\r===' .. nature .. '===\r'
			for _,role in ipairs(relation) do
				local rref = {}
				for _,ref in ipairs(mw.text.split(role['Ref'],'#')) do
					f.tableRef(ref,rref)
				end
				 pers_inst = pers_inst .. '* [[' .. role["Objet_1"] .. ']]' .. f.expandRef(frame,rref['Reference']).. '[[' .. role["Prel"] .. '|→]]\n'
			end
		end	
	end
	
	pers_inst = frame:preprocess(pers_inst)	
	return pers_inst
end
return p