Différences entre les versions de « Module:Institution »
De Commission Historique
m |
m |
||
Ligne 17 : | Ligne 17 : | ||
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 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 = { | local arguments = { | ||
where='Pers_inst.Objet_2 | where='Pers_inst.Objet_2 WITHIN "' .. pagetitle .. '" ', | ||
groupBy='Pers_inst.Nature,Pers_inst.Objet_1', | groupBy='Pers_inst.Nature,Pers_inst.Objet_1', | ||
orderBy='Pers_inst.Nature,Pers_inst.Objet_1', | orderBy='Pers_inst.Nature,Pers_inst.Objet_1', |
Version du 26 mars 2021 à 16:22
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