« Module:Référence » : différence entre les versions

73 octets ajoutés ,  5 juillet 2021
aucun résumé des modifications
Kharmitch (discussion | contributions)
mAucun résumé des modifications
Kharmitch (discussion | contributions)
Aucun résumé des modifications
Ligne 28 : Ligne 28 :
--------------------------------------
--------------------------------------


function p._buildOneReference(args)
function p.buildOneReference(frame)
local ref = ''
local args = getArgs(frame)
 
local type = args['type']
local type = args['type']
if not type then
if not type then
Ligne 36 : Ligne 36 :
end
end
local type = type:lower()
local type = type:lower()
local attributes = {}


local name = args['nom']
local name = args['nom']
if name then
if name then
ref = '<ref name="' .. name .. '">'
attributes['name'] = name
else
ref = '<ref>'
end
end
local group = args['groupe']
if group then
attributes['group'] = group
end
local content = ''
local lang = args['langue'] or 'fr'
local lang = args['langue'] or 'fr'


Ligne 62 : Ligne 68 :
local character2 = args['personnage2'] or 'personnage2 ?'
local character2 = args['personnage2'] or 'personnage2 ?'


ref = ref .. 'Conversation entre ' .. character1 .. ' et ' .. character2 .. ' :'
content = content .. 'Conversation entre ' .. character1 .. ' et ' .. character2 .. ' :'
ref = ref .. '<br/>'
content = content .. '<br/>'
for i = 1, 6 do
for i = 1, 6 do
local sentence = args['phrase' .. i]
local sentence = args['phrase' .. i]
if sentence then
if sentence then
ref = ref .. '— ' .. formatSentence(sentence, lang) .. '<br/>'
content = content .. '— ' .. formatSentence(sentence, lang) .. '<br/>'
else
else
break
break
Ligne 76 : Ligne 82 :
local file = args['fichier'] or 'fichier ?'
local file = args['fichier'] or 'fichier ?'


ref = ref .. 'Extrait du fichier ' .. file .. ', ' .. game
content = content .. 'Extrait du fichier ' .. file .. ', ' .. game
elseif type == 'document' then
elseif type == 'document' then
local quotation = args['citation']
local quotation = args['citation']
if quotation then
if quotation then
ref = ref .. '«&nbsp;' .. formatSentence(quotation, lang) .. '&nbsp;»<br/>'
content = content .. '«&nbsp;' .. formatSentence(quotation, lang) .. '&nbsp;»<br/>'
end
end


Ligne 89 : Ligne 95 :
local page = args['page'] or 'page ?'
local page = args['page'] or 'page ?'
ref = ref .. author .. '. \'\'' .. document .. '\'\'. ' .. publisher .. ', ' .. date .. '. pp. ' .. page
content = content .. author .. '. \'\'' .. document .. '\'\'. ' .. publisher .. ', ' .. date .. '. pp. ' .. page
end
end


ref = ref .. '</ref>'
return frame:extensionTag( 'ref', content, attributes )
 
return ref
end
 
function p.buildOneReference(frame)
local args = getArgs(frame)
return p._buildOneReference(args)
end
end


return p
return p
Bureaucrate, commentadmin, emailconfirmed, Administrateurs d’interface, staff, Administrateur
62 734

modifications