« Module:Portail » : différence entre les versions

De Les Archives de Vault-Tec
Kharmitch (discussion | contributions)
Page créée avec « local p = {} local outils = require 'Module:Outils' -- Génére la liste d'un thème pour le contenu de portail jeu function p.themeContentGame(frame) local parentframe... »
 
Kharmitch (discussion | contributions)
Suppression du legacy
Balise : Contenu remplacé
 
(3 versions intermédiaires par 2 utilisateurs non affichées)
Ligne 1 : Ligne 1 :
local p = {}
local p = {}
local outils = require 'Module:Outils'


-- Génére la liste d'un thème pour le contenu de portail jeu
------------------------------------------------------
function p.themeContentGame(frame)
-- Fonctions communes
local parentframe = frame:getParent()
------------------------------------------------------
local image = outils.trim(parentframe.args.image) or 'Icon question.png'
local title = outils.trim(parentframe.args.titre) or 'Titre ?'
if image == '' then image = 'Icon question.png' end
if title == '' then title = 'Titre ?' end
table.remove(parentframe.args, 0)
table.remove(parentframe.args, 1)
local res = mw.html.create('ul')
res
:tag('li')
:tag('span'):wikitext('[[Fichier:' .. image .. '|x30px|link=|alt=' .. title .. ']]'):done()
:tag('span'):wikitext(title):done()
:done()
for index, object in ipairs(parentframe.args) do
    res
:tag('li')
:wikitext(outils.trim(object))
:done()
end
res:done()
return res
end


-- Contenu de portail jeu
function getArgs(frame)
function p.contentGame(frame)
local args = {}
local parentframe = frame:getParent()
local argsParent = frame:getParent().args
local res = mw.html.create('div')
for cle, val in pairs(argsParent) do
res:addClass('portal-game-content')
if val then
for index, theme in ipairs(parentframe.args) do
args[cle] = mw.text.trim(val)
res:node(theme)
end
end
end
res:done()
return args
return res
end
end


-- Liste des portails jeux
------------------------------------------------------
function p.portalsList(frame)
-- p._
local res = mw.html.create('div')
------------------------------------------------------
res
:addClass('liste-portails')
:tag('ul')
:tag('li')
:tag('span')
:wikitext('[[Fichier:FO1Logo.png|90x60px|link=Portail:Fallout]]')
:done()
:tag('span')
:wikitext('\'\'[[Portail:Fallout|Fallout]]\'\'')
:done()
:done()
:tag('li')
:tag('span')
:wikitext('[[Fichier:Logo Fallout2.png|90x60px|link=Portail:Fallout 2]]')
:done()
:tag('span')
:wikitext('\'\'[[Portail:Fallout 2|Fallout 2]]\'\'')
:done()
:done()
:tag('li')
:tag('span')
:wikitext('[[Fichier:Fallout 3 logo.png|90x60px|link=Portail:Fallout 3]]')
:done()
:tag('span')
:wikitext('\'\'[[Portail:Fallout 3|Fallout 3]]\'\'')
:done()
:done()
:tag('li')
:tag('span')
:wikitext('[[Fichier:Logo fnv.png|90x60px|link=Portail:Fallout: New Vegas]]')
:done()
:tag('span')
:wikitext('\'\'[[Portail:Fallout: New Vegas|Fallout: New Vegas]]\'\'')
:done()
:done()
:tag('li')
:tag('span')
:wikitext('[[Fichier:300px-Fallout 4 logo.png|90x60px|link=Portail:Fallout 4]]')
:done()
:tag('span')
:wikitext('\'\'[[Portail:Fallout 4|Fallout 4]]\'\'')
:done()
:done()
:done()
:tag('ul')
:tag('li')
:tag('span')
:wikitext('[[Fichier:FO76 Logo.png|90x60px|link=Portail:Fallout 76]]')
:done()
:tag('span')
:wikitext('\'\'[[Portail:Fallout 76|Fallout 76]]\'\'')
:done()
:done()
:tag('li')
:tag('span')
:wikitext('[[Fichier:Tactics_Logo.png|90x60px|link=Portail:Fallout Tactics]]')
:done()
:tag('span')
:wikitext('\'\'[[Portail:Fallout Tactics|Fallout Tactics]]\'\'')
:done()
:done()
:tag('li')
:tag('span')
:wikitext('[[Fichier:Fallout Shelter logo.png|90x60px|link=Portail:Fallout Shelter]]')
:done()
:tag('span')
:wikitext('\'\'[[Portail:Fallout Shelter|Fallout Shelter]]\'\'')
:done()
:done()
:tag('li')
:tag('span')
:wikitext('[[Fichier:Logo FOV.png|90x60px|link=Van Buren]]')
:done()
:tag('span')
:wikitext('\'\'[[Van Buren|Van Buren]]\'\'')
:done()
:done()
:tag('li')
:tag('span')
:wikitext('[[Fichier:PV13.png|90x60px|link=Project V13]]')
:done()
:tag('span')
:wikitext('\'\'[[Project V13|Project V13]]\'\'')
:done()
:done()
:done()
:done()
return res
end


-- Liste des portails thématiques
function p._buildGameContentGroup(args)
function p.thematicPortals(frame)
local items = mw.html.create( 'ul' )
local res = mw.html.create('div')
res
for i, item in ipairs(args) do
:addClass('portal-thematic')
items :tag( 'li' ):wikitext( item ):done()
:tag('dl')
end
:tag('dd')
:tag('span'):wikitext('[[Fichier:Centaure anime.gif|x30px|link=|alt=Créature]]'):done()
:tag('span'):wikitext('[[:Catégorie:Créatures|Créatures]] et [[:Catégorie:Robots et ordinateurs|robots]]'):done()
:done()
:tag('dd')
:tag('span'):wikitext('[[Fichier:Fnv Grands Khans symbole.png|x30px|link=|alt=Grands Khans]]'):done()
:tag('span'):wikitext('[[:Catégorie:Factions|Factions]]'):done()
:done()
:tag('dd')
:tag('span'):wikitext('[[Fichier:Fo1 Cimetière carte.png|x30px|link=|alt=Cimetière]]'):done()
:tag('span'):wikitext('[[:Catégorie:Lieux|Lieux]]'):done()
:done()
:tag('dd')
:tag('span'):wikitext('[[Fichier:Superarmure fo1.gif|x30px|link=|alt=Super Armure]]'):done()
:tag('span'):wikitext('[[:Catégorie:Objets|Objets]]'):done()
:done()
:tag('dd')
:tag('span'):wikitext('[[Fichier:Ian.png|x30px|link=|alt=Ian]]'):done()
:tag('span'):wikitext('[[Personnage]]s'):done()
:done()
:tag('dd')
:tag('span'):wikitext('[[Fichier:Fo puce eau.gif|x30px|link=|alt=Puce d\'eau]]'):done()
:tag('span'):wikitext('[[Quête]]s'):done()
:done()
:done()
:tag('dl')
:tag('dt')
:tag('span'):wikitext('[[Fichier:Fo3 SPECIAL book cover.png|x30px|link=|alt=SPECIAL]]'):done()
:tag('span'):wikitext('[[SPECIAL]]'):done()
:done()
:tag('dd')
:tag('span'):wikitext('[[Fichier:Force.png|x30px|link=|alt=Force]]'):done()
:tag('span'):wikitext('[[Statistiques principales]]'):done()
:done()
:tag('dd')
:tag('span'):wikitext('[[Fichier:Fo classe armure.png|x30px|link=|alt=Classe d\'armure]]'):done()
:tag('span'):wikitext('[[Statistiques dérivées]]'):done()
:done()
:tag('dd')
:tag('span'):wikitext('[[Fichier:Barycentre.png|x30px|link=|alt=Barycentre]]'):done()
:tag('span'):wikitext('[[Compétence]]s'):done()
:done()
:tag('dd')
:tag('span'):wikitext('[[Fichier:Sanguinaire.png|x30px|link=|alt=Sanguinaire]]'):done()
:tag('span'):wikitext('[[Aptitude]]s'):done()
:done()
:tag('dd')
:tag('span'):wikitext('[[Fichier:Fo1_La-Poisse_bis.png|x30px|link=|alt=La Poisse]]'):done()
:tag('span'):wikitext('[[Trait]]s'):done()
:done()
:done()
:tag('dl')
:tag('dt')
:tag('span'):wikitext('[[Fichier:Esprit vif.png|x30px|link=|alt=Esprit vif]]'):done()
:tag('span'):wikitext('[[:Catégorie:Sources|Sources d\'information]]'):done()
:done()
:tag('dd')
:tag('span'):wikitext('[[Fichier:Fo electronique livre.gif|x30px|link=|alt=L\'Électronique]]'):done()
:tag('span'):wikitext('[[Document de conception|Documents de conception]]'):done()
:done()
:tag('dd')
:tag('span'):wikitext('[[Fichier:Atelier de rédaction.png|x30px|link=|alt=Atelier de rédaction]]'):done()
:tag('span'):wikitext('[[:Catégorie:Entrées de terminal|Entrées de terminal]]'):done()
:done()
:tag('dd')
:tag('span'):wikitext('[[Fichier:Fo1 Vree Neutre GP-0.gif|x30px|link=|alt=Vree]]'):done()
:tag('span'):wikitext('[[:Catégorie:Fichiers dialogue|Fichiers dialogue]]'):done()
:done()
:tag('dd')
:tag('span'):wikitext('[[Fichier:Fo holodisque.gif|x30px|link=|alt=Holodisque]]'):done()
:tag('span'):wikitext('[[Holodisques et notes]]'):done()
:done()
:tag('dd')
:tag('span'):wikitext('[[Fichier:Fo1 magnetophone.gif|x30px|link=|alt=Magnétophone]]'):done()
:tag('span'):wikitext('[[:Catégorie:Médiathèque|Ressources d\'image et de son]]'):done()
:done()
:done()
:tag('dl')
:tag('dt')
:tag('span'):wikitext('[[Fichier:Spécialité_bonus_!.png|x30px|link=|alt=Spécialité bonus !]]'):done()
:tag('span'):wikitext('En coulisse'):done()
:done()
:tag('dd')
:tag('span'):wikitext('[[Fichier:Interplay_logo.png|x30px|link=|alt=Interplay]]'):done()
:tag('span'):wikitext('[[:Catégorie:Compagnies|Compagnies]]'):done()
:done()
:tag('dd')
:tag('span'):wikitext('[[Fichier:Fo1 Icone Tim Cain.png|x30px|link=|alt=Tim Cain]]'):done()
:tag('span'):wikitext('[[:Catégorie:Développeurs|Développeurs]]'):done()
:done()
:done()
:done()
return res
items :done()
end
 
-- En-tête de l'accueil
function p.homeHeader(frame)
local res = mw.html.create('div')
res
return tostring(mw.html.create( 'div' )
:addClass('portal-home-header')
:addClass( 'liste-horizontale portal-content-group' )
:addClass('portal-color')
:tag( 'div' )
:addClass('portal-home-bckg')
:addClass( 'portal-content-group-title' )
:tag('div')
:wikitext( args.titre or 'Titre ?' )
:addClass('portal-wikistats')
:tag('span')
:wikitext('\'\'\'[[Spécial:Statistiques|' .. mw.site.stats.articles .. ']]\'\'\' articles exclusifs')
:done()
:tag('span')
:wikitext('\'\'\'' .. mw.site.stats.edits .. '\'\'\' éditions d\'articles')
:done()
:done()
:tag('span')
:addClass('portal-home-title')
:wikitext('Bienvenue sur les Archives de Vault-Tec !')
:done()
:tag('span')
:wikitext('L\'encyclopédie francophone traitant de l\'univers de Fallout dans son intégralité !')
:done()
:done()
:tag('div')
:node( items )
:addClass('portal-fogen-links')
)
:tag('span')
:wikitext('Un projet de Fallout Génération')
:done()
:tag('span')
:wikitext('[[Fichier:Bouton Facebook.png|link=https://www.facebook.com/fallout.generation|Rejoignez-nous sur Facebook !|55x55px]] [[Fichier:Logo_FoGen_Planche.png|link=http://fallout-generation.com/|Rejoignez-nous sur Fallout Génération !|150px]] [[Fichier:Bouton twitter.png|link=https://twitter.com/FalloutGen|Rejoignez-nous sur Twitter !|55x55px]]')
:done()
:done()
return res
end
end


-- En-tête de portail jeu
------------------------------------------------------
function p.gameHeader(frame)
-- p.
local parentframe = frame:getParent()
------------------------------------------------------
local name = parentframe.args['jeu'] or ''
local abstract = parentframe.args['résumé'] or ''
local logo = parentframe.args['logo'] or ''
local bckg = parentframe.args['image'] or ''
local res = mw.html.create('div')
res
:addClass('portal-game-header')
:addClass('portal-color')
:addClass(bckg)
:tag('div')
:addClass('portal-game-logo')
:wikitext('[[Fichier:' .. logo .. ']]')
:tag('span')
:addClass('portal-game-title')
:wikitext('Portail de \'\'' .. name .. '\'\'')
:done()
:tag('span')
:wikitext(abstract .. ' [[' .. name .. '|En savoir plus]]')
:done()
:done()
return res
end


-- Corps de portail
function p.buildGameContentGroup(frame) return p._buildGameContentGroup(getArgs(frame)) end
function p.body(frame)
local parentframe = frame:getParent()
local leftContent = parentframe.args['contenu de gauche'] or ''
local rightContent = parentframe.args['contenu de droite'] or ''
local res = mw.html.create('div')
res
:addClass('portal-body')
:tag('div')
:addClass('portal-body-left')
:addClass('portal-color')
:wikitext(leftContent)
:done()
:tag('div')
:addClass('portal-body-separator')
:done()
:tag('div')
:addClass('portal-body-right')
:addClass('portal-color')
:wikitext(rightContent)
:done()
:done()
return res
end


-- Cadre pour sujet
------------------------------------------------------
function p.frameBody(frame)
-- returning module
local parentframe = frame:getParent()
------------------------------------------------------
local title = parentframe.args['titre'] or ''
local image = parentframe.args['image'] or ''
local content = parentframe.args['contenu'] or ''
local res = mw.html.create('div')
res
:addClass('portal-frame')
:wikitext('__NOTOC__')
:tag('div')
:addClass('portal-frame-title')
:wikitext('[[Fichier:' .. image .. '|38px|link=|alt=' .. title .. ']]')
:tag('h2')
:wikitext(title)
:done()
:done()
:tag('div')
:addClass('portal-frame-content')
:wikitext(content)
:done()
:done()
return res
end


return p
return p

Dernière version du 21 février 2022 à 11:20

Documentation du module

Module responsable de la création des objets utilisés sur les portails.

Documentation transclues de Module:Portail/doc.
local p = {}

------------------------------------------------------
-- Fonctions communes
------------------------------------------------------

function getArgs(frame)
	local args = {}
	local argsParent = frame:getParent().args
	for cle, val in pairs(argsParent) do
		if val then
			args[cle] = mw.text.trim(val)
		end
	end
	return args
end

------------------------------------------------------
-- p._
------------------------------------------------------

function p._buildGameContentGroup(args)
	local items = mw.html.create( 'ul' )
	
	for i, item in ipairs(args) do
		items	:tag( 'li' ):wikitext( item ):done()
	end
	
	items	:done()
	
	return tostring(mw.html.create( 'div' )
		:addClass( 'liste-horizontale portal-content-group' )
		:tag( 'div' )
			:addClass( 'portal-content-group-title' )
			:wikitext( args.titre or 'Titre ?' )
			:done()
		:node( items )
	)
end

------------------------------------------------------
-- p.
------------------------------------------------------

function p.buildGameContentGroup(frame) return p._buildGameContentGroup(getArgs(frame)) end

------------------------------------------------------
-- returning module
------------------------------------------------------

return p