Autres langues
Autres actions
FR translation test |
test 3 |
||
| Ligne 1 : | Ligne 1 : | ||
local p = {} | local p = {} | ||
local function | local function est_defini (var) | ||
return not (var == nil or var == '') | return not (var == nil or var == '') | ||
end | end | ||
local function | local function italiques (var) | ||
return "''" .. var .. "''" | return "''" .. var .. "''" | ||
end | end | ||
| Ligne 12 : | Ligne 12 : | ||
local pframe = frame:getParent() | local pframe = frame:getParent() | ||
local | local Auteur = pframe.args.auteur | ||
if | if est_defini (pframe.args.journaliste) then | ||
Auteur = pframe.args.journaliste | |||
end | end | ||
local Date = pframe.args['date'] | local Date = pframe.args['date'] | ||
local | local Titre = pframe.args.titre | ||
local URL = pframe.args.url | local URL = pframe.args.url | ||
local | local Site = pframe.args.journal or pframe.args.site | ||
local | local URLArchive = pframe.args['archive-url'] | ||
local | local DateArchive = pframe.args['archive-date'] | ||
local | local Recupere = pframe.args.recupere | ||
local | local Citation = pframe.args.citation | ||
local Image = pframe.args.image | local Image = pframe.args.image | ||
local | local LegendeImage = pframe.args['legende-image'] | ||
if | local premiere_partie = "" | ||
if | |||
if est_defini (Auteur) then | |||
if est_defini (Date) then | |||
premiere_partie = Auteur .. " (" .. Date .. ")." | |||
else | |||
premiere_partie = Auteur .. "." | |||
end | end | ||
end | end | ||
if | if est_defini (Image) then | ||
local span = mw.html.create ( 'span' ) | local span = mw.html.create ( 'span' ) | ||
span | span | ||
:wikitext('[[ | :wikitext('[[Fichier:' .. Image .. '|center|300px|sans_cadre]]') | ||
local br = mw.html.create ('br', selfClosing) | local br = mw.html.create ('br', selfClosing) | ||
if | if est_defini(LegendeImage) then | ||
local | local legende = mw.html.create ('div') | ||
legende | |||
:attr("style", "text-align:center;font-size:85%;") | :attr("style", "text-align:center;font-size:85%;") | ||
:wikitext( | :wikitext(LegendeImage) | ||
premiere_partie = tostring(span) .. tostring(legende) .. premiere_partie | |||
else | |||
premiere_partie = tostring(span) .. premiere_partie | |||
end | end | ||
end | end | ||
if | local deuxieme_partie = "" | ||
if | |||
if est_defini (Titre) then | |||
if est_defini (URL) then | |||
if not | Titre = "[" .. URL .. " " .. "\"" .. Titre .. "\"" .. "]" | ||
if | end | ||
if not est_defini (Auteur) then | |||
if est_defini (Date) then | |||
Titre = Titre .. " (" .. Date .. ")." | |||
else | else | ||
Titre = Titre .. "." | |||
end | end | ||
end | |||
deuxieme_partie = Titre | |||
end | end | ||
local troisieme_partie = "" | |||
if est_defini(Site) then | |||
troisieme_partie = "''" .. Site .. "''." | |||
end | end | ||
local quatrieme_partie = "" | |||
if | if est_defini(URLArchive) then | ||
if est_defini(DateArchive) then | |||
quatrieme_partie = "[" .. URLArchive .. " " .. "Archivé" .. "]" .. " " .. "depuis l'original le" .. " " .. DateArchive .. "." | |||
else | |||
quatrieme_partie = "[" .. URLArchive .. " " .. "Archivé" .. "]" .. " depuis l'original." | |||
if | |||
end | end | ||
end | end | ||
if | local cinquieme_partie = "" | ||
if est_defini (Recupere) then | |||
cinquieme_partie = "Récupéré le" .. " " .. Recupere .. "." | |||
end | end | ||
if | if est_defini (Citation) then | ||
Citation = string.gsub(Citation,"\n","<br>") | |||
Citation = "« " .. Citation .. " »" | |||
local div = mw.html.create ('div') | local div = mw.html.create ('div') | ||
div | div | ||
:attr("style", "width:80%; margin-left:10%;") | :attr("style", "width:80%; margin-left:10%;") | ||
:wikitext( | :wikitext(Citation) | ||
local br = mw.html.create ('br', selfClosing) | local br = mw.html.create ('br', selfClosing) | ||
premiere_partie = italiques(tostring(div)) .. tostring(br) .. premiere_partie | |||
end | end | ||
if est_defini (premiere_partie) then | |||
if | premiere_partie = premiere_partie .. " " | ||
end | end | ||
if | if est_defini (deuxieme_partie) then | ||
deuxieme_partie = deuxieme_partie .. " " | |||
end | end | ||
if | if est_defini (troisieme_partie) then | ||
troisieme_partie = troisieme_partie .. " " | |||
end | end | ||
if | if est_defini (quatrieme_partie) then | ||
quatrieme_partie = quatrieme_partie .. " " | |||
end | end | ||
local Rendu = premiere_partie .. deuxieme_partie .. troisieme_partie .. quatrieme_partie .. cinquieme_partie | |||
return | return Rendu | ||
end | end | ||
return p | return p | ||
Dernière version du 15 novembre 2025 à 20:07
local p = {}
local function est_defini (var)
return not (var == nil or var == '')
end
local function italiques (var)
return "''" .. var .. "''"
end
function p.cite( frame )
local pframe = frame:getParent()
local Auteur = pframe.args.auteur
if est_defini (pframe.args.journaliste) then
Auteur = pframe.args.journaliste
end
local Date = pframe.args['date']
local Titre = pframe.args.titre
local URL = pframe.args.url
local Site = pframe.args.journal or pframe.args.site
local URLArchive = pframe.args['archive-url']
local DateArchive = pframe.args['archive-date']
local Recupere = pframe.args.recupere
local Citation = pframe.args.citation
local Image = pframe.args.image
local LegendeImage = pframe.args['legende-image']
local premiere_partie = ""
if est_defini (Auteur) then
if est_defini (Date) then
premiere_partie = Auteur .. " (" .. Date .. ")."
else
premiere_partie = Auteur .. "."
end
end
if est_defini (Image) then
local span = mw.html.create ( 'span' )
span
:wikitext('[[Fichier:' .. Image .. '|center|300px|sans_cadre]]')
local br = mw.html.create ('br', selfClosing)
if est_defini(LegendeImage) then
local legende = mw.html.create ('div')
legende
:attr("style", "text-align:center;font-size:85%;")
:wikitext(LegendeImage)
premiere_partie = tostring(span) .. tostring(legende) .. premiere_partie
else
premiere_partie = tostring(span) .. premiere_partie
end
end
local deuxieme_partie = ""
if est_defini (Titre) then
if est_defini (URL) then
Titre = "[" .. URL .. " " .. "\"" .. Titre .. "\"" .. "]"
end
if not est_defini (Auteur) then
if est_defini (Date) then
Titre = Titre .. " (" .. Date .. ")."
else
Titre = Titre .. "."
end
end
deuxieme_partie = Titre
end
local troisieme_partie = ""
if est_defini(Site) then
troisieme_partie = "''" .. Site .. "''."
end
local quatrieme_partie = ""
if est_defini(URLArchive) then
if est_defini(DateArchive) then
quatrieme_partie = "[" .. URLArchive .. " " .. "Archivé" .. "]" .. " " .. "depuis l'original le" .. " " .. DateArchive .. "."
else
quatrieme_partie = "[" .. URLArchive .. " " .. "Archivé" .. "]" .. " depuis l'original."
end
end
local cinquieme_partie = ""
if est_defini (Recupere) then
cinquieme_partie = "Récupéré le" .. " " .. Recupere .. "."
end
if est_defini (Citation) then
Citation = string.gsub(Citation,"\n","<br>")
Citation = "« " .. Citation .. " »"
local div = mw.html.create ('div')
div
:attr("style", "width:80%; margin-left:10%;")
:wikitext(Citation)
local br = mw.html.create ('br', selfClosing)
premiere_partie = italiques(tostring(div)) .. tostring(br) .. premiere_partie
end
if est_defini (premiere_partie) then
premiere_partie = premiere_partie .. " "
end
if est_defini (deuxieme_partie) then
deuxieme_partie = deuxieme_partie .. " "
end
if est_defini (troisieme_partie) then
troisieme_partie = troisieme_partie .. " "
end
if est_defini (quatrieme_partie) then
quatrieme_partie = quatrieme_partie .. " "
end
local Rendu = premiere_partie .. deuxieme_partie .. troisieme_partie .. quatrieme_partie .. cinquieme_partie
return Rendu
end
return p