Différences entre les versions de « Module:Personne »
De Commission Historique
m |
m |
||
(31 versions intermédiaires par le même utilisateur non affichées) | |||
Ligne 8 : | Ligne 8 : | ||
f = require("Module:Fonctions") | f = require("Module:Fonctions") | ||
t = require("Module:Translate") | t = require("Module:Translate") | ||
fo = require("Module:Fo") | |||
--fo = mw.loadData("Module:Fo") | |||
local P, refer = {}, {} | local P, refer = {}, {} | ||
local publications,sources, pers_pers, pers_inst, pers_act, pers_conc='','','','','','' | local publications, references, sources, pers_pers, pers_inst, pers_act, pers_conc='','','','','','','' | ||
local strong_links={"directeur_de_these","superieur_hierarchique","inf_hier","disciple","evaluateur","evalue_par","student","teacher"} | local strong_links={"directeur_de_these","superieur_hierarchique","inf_hier","disciple","evaluateur","evalue_par","student","teacher"} | ||
local langue = frame:preprocess("{{int:lang}}") | local langue = frame:preprocess("{{int:lang}}") | ||
Ligne 25 : | Ligne 26 : | ||
for key,field in ipairs({'Naissance','Deces','Exercice_medecine','Annee_these','Exam','Date_capture'}) do | for key,field in ipairs({'Naissance','Deces','Exercice_medecine','Annee_these','Exam','Date_capture'}) do | ||
frise = frise .. f.dateFrise(P[field]) .. '|' .. 'Personnel' .. '|' .. t.translate(field,langue) .. '\n' | frise = frise .. f.dateFrise(P[field]) .. '|' .. t.translate('Personnel',langue) .. '|' .. t.translate(field,langue) .. '\n' | ||
P[field] = f.afficheDate(lang, P[field]) | P[field] = f.afficheDate(lang, P[field]) | ||
end | end | ||
for _, | |||
for _,rr in ipairs(mw.text.split(P['RefPers'],'#')) do | |||
fo.tableRef(rr,refer) | |||
--ref = mw.text.split(rr,'+') | |||
--if ref[3] then | |||
-- if not refer[ref[3]] then refer[ref[3]] = '' end | |||
-- refer[ref[3]] = refer[ref[3]] .. fo.modelRef(ref[1],ref[2],ref[3]) | |||
--end | |||
end | end | ||
publications = fo.splitTextRP(P['Publications']) | |||
references = fo.splitTextRP(P['References']) | |||
-- P['Publications'] = P['Publications']:gsub("%s*#%s*","#") | |||
-- for _,rr in ipairs(mw.text.split(P['Publications'],'#')) do | |||
-- publications = publications .. fo.modelRefPub(mw.text.split(rr,'+')) | |||
-- end | |||
-- P['References'] = P['References']:gsub("%s*#%s*","#") | |||
-- for _,rr in ipairs(mw.text.split(P['References'],'#')) do | |||
-- references = references .. fo.modelRefPub(mw.text.split(rr,'+')) | |||
-- end | |||
--Nationalités, Localisations, Confessions | --Nationalités, Localisations, Confessions | ||
Ligne 36 : | Ligne 54 : | ||
local fields = 'Date_debut=Debut,Date_debut__precision=DebutP,Date_fin=Fin,Date_fin__precision=FinP, Nationalite' | local fields = 'Date_debut=Debut,Date_debut__precision=DebutP,Date_fin=Fin,Date_fin__precision=FinP, Nationalite' | ||
local arguments = { | local arguments = { | ||
where='Objet="' .. string.gsub(pagetitle,' ','_') .. '"', | where='Date_debut IS NOT NULL AND Date_fin IS NOT NULL AND Objet="' .. string.gsub(pagetitle,' ','_') .. '"', | ||
groupBy='Nationalite,Debut,Fin', | groupBy='Nationalite,Debut,Fin', | ||
orderBy='Debut,Fin,Nationalite', | orderBy='Debut,Fin,Nationalite', | ||
Ligne 44 : | Ligne 62 : | ||
if next(result) then | if next(result) then | ||
for _, car in pairs(result) do | for _, car in pairs(result) do | ||
frise = frise .. f.dateFrise(car["Debut"]) .. '/' .. f.dateFrise(car["Fin"]).. '|' .. | frise = frise .. f.dateFrise(car["Debut"]) .. '/' .. f.dateFrise(car["Fin"]).. '|' .. t.translate("Personnel",langue) .. '|[[' .. car["Nationalite"] .. ']]\n' | ||
end | end | ||
end | end | ||
local tables = 'Confessions' | local tables = 'Confessions' | ||
local fields = 'Date_debut=Debut,Date_fin=Fin, Confession' | local fields = 'Date_debut=Debut,Date_debut__precision=DebutP,Date_fin=Fin,Date_fin__precision=FinP, Confession' | ||
local arguments = { | local arguments = { | ||
where='Objet="' .. string.gsub(pagetitle,' ','_') .. '"', | where='Date_debut IS NOT NULL AND Date_fin IS NOT NULL AND Objet="' .. string.gsub(pagetitle,' ','_') .. '"', | ||
groupBy='Confession,Debut,Fin', | groupBy='Confession,Debut,Fin', | ||
orderBy='Debut,Fin,Confession', | orderBy='Debut,Fin,Confession', | ||
Ligne 59 : | Ligne 77 : | ||
if next(result) then | if next(result) then | ||
for _, car in pairs(result) do | for _, car in pairs(result) do | ||
frise = frise .. f.dateFrise(car["Debut"]) .. '/' .. f.dateFrise(car["Fin"]).. '|' .. 'Personnel' .. '|[[' .. car["Confession"] .. ']]\n' | frise = frise .. f.dateFrise(car["Debut"]) .. '/' .. f.dateFrise(car["Fin"]).. '|' .. t.translate('Personnel',langue) .. '|[[' .. car["Confession"] .. ']]\n' | ||
end | end | ||
end | end | ||
local tables = 'Localisations' | local tables = 'Localisations' | ||
local fields = 'Date_debut=Debut,Date_fin=Fin, Pays, Ville, Coordonnees' | local fields = 'Date_debut=Debut,Date_debut__precision=DebutP,Date_fin=Fin,Date_fin__precision=FinP, Pays, Ville, Coordonnees' | ||
local arguments = { | local arguments = { | ||
where='Objet="' .. string.gsub(pagetitle,' ','_') .. '"', | where='Date_debut IS NOT NULL AND Date_fin IS NOT NULL AND Objet="' .. string.gsub(pagetitle,' ','_') .. '"', | ||
groupBy='Pays,Ville,Coordonnees,Debut,Fin', | groupBy='Pays,Ville,Coordonnees,Debut,Fin', | ||
orderBy='Debut,Fin,Pays,Ville,Coordonnees', | orderBy='Debut,Fin,Pays,Ville,Coordonnees', | ||
Ligne 73 : | Ligne 91 : | ||
local result = mw.ext.cargo.query(tables, fields, arguments) | local result = mw.ext.cargo.query(tables, fields, arguments) | ||
if next(result) then | if next(result) then | ||
for _, car | for _, car in pairs(result) do | ||
if car.Ville or car.Pays then | |||
if car.Ville and car.Pays then | |||
lieu = car.Ville .. ' (' .. car.Pays .. ')' | |||
else lieu = car.Ville or car.Pays | |||
end | |||
if car.Coordonnees then | |||
lieu = '[http://www.google.com/maps/place/' .. string.gsub(car.Coordonnees,'%s+','') .. ' ' .. lieu .. ']' | |||
end | |||
frise = frise .. f.dateFrise(car["Debut"]) .. '/' .. f.dateFrise(car["Fin"]).. '|'.. t.translate('Localisations',langue) .. '|' .. lieu ..'\n' | |||
end | |||
end | end | ||
end | end | ||
Ligne 80 : | Ligne 107 : | ||
local tables = 'Pers_pers' | local tables = 'Pers_pers' | ||
local fields = '_pageName=Prel,RefBib=Ref,Date_debut=Debut,Date_debut__precision=DebutP,Date_fin=Fin,Date_fin__precision=FinP | local fields = '_pageName=Prel,RefBib=Ref,Date_debut=Debut,Date_debut__precision=DebutP,Date_fin=Fin,Date_fin__precision=FinP,Nature=Nature,Objet_1,Objet_2' | ||
local arguments = { | local arguments = { | ||
where='Objet_1 IS NOT NULL and Objet_2 IS NOT NULL and (Objet_1="' .. pagetitle .. '" or Objet_2="' .. pagetitle .. '")', | where='Objet_1 IS NOT NULL and Objet_2 IS NOT NULL and (Objet_1="' .. pagetitle .. '" or Objet_2="' .. pagetitle .. '")', | ||
Ligne 94 : | Ligne 121 : | ||
pers_pers = pers_pers .. '\r====' .. t.translate(nat,langue) .. '====\r' | pers_pers = pers_pers .. '\r====' .. t.translate(nat,langue) .. '====\r' | ||
for _,rel in ipairs(rels) do | for _,rel in ipairs(rels) do | ||
local pp = '* [[' .. rel["Objet_2"] .. ']] (' .. f.afficheDate(lang,rel["Debut"],rel["DebutP"]) .. ' - ' .. f.afficheDate(lang,rel["Fin"],rel["FinP"]) .. ')' .. '[[' .. rel["Prel"] .. '|→]]\n' | local pp = '* [[' .. rel["Objet_2"] .. ']] (' .. f.afficheDate(lang,rel["Debut"],rel["DebutP"]) .. ' - ' .. f.afficheDate(lang,rel["Fin"],rel["FinP"]) .. ')' .. '[[' .. rel["Prel"] .. '|→]]\n' | ||
pers_pers = pers_pers .. pp | |||
end | end | ||
end | end | ||
Ligne 109 : | Ligne 129 : | ||
function glossaire(v) | function glossaire(v) | ||
local pf | local user,pf = frame:preprocess("{{CURRENTLOGGEDUSER}}") | ||
if user == 'L.strappazon' or user == 'Emmanuel.nuss' or user == 'Loic.lutz' then | |||
pf = '[[def:' .. v .. '|' .. v .. ']], ' | pf = '[[def:' .. v .. '|' .. v .. ']], ' | ||
else | else | ||
Ligne 173 : | Ligne 193 : | ||
cartouche= cartouche.. '|}<div align="left">__TOC__</div>' | cartouche= cartouche.. '|}<div align="left">__TOC__</div>' | ||
local text_fields, langs = {'Resume','Contexte','Commentaire'}, {[1] = langue, [2] = 'en', [3] = 'fr',[4] = 'de'} | --local text_fields, langs = {'Resume','Contexte','Commentaire'}, {[1] = langue, [2] = 'en', [3] = 'fr',[4] = 'de'} | ||
-- Relations personnes/institutions | -- Relations personnes/institutions | ||
local tables = 'Pers_inst, Personnes=Pa' | local tables = 'Pers_inst, Personnes=Pa' | ||
local fields = 'Pa._pageName=nomA,Pers_inst._pageName=Prel,Pers_inst.RefBib=Ref, | local fields = 'Pa._pageName=nomA,Pers_inst._pageName=Prel,Pers_inst.RefBib=Ref,Date_debut=Debut,Date_debut__precision=DebutP,Pers_inst.Date_fin=Fin,Date_fin__precision=FinP,Pers_inst.Nature=Nature,Pers_inst.Objet_1=Objet_1,Pers_inst.Objet_2=Objet_2' | ||
local arguments = { | local arguments = { | ||
join='Pa._pageName=Pers_inst.Objet_1', | join='Pa._pageName=Pers_inst.Objet_1', | ||
where='Pers_inst.Objet_2 IS NOT NULL and Pa._pageName=Pers_inst.Objet_1 and Pers_inst.Objet_1="' .. pagetitle .. '"', | where='Date_debut IS NOT NULL and Date_fin IS NOT NULL and Pers_inst.Objet_2 IS NOT NULL and Pa._pageName=Pers_inst.Objet_1 and Pers_inst.Objet_1="' .. pagetitle .. '" ', | ||
groupBy='Pers_inst.Nature,nomA,Pers_inst.Objet_2,Debut,Fin', | groupBy='Pers_inst.Nature,nomA,Pers_inst.Objet_2,Debut,Fin', | ||
orderBy='Debut,Fin,Pers_inst.Nature,nomA,Pers_inst.Objet_2', | orderBy='Debut,Fin,Pers_inst.Nature,nomA,Pers_inst.Objet_2', | ||
Ligne 189 : | Ligne 207 : | ||
} | } | ||
local result = mw.ext.cargo.query(tables, fields, arguments) | local result = mw.ext.cargo.query(tables, fields, arguments) | ||
--[= | arguments.where='Pers_inst.Objet_2 IS NOT NULL and Pa._pageName=Pers_inst.Objet_1 and Pers_inst.Objet_1="' .. pagetitle .. '" ' | ||
if next( | local result2 = mw.ext.cargo.query(tables, fields, arguments) | ||
--[= | |||
if next(result2) then | |||
pers_inst = '\r=={{int:Template-Liens_institutions}}==\r' | pers_inst = '\r=={{int:Template-Liens_institutions}}==\r' | ||
local relations = f.trie_relations( | local relations = f.trie_relations(result2,"Objet_2",langue) | ||
for inst, rels in pairs(relations) do | for inst, rels in pairs(relations) do | ||
pers_inst = pers_inst .. '\r===' .. inst .. '===\r' | pers_inst = pers_inst .. '\r===' .. inst .. '===\r' | ||
Ligne 211 : | Ligne 231 : | ||
for _,rel in ipairs(rels) do | for _,rel in ipairs(rels) do | ||
--pers_inst = pers_inst .. '<tr><td>' .. '[[Def:' .. rel["Nature"] .. '|' .. rel["Nature"] .. ']]' .. '</td><td>' .. f.afficheDate(lang,rel["Debut"]) .. ' - ' .. f.afficheDate(lang,rel["Fin"]) .. '</td><td style="text-align:right;"> [[' .. rel["Prel"] .. '|→]]</td></tr>' | --pers_inst = pers_inst .. '<tr><td>' .. '[[Def:' .. rel["Nature"] .. '|' .. rel["Nature"] .. ']]' .. '</td><td>' .. f.afficheDate(lang,rel["Debut"]) .. ' - ' .. f.afficheDate(lang,rel["Fin"]) .. '</td><td style="text-align:right;"> [[' .. rel["Prel"] .. '|→]]</td></tr>' | ||
pers_inst = pers_inst .. '<tr><td>' .. glossaire(rel["Nature"]) .. '</td><td>' .. f.afficheDate(lang,rel["Debut"]) .. ' - ' .. f.afficheDate(lang,rel["Fin"]) .. '</td><td style="text-align:right;"> [[' .. rel["Prel"] .. '|→]]</td></tr>' | pers_inst = pers_inst .. '<tr><td>' .. glossaire(rel["Nature"]) .. '</td><td>' .. f.afficheDate(lang,rel["Debut"],rel["DebutP"]) .. ' - ' .. f.afficheDate(lang,rel["Fin"],rel["FinP"]) .. '</td><td style="text-align:right;"> [[' .. rel["Prel"] .. '|→]]</td></tr>' | ||
end | end | ||
pers_inst = pers_inst .. "</table></td></tr>" | pers_inst = pers_inst .. "</table></td></tr>" | ||
Ligne 218 : | Ligne 238 : | ||
pers_inst = pers_inst .. "</table>" | pers_inst = pers_inst .. "</table>" | ||
end | end | ||
--]==]f.afficheDate(lang,rel["Debut"],rel["DebutP"]) | --]==] | ||
--f.afficheDate(lang,rel["Debut"],rel["DebutP"]) | |||
if next(result) then | if next(result) then | ||
Ligne 225 : | Ligne 246 : | ||
for inst, rels in pairs(relations) do | for inst, rels in pairs(relations) do | ||
for _,rel in ipairs(rels) do | for _,rel in ipairs(rels) do | ||
frise = frise .. rel["Debut"] .. '/' .. rel["Fin"] .. '|[[' .. inst .. ']] | frise = frise .. rel["Debut"] .. '/' .. rel["Fin"] .. '|' .. t.translate('Carrière',langue) .. '|[[' .. inst .. ']], ' .. glossaire(rel["Nature"]) .. '[[' .. rel["Prel"] .. '|→]] \n' | ||
end | end | ||
end | end | ||
Ligne 237 : | Ligne 258 : | ||
local tables = 'Pers_conc, Personnes=Pa' | local tables = 'Pers_conc, Personnes=Pa' | ||
local fields = 'Pa._pageName=nomA,Pers_conc._pageName=Prel,Pers_conc.RefBib=Ref,Pers_conc.Date_debut=Debut,Pers_conc.Date_fin=Fin | local fields = 'Pa._pageName=nomA,Pers_conc._pageName=Prel,Pers_conc.RefBib=Ref,Pers_conc.Date_debut=Debut,Pers_conc.Date_fin=Fin,Pers_conc.Nature=Nature,Pers_conc.Objet_1=Objet_1,Pers_conc.Objet_2=Objet_2' | ||
local arguments = { | local arguments = { | ||
join='Pa._pageName=Pers_conc.Objet_1', | join='Pa._pageName=Pers_conc.Objet_1', | ||
Ligne 252 : | Ligne 273 : | ||
pers_conc = pers_conc .. '\r====' .. conc .. '====\r' | pers_conc = pers_conc .. '\r====' .. conc .. '====\r' | ||
for _,rel in ipairs(rels) do | for _,rel in ipairs(rels) do | ||
pers_conc = pers_conc .. '* | pers_conc = pers_conc .. '*' .. glossaire(rel["Nature"]) .. '[[' .. rel["Prel"] .. '|→]]\n' | ||
end | end | ||
end | end | ||
Ligne 260 : | Ligne 281 : | ||
local tables = 'Pers_act, Personnes=Pa' | local tables = 'Pers_act, Personnes=Pa' | ||
local fields = 'Pa._pageName=nomA,Pers_act._pageName=Prel,Pers_act.RefBib=Ref,Pers_act.Date_debut=Debut,Pers_act.Date_fin=Fin | local fields = 'Pa._pageName=nomA,Pers_act._pageName=Prel,Pers_act.RefBib=Ref,Pers_act.Date_debut=Debut,Pers_act.Date_fin=Fin,Pers_act.Nature=Nature,Pers_act.Objet_1=Objet_1,Pers_act.Objet_2=Objet_2' | ||
local arguments = { | local arguments = { | ||
join='Pa._pageName=Pers_act.Objet_1', | join='Pa._pageName=Pers_act.Objet_1', | ||
Ligne 273 : | Ligne 294 : | ||
local relations = f.trie_relations(result,"Objet_2",langue) | local relations = f.trie_relations(result,"Objet_2",langue) | ||
for act, rels in pairs(relations) do | for act, rels in pairs(relations) do | ||
pers_act = pers_act .. '\r====' .. act .. '====\r' | pers_act = pers_act .. '\r==== « ' .. act .. ' »====\r' | ||
for _,rel in ipairs(rels) do | for _,rel in ipairs(rels) do | ||
pers_act = pers_act .. '* | pers_act = pers_act .. '*' .. glossaire(rel["Nature"]) .. '[[' .. rel["Prel"] .. '|→]]\n' | ||
end | end | ||
end | end | ||
Ligne 283 : | Ligne 304 : | ||
biographie = frame:expandTemplate({ title = "Biographie", args = P }) | biographie = frame:expandTemplate({ title = "Biographie", args = P }) | ||
localisations, confessions = '', '', '', '' | |||
if P['Localisations'] then | if P['Localisations'] then | ||
localisations = '\r===' .. t.translate('Localisations',langue) .. '===\r' .. P['Localisations'] | localisations = '\r===' .. t.translate('Localisations',langue) .. '===\r' .. P['Localisations'] | ||
Ligne 293 : | Ligne 314 : | ||
confessions = '\r===' .. t.translate('Confessions',langue) .. '===\r' .. P['Confessions'] | confessions = '\r===' .. t.translate('Confessions',langue) .. '===\r' .. P['Confessions'] | ||
end | end | ||
if | if P['Publications'] then | ||
publications = '\r===' .. t.translate('Publications',langue) .. '===\r' .. | publications = '\r===' .. t.translate('Publications',langue) .. '===\r' .. publications | ||
end | end | ||
if | if P['References'] then | ||
references = '\r==' .. t.translate('References',langue) .. '==\r' .. | references = '\r==' .. t.translate('References',langue) .. '==\r' .. references | ||
end | end | ||
page = frame:preprocess(cartouche .. biographie .. '\r==Repères==\r' .. localisations .. nationalites .. confessions .. publications .. pers_pers .. pers_inst .. pers_conc .. pers_act .. references) | page = frame:preprocess(cartouche .. biographie .. '\r==' .. t.translate('Repères',langue) .. '==\r' .. localisations .. nationalites .. confessions .. publications .. pers_pers .. pers_inst .. pers_conc .. pers_act .. references) | ||
return page | |||
return page | |||
end | end | ||
return p | return p |
Version actuelle datée du 13 octobre 2023 à 13:00
La documentation pour ce module peut être créée à Module:Personne/doc
local pagetitle = tostring(mw.title.getCurrentTitle())
--bib = mw.ext.cargo.query('Zotero', '_pageName, ZoteroKey, TitleItem, Author, Editor, Date, Date__precision, Place, ItemType, Publisher, PublicationTitle, Volume, PublicationYear, Pages, Url, FilingDate, AccessDate, Type, Number, IssuingAuthority',{groupBy = 'ZoteroKey', orderBy = 'ZoteroKey', limit = 4000})
--bbib={}
local p = {}
function p.main(frame)
f = require("Module:Fonctions")
t = require("Module:Translate")
fo = require("Module:Fo")
--fo = mw.loadData("Module:Fo")
local P, refer = {}, {}
local publications, references, sources, pers_pers, pers_inst, pers_act, pers_conc='','','','','','',''
local strong_links={"directeur_de_these","superieur_hierarchique","inf_hier","disciple","evaluateur","evalue_par","student","teacher"}
local langue = frame:preprocess("{{int:lang}}")
local lang = mw.getLanguage( langue )
-- Données personnelles
for field, value in pairs(frame.args) do
P[field] = value
end
local frise = '<itimeline min="' .. f.dateAdd(P["Naissance"],-5) .. '" max="' .. f.dateAdd(P["Deces"],5) .. '">"\n'
for key,field in ipairs({'Naissance','Deces','Exercice_medecine','Annee_these','Exam','Date_capture'}) do
frise = frise .. f.dateFrise(P[field]) .. '|' .. t.translate('Personnel',langue) .. '|' .. t.translate(field,langue) .. '\n'
P[field] = f.afficheDate(lang, P[field])
end
for _,rr in ipairs(mw.text.split(P['RefPers'],'#')) do
fo.tableRef(rr,refer)
--ref = mw.text.split(rr,'+')
--if ref[3] then
-- if not refer[ref[3]] then refer[ref[3]] = '' end
-- refer[ref[3]] = refer[ref[3]] .. fo.modelRef(ref[1],ref[2],ref[3])
--end
end
publications = fo.splitTextRP(P['Publications'])
references = fo.splitTextRP(P['References'])
-- P['Publications'] = P['Publications']:gsub("%s*#%s*","#")
-- for _,rr in ipairs(mw.text.split(P['Publications'],'#')) do
-- publications = publications .. fo.modelRefPub(mw.text.split(rr,'+'))
-- end
-- P['References'] = P['References']:gsub("%s*#%s*","#")
-- for _,rr in ipairs(mw.text.split(P['References'],'#')) do
-- references = references .. fo.modelRefPub(mw.text.split(rr,'+'))
-- end
--Nationalités, Localisations, Confessions
local tables = 'Nationalites'
local fields = 'Date_debut=Debut,Date_debut__precision=DebutP,Date_fin=Fin,Date_fin__precision=FinP, Nationalite'
local arguments = {
where='Date_debut IS NOT NULL AND Date_fin IS NOT NULL AND Objet="' .. string.gsub(pagetitle,' ','_') .. '"',
groupBy='Nationalite,Debut,Fin',
orderBy='Debut,Fin,Nationalite',
intro=''
}
local result = mw.ext.cargo.query(tables, fields, arguments)
if next(result) then
for _, car in pairs(result) do
frise = frise .. f.dateFrise(car["Debut"]) .. '/' .. f.dateFrise(car["Fin"]).. '|' .. t.translate("Personnel",langue) .. '|[[' .. car["Nationalite"] .. ']]\n'
end
end
local tables = 'Confessions'
local fields = 'Date_debut=Debut,Date_debut__precision=DebutP,Date_fin=Fin,Date_fin__precision=FinP, Confession'
local arguments = {
where='Date_debut IS NOT NULL AND Date_fin IS NOT NULL AND Objet="' .. string.gsub(pagetitle,' ','_') .. '"',
groupBy='Confession,Debut,Fin',
orderBy='Debut,Fin,Confession',
intro=''
}
local result = mw.ext.cargo.query(tables, fields, arguments)
if next(result) then
for _, car in pairs(result) do
frise = frise .. f.dateFrise(car["Debut"]) .. '/' .. f.dateFrise(car["Fin"]).. '|' .. t.translate('Personnel',langue) .. '|[[' .. car["Confession"] .. ']]\n'
end
end
local tables = 'Localisations'
local fields = 'Date_debut=Debut,Date_debut__precision=DebutP,Date_fin=Fin,Date_fin__precision=FinP, Pays, Ville, Coordonnees'
local arguments = {
where='Date_debut IS NOT NULL AND Date_fin IS NOT NULL AND Objet="' .. string.gsub(pagetitle,' ','_') .. '"',
groupBy='Pays,Ville,Coordonnees,Debut,Fin',
orderBy='Debut,Fin,Pays,Ville,Coordonnees',
intro=''
}
local result = mw.ext.cargo.query(tables, fields, arguments)
if next(result) then
for _, car in pairs(result) do
if car.Ville or car.Pays then
if car.Ville and car.Pays then
lieu = car.Ville .. ' (' .. car.Pays .. ')'
else lieu = car.Ville or car.Pays
end
if car.Coordonnees then
lieu = '[http://www.google.com/maps/place/' .. string.gsub(car.Coordonnees,'%s+','') .. ' ' .. lieu .. ']'
end
frise = frise .. f.dateFrise(car["Debut"]) .. '/' .. f.dateFrise(car["Fin"]).. '|'.. t.translate('Localisations',langue) .. '|' .. lieu ..'\n'
end
end
end
-- Relations personnes/personnes
local tables = 'Pers_pers'
local fields = '_pageName=Prel,RefBib=Ref,Date_debut=Debut,Date_debut__precision=DebutP,Date_fin=Fin,Date_fin__precision=FinP,Nature=Nature,Objet_1,Objet_2'
local arguments = {
where='Objet_1 IS NOT NULL and Objet_2 IS NOT NULL and (Objet_1="' .. pagetitle .. '" or Objet_2="' .. pagetitle .. '")',
groupBy='Nature,Objet_1,Objet_2,Debut,Fin',
orderBy='Nature,Debut,Fin',
intro=''
}
local result = mw.ext.cargo.query(tables, fields, arguments)
if next(result) then
pers_pers = '\r==={{int:Template-Relations}}===\r'
local relations = f.trie_relations(result,"Nature",langue,{["directeur_de_these"]="disciple",["superieur_hierarchique"]="inf_hier",["evaluateur"]="evalue_par",["student"]="teacher"})
for nat, rels in pairs(relations) do
pers_pers = pers_pers .. '\r====' .. t.translate(nat,langue) .. '====\r'
for _,rel in ipairs(rels) do
local pp = '* [[' .. rel["Objet_2"] .. ']] (' .. f.afficheDate(lang,rel["Debut"],rel["DebutP"]) .. ' - ' .. f.afficheDate(lang,rel["Fin"],rel["FinP"]) .. ')' .. '[[' .. rel["Prel"] .. '|→]]\n'
pers_pers = pers_pers .. pp
end
end
end
function glossaire(v)
local user,pf = frame:preprocess("{{CURRENTLOGGEDUSER}}")
if user == 'L.strappazon' or user == 'Emmanuel.nuss' or user == 'Loic.lutz' then
pf = '[[def:' .. v .. '|' .. v .. ']], '
else
pf = '{{#tip-text:' .. v .. '|{{def:' .. v .. '}} }}, '
end
return pf
end
local fields = {'Profession','Titre','Specialite','Profession_pere','Profession_mere'}
for _,field in ipairs(fields) do
if #P[field] > 0 then
local pf = ''
for _,v in ipairs(mw.text.split(P[field],';')) do
--pf = pf .. '{{#tip-text:' .. v .. '|{{def:' .. v .. '}} }}, '
pf = pf .. glossaire(v)
end
P[field] = mw.text.trim(pf,', ')
end
end
local fields = {'Prenom','Nom','Sexe','Naissance','Lieu_de_naissance','Deces','Lieu_de_deces','These','Exam','Dir_these','Annee_these','Lieu_these','Exercice_medecine','Profession','Nationalites','Titre','Identites','Specialite'}
for _,field in ipairs(fields) do
if #P[field] > 0 and refer[field] then
P[field] = P[field] .. refer[field]
end
end
if #P.Lieu_de_naissance > 1 then
P.Naissance = P.Naissance .. ' (' .. t.translate(P.Lieu_de_naissance,langue) .. ')'
end
if #P.Lieu_de_deces > 1 then
P.Deces = P.Deces .. ' (' .. t.translate(P.Lieu_de_deces,langue) .. ')'
end
if #P.These > 1 then
if #P.Lieu_these > 1 or #P.Annee_these > 1 then
P.These = P.These .. ' ('
if #P.Lieu_these > 1 then
P.These = P.These .. P.Lieu_these
if #P.Annee_these > 1 then
P.These = P.These .. ', '
end
end
if #P.Annee_these > 1 then
P.These = P.These .. t.translate(P.Annee_these,langue)
end
P.These = P.These .. ')'
end
end
local cartouche_fields = {'Prenom','Nom','Sexe','Naissance','Deces','Profession_pere','Profession_mere','These','Exam','Dir_these','Exercice_medecine','Profession','Nationalite','Titre','Identites','Specialite'}
local cartouche= '{| class="cartouche" \n! style=\"text-align: center; background-color:#cccccc;\" colspan=\"2\" |<big>' .. P.Prenom .. ' ' .. P.Nom .. '</big>\n|-\n'
if #P.Image > 1 then
cartouche= cartouche .. '|colspan=\"2\"|[[Fichier:' .. P.Image .. '|360px|center|border|' .. P.Prenom .. ' ' .. P.Nom .. ']]<br>\n|-'
end
for _,label in ipairs(cartouche_fields) do
if #P[label] > 0 then
cartouche= cartouche.. '\n!'.. t.translate(label,langue) .. '\n|height=\"25\"|' .. P[label] .. '\n|-\n|-\n'
end
end
cartouche= cartouche.. '|}<div align="left">__TOC__</div>'
--local text_fields, langs = {'Resume','Contexte','Commentaire'}, {[1] = langue, [2] = 'en', [3] = 'fr',[4] = 'de'}
-- Relations personnes/institutions
local tables = 'Pers_inst, Personnes=Pa'
local fields = 'Pa._pageName=nomA,Pers_inst._pageName=Prel,Pers_inst.RefBib=Ref,Date_debut=Debut,Date_debut__precision=DebutP,Pers_inst.Date_fin=Fin,Date_fin__precision=FinP,Pers_inst.Nature=Nature,Pers_inst.Objet_1=Objet_1,Pers_inst.Objet_2=Objet_2'
local arguments = {
join='Pa._pageName=Pers_inst.Objet_1',
where='Date_debut IS NOT NULL and Date_fin IS NOT NULL and Pers_inst.Objet_2 IS NOT NULL and Pa._pageName=Pers_inst.Objet_1 and Pers_inst.Objet_1="' .. pagetitle .. '" ',
groupBy='Pers_inst.Nature,nomA,Pers_inst.Objet_2,Debut,Fin',
orderBy='Debut,Fin,Pers_inst.Nature,nomA,Pers_inst.Objet_2',
intro=''
}
local result = mw.ext.cargo.query(tables, fields, arguments)
arguments.where='Pers_inst.Objet_2 IS NOT NULL and Pa._pageName=Pers_inst.Objet_1 and Pers_inst.Objet_1="' .. pagetitle .. '" '
local result2 = mw.ext.cargo.query(tables, fields, arguments)
--[=
if next(result2) then
pers_inst = '\r=={{int:Template-Liens_institutions}}==\r'
local relations = f.trie_relations(result2,"Objet_2",langue)
for inst, rels in pairs(relations) do
pers_inst = pers_inst .. '\r===' .. inst .. '===\r'
for _,rel in ipairs(rels) do
pers_inst = pers_inst .. '* [[' .. rel["Nature"] .. ']]' .. '[[' .. rel["Prel"] .. '|→]]\n'
end
end
end
--[==[
--]=]
if next(result) then
pers_inst = '\r==={{int:Template-Liens_institutions}}===\r'
pers_inst = pers_inst .. "<table class='wikitable'>"
local relations = f.trie_relations(result,"Objet_2",langue)
local n = 1
for inst, rels in pairs(relations) do
pers_inst = pers_inst .. "<tr><td>" .. tostring(n) .. "</td><td>" .. inst .. "</td><td><table width=100%>"
for _,rel in ipairs(rels) do
--pers_inst = pers_inst .. '<tr><td>' .. '[[Def:' .. rel["Nature"] .. '|' .. rel["Nature"] .. ']]' .. '</td><td>' .. f.afficheDate(lang,rel["Debut"]) .. ' - ' .. f.afficheDate(lang,rel["Fin"]) .. '</td><td style="text-align:right;"> [[' .. rel["Prel"] .. '|→]]</td></tr>'
pers_inst = pers_inst .. '<tr><td>' .. glossaire(rel["Nature"]) .. '</td><td>' .. f.afficheDate(lang,rel["Debut"],rel["DebutP"]) .. ' - ' .. f.afficheDate(lang,rel["Fin"],rel["FinP"]) .. '</td><td style="text-align:right;"> [[' .. rel["Prel"] .. '|→]]</td></tr>'
end
pers_inst = pers_inst .. "</table></td></tr>"
n = n+1
end
pers_inst = pers_inst .. "</table>"
end
--]==]
--f.afficheDate(lang,rel["Debut"],rel["DebutP"])
if next(result) then
local relations = f.trie_relations(result,"Objet_2",langue)
for inst, rels in pairs(relations) do
for _,rel in ipairs(rels) do
frise = frise .. rel["Debut"] .. '/' .. rel["Fin"] .. '|' .. t.translate('Carrière',langue) .. '|[[' .. inst .. ']], ' .. glossaire(rel["Nature"]) .. '[[' .. rel["Prel"] .. '|→]] \n'
end
end
end
frise = frise .. '</itimeline>'
pers_inst = pers_inst .. '\n' .. frise
-- Relations personnes/concepts
local tables = 'Pers_conc, Personnes=Pa'
local fields = 'Pa._pageName=nomA,Pers_conc._pageName=Prel,Pers_conc.RefBib=Ref,Pers_conc.Date_debut=Debut,Pers_conc.Date_fin=Fin,Pers_conc.Nature=Nature,Pers_conc.Objet_1=Objet_1,Pers_conc.Objet_2=Objet_2'
local arguments = {
join='Pa._pageName=Pers_conc.Objet_1',
where='Pers_conc.Objet_2 IS NOT NULL and Pa._pageName=Pers_conc.Objet_1 and Pers_conc.Objet_1="' .. pagetitle .. '"',
groupBy='Pers_conc.Nature,nomA,Pers_conc.Objet_2',
orderBy='Pers_conc.Nature,Debut,Fin,nomA,Pers_conc.Objet_2',
intro=''
}
local result = mw.ext.cargo.query(tables, fields, arguments)
if next(result) then
pers_conc = '\r==={{int:Template-Liens_concepts}}===\r'
local relations = f.trie_relations(result,"Objet_2",langue)
for conc, rels in pairs(relations) do
pers_conc = pers_conc .. '\r====' .. conc .. '====\r'
for _,rel in ipairs(rels) do
pers_conc = pers_conc .. '*' .. glossaire(rel["Nature"]) .. '[[' .. rel["Prel"] .. '|→]]\n'
end
end
end
-- Relations personnes/actions
local tables = 'Pers_act, Personnes=Pa'
local fields = 'Pa._pageName=nomA,Pers_act._pageName=Prel,Pers_act.RefBib=Ref,Pers_act.Date_debut=Debut,Pers_act.Date_fin=Fin,Pers_act.Nature=Nature,Pers_act.Objet_1=Objet_1,Pers_act.Objet_2=Objet_2'
local arguments = {
join='Pa._pageName=Pers_act.Objet_1',
where='Pers_act.Objet_2 IS NOT NULL and Pa._pageName=Pers_act.Objet_1 and Pers_act.Objet_1="' .. pagetitle .. '"',
groupBy='Pers_act.Nature,nomA,Pers_act.Objet_2',
orderBy='Pers_act.Nature,Debut,Fin,nomA,Pers_act.Objet_2',
intro=''
}
local result = mw.ext.cargo.query(tables, fields, arguments)
if next(result) then
pers_act = '\r==={{int:Template-Liens_actions}}===\r'
local relations = f.trie_relations(result,"Objet_2",langue)
for act, rels in pairs(relations) do
pers_act = pers_act .. '\r==== « ' .. act .. ' »====\r'
for _,rel in ipairs(rels) do
pers_act = pers_act .. '*' .. glossaire(rel["Nature"]) .. '[[' .. rel["Prel"] .. '|→]]\n'
end
end
end
--cartouche = frame:expandTemplate({ title = "Cartouche", args = P})
biographie = frame:expandTemplate({ title = "Biographie", args = P })
localisations, confessions = '', '', '', ''
if P['Localisations'] then
localisations = '\r===' .. t.translate('Localisations',langue) .. '===\r' .. P['Localisations']
end
if P['Nationalites'] then
nationalites = '\r===' .. t.translate('Nationalites',langue) .. '===\r' .. P['Nationalites']
end
if P['Confessions'] then
confessions = '\r===' .. t.translate('Confessions',langue) .. '===\r' .. P['Confessions']
end
if P['Publications'] then
publications = '\r===' .. t.translate('Publications',langue) .. '===\r' .. publications
end
if P['References'] then
references = '\r==' .. t.translate('References',langue) .. '==\r' .. references
end
page = frame:preprocess(cartouche .. biographie .. '\r==' .. t.translate('Repères',langue) .. '==\r' .. localisations .. nationalites .. confessions .. publications .. pers_pers .. pers_inst .. pers_conc .. pers_act .. references)
return page
end
return p