Version actuelle |
Votre texte |
Ligne 15 : |
Ligne 15 : |
| local yesno = require('Module:yesno') | | local yesno = require('Module:yesno') |
| local class = mw.loadData('Module:Bandeau/Class') | | local class = mw.loadData('Module:Bandeau/Class') |
− | local moduleEbauche = 'Module:Bandeau/Ébauche' | + | -- local paramEbauche = mw.loadData('Module:Bandeau/Ébauche') -- ne sera chargé que pour un bandeau d'ébauche. |
− | -- local paramEbauche = mw.loadData(moduleEbauche) -- ne sera chargé que pour un bandeau d'ébauche.
| + | |
| | | |
| local cfg = { | | local cfg = { |
Ligne 64 : |
Ligne 63 : |
| cells = mw.html.create('div') | | cells = mw.html.create('div') |
| :addClass('bandeau-centrer') | | :addClass('bandeau-centrer') |
− | elseif trim(args.droite) then
| |
− | cells = mw.html.create('div')
| |
− | :css{ display = 'table', width = '100%' }
| |
| end | | end |
| if icone and backgroundIcone == '' then | | if icone and backgroundIcone == '' then |
Ligne 84 : |
Ligne 80 : |
| :tag('div') | | :tag('div') |
| :addClass('bandeau-cell bandeau-icone') | | :addClass('bandeau-cell bandeau-icone') |
| + | :cssText(args.styleImage) --Provisoire |
| :wikitext(iconeWiki) | | :wikitext(iconeWiki) |
| :done() | | :done() |
Ligne 92 : |
Ligne 89 : |
| :tag('div') | | :tag('div') |
| :addClass('bandeau-cell ' .. backgroundIcone) | | :addClass('bandeau-cell ' .. backgroundIcone) |
| + | :cssText(args.styleTexte) --Provisoire |
| :wikitext(texte) | | :wikitext(texte) |
| :newline() | | :newline() |
| :done() | | :done() |
− | if trim(args.droite) then
| |
− | cells
| |
− | :tag('div')
| |
− | :addClass('bandeau-cell')
| |
− | :css( 'padding-left', '1em' )
| |
− | :newline()
| |
− | :wikitext(args.droite)
| |
− | :done()
| |
− | end
| |
| | | |
| res :node(cells) | | res :node(cells) |
| + | |
| if trim(args['supplément']) then | | if trim(args['supplément']) then |
| res :tag('p') | | res :tag('p') |
Ligne 111 : |
Ligne 101 : |
| :done() | | :done() |
| end | | end |
| + | |
| return tostring(res) | | return tostring(res) |
| end | | end |
Ligne 169 : |
Ligne 160 : |
| end | | end |
| | | |
− | -- fonction qui inverse la casse du premier caractère d'une chaine
| + | p['_ébauche'] = function (args) |
− | local function inverserCasse( str )
| + | local paramEbauche = mw.loadData('Module:Bandeau/Ébauche') |
− | if type( str ) == 'string' then | + | local ebauches, gestionErreur = {}, {} |
− | local premierCar = mw.ustring.sub( str, 1, 1 )
| + | local frame = mw.getCurrentFrame() |
− | if mw.ustring.lower( premierCar ) == premierCar then
| + | local parametres = { |
− | return mw.ustring.upper( premierCar ) .. mw.ustring.sub( str, 2 )
| + | icone = 'icône', |
− | else | + | sujet = 'sujet', |
− | return mw.ustring.lower( premierCar ) .. mw.ustring.sub( str, 2 )
| + | selon = 'selon', |
− | end | + | categ = 'catégorie', |
− | end
| + | type = 'type', |
− | end
| + | message = 'message' |
− | | + | } |
− | -- fonction qui récupètre la ou les tables d'ébauche correspondant au thème
| + | local getEbaucheTable = function( theme ) |
− | local function getEbaucheTable( paramEbauche, theme, feminin )
| + | -- récupére les paramètres lié au theme, à partir du module:Bandeau/Ébauche ou du modèle:Ébauche/paramètres theme |
− | -- suprime les marques de direction ltr
| + | local modele = 'Modèle:Ébauche/paramètres ' .. theme |
− | theme = theme:gsub( '\226\128\142', '' ):gsub( '_', ' ' )
| + | local params |
− | -- récupére les paramètres lié au theme, à partir du module:Bandeau/Ébauche
| + | local themeMaj = mw.language.getContentLanguage():ucfirst(theme) |
− | local params = {}
| + | if paramEbauche[themeMaj] then |
− | local ebauche = paramEbauche[ theme ] or paramEbauche[ inverserCasse( theme ) ]
| + | params = { nom = theme } |
− | if not ebauche and theme:find( ' ' ) then
| + | for n, v in pairs(paramEbauche[themeMaj]) do |
− | -- teste si l'un des mots du thème correspond à un adjectif existant | + | params[n] = v |
− | for adj in theme:gmatch( ' ([^ ]+)' ) do
| + | |
− | paramsAdj = getEbaucheTable( paramEbauche, adj, feminin ) | + | |
− | if paramsAdj and paramsAdj.adjectif == true then
| + | |
− | local nom = theme:gsub( ' ' .. adj:gsub( '(%p)', '%%%1'), '' )
| + | |
− | params = getEbaucheTable( paramEbauche, nom, feminin )
| + | |
− | if params then | + | |
− | return params, paramsAdj
| + | |
− | end
| + | |
| end | | end |
− | end | + | elseif mw.title.new( modele ).exists then |
− | -- aucun mot ne correspond à un adjectif, on essait une autre methode pour trouver une correspondance avec plusieurs mots
| + | params = { nom = theme } |
− | if theme:find( ' .+ ' ) then
| + | for n, v in pairs(parametres) do |
− | for adj, paramsAdj in pairs( paramEbauche ) do | + | local param = frame:expandTemplate{title = modele, args = {v}} |
− | if paramsAdj.adjectif == true and theme:find( ' ' .. adj, 2, true ) then | + | params[n] = trim(param) |
− | local nom = theme:gsub( ' ' .. adj:gsub( '(%p)', '%%%1'), '' )
| + | |
− | params = getEbaucheTable( paramEbauche, nom, feminin )
| + | |
− | if params then
| + | |
− | return params, paramsAdj
| + | |
− | end
| + | |
− | end
| + | |
| end | | end |
| end | | end |
| + | return params |
| end | | end |
− | if feminin and ebauche and ebauche.feminin then | + | local ebaucheParam = function( i, param ) |
− | ebauche = paramEbauche[ ebauche.feminin ] | + | -- foction qui retourne la valeur de param pour l'ébauche i, ou une valeur par défaut. |
| + | return ebauches[i] and ebauches[i][param] or paramEbauche[''][param] |
| end | | end |
− | if ebauche then
| |
− | for n, v in pairs( ebauche ) do
| |
− | params[ n ] = v
| |
− | end
| |
− | else
| |
− | params = nil
| |
− | end
| |
− | return params, nil
| |
− | end
| |
− | p.getEbaucheTable = getEbaucheTable
| |
− |
| |
− | local function femininFromWikidata()
| |
− | local entity = mw.wikibase.getEntity()
| |
− | if entity then
| |
− | local p31 = entity:getBestStatements( 'P31' )
| |
− | local estHumain = type( p31 ) == 'table'
| |
− | and #p31 == 1
| |
− | and type( p31[ 1 ].mainsnak ) == 'table'
| |
− | and type( p31[ 1 ].mainsnak.datavalue ) == 'table'
| |
− | and type( p31[ 1 ].mainsnak.datavalue.value ) == 'table'
| |
− | and p31[ 1 ].mainsnak.datavalue.value['numeric-id'] == 5
| |
− | local p21 = entity:getBestStatements( 'P21' )
| |
− | local estFeminin = type( p21 ) == 'table'
| |
− | and #p21 == 1
| |
− | and type( p21[ 1 ].mainsnak ) == 'table'
| |
− | and type( p21[ 1 ].mainsnak.datavalue ) == 'table'
| |
− | and type( p21[ 1 ].mainsnak.datavalue.value ) == 'table'
| |
− | and p21[ 1 ].mainsnak.datavalue.value['numeric-id'] == 6581072
| |
− | return estHumain, estFeminin
| |
− | end
| |
− | return false, false
| |
− | end
| |
− |
| |
− | p['_ébauche'] = function ( args )
| |
− | local paramEbauche = mw.loadData( moduleEbauche )
| |
− | local page = mw.title.getCurrentTitle()
| |
− | local ebauches, gestionErreur = {}, {}
| |
− | local humain, feminin = femininFromWikidata()
| |
− | feminin = yesno( args["féminin"], true ) or feminin
| |
− | local estFeminin
| |
| | | |
− | -- fonction qui retourne la valeur de param pour l'ébauche i, ou une valeur par défaut | + | for i, theme in ipairs(args) do |
− | local ebaucheParam = function( i, param )
| + | -- récupération des paramètres de tous les thèmes |
− | return ebauches[ i ] and ebauches[ i ][ param ] or paramEbauche[''][ param ] | + | theme = trim(theme) |
− | end
| + | |
− | | + | |
− | -- récupération des paramètres de tous les thèmes
| + | |
− | for i, theme in ipairs( args ) do
| + | |
− | theme = trim( theme ) | + | |
| if theme then | | if theme then |
− | local t, tAdj = getEbaucheTable( paramEbauche, theme, feminin ) | + | local t = getEbaucheTable(theme) |
| if t then | | if t then |
− | table.insert( ebauches, t ) | + | table.insert(ebauches, t) |
− | table.insert( ebauches, tAdj )
| + | |
| else | | else |
| table.insert( | | table.insert( |
| gestionErreur, | | gestionErreur, |
− | erreur( theme, cfg.erreurEbaucheParam, 'div' ) | + | erreur(theme, cfg.erreurEbaucheParam, 'div') |
| ) | | ) |
| end | | end |
Ligne 279 : |
Ligne 212 : |
| end | | end |
| | | |
− | -- récupération des différents titres, images et catégories
| |
| local images, titres, categs = {}, {}, {} | | local images, titres, categs = {}, {}, {} |
− | local tailleIcone = '45x35' | + | local tailleIcone = cfg.tailleIcone |
| if #ebauches > 3 then | | if #ebauches > 3 then |
| tailleIcone = '35x25' | | tailleIcone = '35x25' |
| end | | end |
− | for i, ebauche in ipairs( ebauches ) do | + | for i, ebauche in ipairs(ebauches) do |
− | -- création du lien de l'image | + | -- mise en forme des images |
− | local alt = ebauche.altIcone
| + | |
− | if not alt then
| + | |
− | if ebauche.sujet then
| + | |
− | alt = 'image illustrant ' .. ebauche.sujet
| + | |
− | else
| + | |
− | alt = ''
| + | |
− | end
| + | |
− | end
| + | |
| if ebauche.icone then | | if ebauche.icone then |
− | local image = cfg.formatLien:format( ebauche.icone, tailleIcone, alt ) | + | table.insert( |
− | table.insert( images, image ) | + | images, |
| + | cfg.formatLien:format( |
| + | ebauche.icone, |
| + | tailleIcone, |
| + | ebauche.altIcone or '' |
| + | ) |
| + | ) |
| end | | end |
− | if math.fmod( #ebauches, 3 ) == 1 and ( #ebauches - i ) == 2 | + | if math.fmod(#ebauches, 3) == 1 and (#ebauches - i) == 2 |
− | or math.fmod( i, 3 ) == 0 and ( #ebauches - i ) > 1 | + | or math.fmod(i, 3) == 0 and (#ebauches - i) > 1 |
| then | | then |
− | -- sur plusieurs lignes s'il y a plus de 3 images, avec minimum deux images sur la dernière ligne | + | -- sur plusieurs lignes s'il y a plus de 3 images, avec minimum deux images sur la dernière ligne. |
− | table.insert( images, '<br> ' ) | + | table.insert(images,'<br>') |
| end | | end |
| | | |
| if i > 1 and ebauche.type and ebauche.type ~= paramEbauche[''].type then | | if i > 1 and ebauche.type and ebauche.type ~= paramEbauche[''].type then |
− | -- remplace "Cet article par "Ce portail" ou autre en fonction du premier thème | + | -- remplace "Cet article par "Ce portail" ou autre en fonction du premier thème. |
| table.insert( | | table.insert( |
| gestionErreur, | | gestionErreur, |
− | erreur( ebauche.nom, cfg.erreurEbaucheType, 'div' ) | + | erreur(ebauche.nom, cfg.erreurEbaucheType, 'div') |
| ) | | ) |
| end | | end |
| | | |
| -- récupères les différents noms de thème | | -- récupères les différents noms de thème |
− | if ebauche.adjectif and #titres > 0 then | + | table.insert(titres, ebauche.sujet) |
− | local sujet = ebauche.sujet or ebauche.nom
| + | |
− | if estFeminin then
| + | |
− | sujet = ebauche.sujetF or sujet:gsub(
| + | |
− | ebauche.nom:gsub( '(%p)', '%%%1') .. '%f[%W]',
| + | |
− | ebauche.feminin
| + | |
− | )
| + | |
− | end
| + | |
− | -- ajout du sujet de l'adjectif dans le sujet de l'ébauche précédente
| + | |
− | local titre, subst = titres[ #titres ]:gsub(
| + | |
− | '<(adj[^>]*)>',
| + | |
− | { adjectif = sujet, adj = ebauche.nom, adjF = ebauche.feminin }
| + | |
− | )
| + | |
− | if subst > 0 then
| + | |
− | titres[ #titres ] = titre
| + | |
− | else
| + | |
− | titres[ #titres ] = titre .. ' ' .. sujet
| + | |
− | end
| + | |
− | else
| + | |
− | table.insert( titres, ebauche.sujet )
| + | |
− | estFeminin = ebauche.estFeminin or ( ebauche.sujet == '' and estFeminin )
| + | |
− | end
| + | |
| | | |
| -- mise en forme des catégories | | -- mise en forme des catégories |
− | if ebauche.adjectif then | + | if ebauche.categ then |
− | -- tentative d'ajout du nom de l'adjectif dans les catégories précédentes | + | table.insert( categs, cfg.ebaucheCateg:format( ebauche.categ ) ) |
− | local modif = false
| + | |
− | for k, v in ipairs( categs ) do
| + | |
− | local cat, subst = v:gsub(
| + | |
− | '<(adj[^>]*)>',
| + | |
− | { adj = ebauche.nom, adjF = ebauche.feminin, adjectif = ebauche.nom }
| + | |
− | )
| + | |
− | if subst == 0 then
| + | |
− | cat = v .. ' ' .. ebauche.nom
| + | |
− | end
| + | |
− | if mw.title.new( 'Catégorie:Wikipédia:ébauche ' .. cat ).exists then
| + | |
− | categs[ k ] = cat
| + | |
− | modif = true
| + | |
− | end
| + | |
− | end
| + | |
− | if not modif
| + | |
− | and humain
| + | |
− | and mw.title.new( 'Catégorie:Wikipédia:ébauche personnalité ' .. ebauche.feminin ).exists
| + | |
− | then
| + | |
− | table.insert( categs, 'personnalité ' .. ebauche.feminin )
| + | |
− | end
| + | |
| end | | end |
− | table.insert( categs, ebauche.categ )
| |
− | table.insert( categs, ebauche.categ2 )
| |
| end | | end |
| | | |
− | -- mise en forme des images
| |
| local image | | local image |
− | if trim( args['icône'] ) then | + | if trim(args['icône']) then |
− | local theme = getEbaucheTable( paramEbauche, args['icône'] ) | + | local theme = getEbaucheTable(args['icône']) |
| if theme and theme.icone then | | if theme and theme.icone then |
− | image = cfg.formatLien:format( | + | image = cfg.formatLien:format(theme.icone, tailleIcone, theme.altIcone or '') |
− | theme.icone,
| + | |
− | tailleIcone,
| + | |
− | theme.altIcone or ( 'image illustrant ' .. theme.sujet )
| + | |
− | )
| + | |
| end | | end |
| elseif #images == 1 then | | elseif #images == 1 then |
− | image = images[ 1 ] | + | image = images[1] |
| elseif #images > 1 then | | elseif #images > 1 then |
− | image = cfg.ebaucheImage:format( table.concat( images, ' ' ) ) | + | image = cfg.ebaucheImage:format(table.concat(images, ' ')) |
| end | | end |
| | | |
− | -- mise en forme du titre
| |
| local titre | | local titre |
| if #titres > 0 then | | if #titres > 0 then |
| titre = cfg.ebaucheTitreSujet:format( | | titre = cfg.ebaucheTitreSujet:format( |
− | ebaucheParam( 1, 'type' ), | + | ebaucheParam(1, 'type'), |
− | mw.text.listToText( titres ) | + | mw.text.listToText(titres) |
| ) | | ) |
| else | | else |
− | titre = cfg.ebaucheTitre:format( ebaucheParam( 1, 'type' ) ) | + | titre = cfg.ebaucheTitre:format(ebaucheParam(1, 'type')) |
| end | | end |
− |
| |
− | -- mise en forme du texte
| |
| local texte | | local texte |
| if #ebauches == 0 then | | if #ebauches == 0 then |
− | texte = ( ebaucheParam( 1, 'message' ) ) .. '.' | + | texte = (ebaucheParam(1, 'message')) .. '.' |
| else | | else |
− | local message = ebaucheParam( 1, 'message' ) | + | texte = (ebaucheParam(1, 'message')) .. ' ' .. (ebaucheParam(1, 'selon')) .. '.' |
− | local selon = ebaucheParam( 1, 'selon' )
| + | |
− | -- ajout d'un point si le paramètre selon commence par un retour ligne ou une majuscule
| + | |
− | if message:sub( -1 ) == ')' and ( selon:sub( 1, 3 ) == '<br' or mw.ustring.match( selon, '^%u' ) ) then
| + | |
− | texte = ( ebaucheParam( 1, 'message' ) ) .. '. ' .. ( ebaucheParam( 1, 'selon' ) ) .. '.'
| + | |
− | else
| + | |
− | texte = ( ebaucheParam( 1, 'message' ) ) .. ' ' .. ( ebaucheParam( 1, 'selon' ) ) .. '.'
| + | |
− | end
| + | |
− | end
| + | |
− | -- ajout d'un texte s'il y a une liste de tâches
| + | |
− | local todo = mw.title.makeTitle( mw.site.namespaces[ page.namespace ].talk.id, page.text .. '/À faire' )
| + | |
− | if todo.exists then
| + | |
− | texte = texte .. '\n\n'
| + | |
− | .. 'Consultez la liste des <b>tâches à accomplir</b> en [['
| + | |
− | .. page.talkPageTitle.prefixedText
| + | |
− | .. '|page de discussion]].'
| + | |
| end | | end |
| | | |
− | -- paramètres pour le bandeau
| |
| local parametres = { | | local parametres = { |
| niveau = 'ébauche', | | niveau = 'ébauche', |
| ['icône'] = image, | | ['icône'] = image, |
− | titre = titre:gsub( ' <adj[^>]*>', '' ), | + | titre = titre, |
| texte = texte, | | texte = texte, |
| id = args.id | | id = args.id |
| } | | } |
| | | |
− | -- concaténation des différentes catégories (pas de catégorisation si nocat, ou page de discussion, ou espace utilisateur)
| |
| local categ = '' | | local categ = '' |
− | local messageErreur = table.concat( gestionErreur )
| + | if not yesno(args.nocat) then |
− | if not ( yesno( args.nocat, true, false ) or page.isTalkPage or page.namespace == 2 ) then | + | categ = table.concat(categs) |
− | for i = 1, #categs do
| + | |
− | categs[ i ] = cfg.ebaucheCateg:format( categs[ i ] )
| + | |
− | end
| + | |
− | categ = table.concat( categs ):gsub( ' <[^>]*>', '' ) | + | |
| if categ == '' then | | if categ == '' then |
| categ = cfg.ebaucheCateg:format('') | | categ = cfg.ebaucheCateg:format('') |
− | end
| |
− | if #gestionErreur > 0 then
| |
− | messageErreur = messageErreur .. '[[Catégorie:Ébauche inconnue]]'
| |
| end | | end |
| end | | end |
| | | |
− | | + | local messageErreur = table.concat(gestionErreur) |
− | | + | if messageErreur:len() > 0 and not yesno(args.nocat) then |
− | return p._bandeauAvertissement( parametres ) .. messageErreur .. categ
| + | messageErreur = messageErreur .. '[[Catégorie:Page utilisant un modèle avec une syntaxe erronée|Ébauche]]' |
− | end
| + | |
− | | + | |
− | ---
| + | |
− | -- fonction retournant un paramètre d'une table d'ébauche.
| + | |
− | -- Elle est prévue pour être appelée directement par #invoke:
| + | |
− | -- avec pour paramètres le thème et le paramètre désiré
| + | |
− | -- Cette fonction est principalement destinée à la page d'aide.
| + | |
− | function p.parametreEbauche( frame )
| + | |
− | local paramEbauche = mw.loadData( moduleEbauche ) | + | |
− | local theme = frame.args[1]
| + | |
− | local param = frame.args[2]
| + | |
− | if paramEbauche[ theme ] then
| + | |
− | return paramEbauche[ theme ][ param ] | + | |
− | elseif paramEbauche[ inverserCasse( theme ) ] then
| + | |
− | return paramEbauche[ inverserCasse( theme ) ][ param ]
| + | |
| end | | end |
− | end
| |
| | | |
− | ---
| + | return p._bandeauAvertissement(parametres) .. messageErreur .. categ |
− | -- Fonction retournant le féminin d'un théme d'ébauche
| + | |
− | -- Elle est prévue pour être appelée directement par #invoke:
| + | |
− | -- avec pour paramètres le thème et le paramètre désiré
| + | |
− | -- Cette fonction est principalement destinée au modèle {{Catégorie d'ébauche}}, donc une valeur n'est retournée que si les catégories sont identiques
| + | |
− | function p.femininEbauche( frame )
| + | |
− | local paramEbauche = mw.loadData( moduleEbauche )
| + | |
− | local theme = frame.args[1]
| + | |
− | local themeF
| + | |
− | if theme then
| + | |
− | local t = getEbaucheTable( paramEbauche, theme )
| + | |
− | local tF, tAdjF = getEbaucheTable( paramEbauche, theme, true )
| + | |
− | if t.feminin and tF.categ == t.categ then
| + | |
− | if tAdjF then
| + | |
− | themeF = tF.nom .. ' ' .. tAdjF.feminin
| + | |
− | elseif tF then
| + | |
− | themeF = tF.nom
| + | |
− | end
| + | |
− | return themeF
| + | |
− | end
| + | |
− | end
| + | |
| end | | end |
− |
| |
− | ---
| |
− | -- fonction qui contruit deux tableaux récapitulatif de l'ensemble des paramètres d'ébauche
| |
− | function p.tableParametresEbauches( frame )
| |
− | local paramEbauche = mw.loadData( moduleEbauche )
| |
− | local params, paramAdj, paramType = {}, {}, {}
| |
− | local wikiTab = { '<table class="wikitable sortable" style="table-layout:fixed;">' }
| |
− | wikiTab.insert = function ( t, value )
| |
− | table.insert( t, value )
| |
− | return t
| |
− | end
| |
− |
| |
− | for clef, ebauche in pairs( paramEbauche ) do
| |
− | local kEbauche = {}
| |
− | for k, v in pairs( ebauche ) do
| |
− | kEbauche[ k ] = v
| |
− | end
| |
− | kEbauche.clef = clef
| |
− | if ebauche.type then
| |
− | table.insert( paramType, kEbauche )
| |
− | elseif ebauche.adjectif then
| |
− | if clef == ebauche.nom or clef ~= ebauche.feminin then
| |
− | table.insert( paramAdj, kEbauche )
| |
− | end
| |
− | else
| |
− | table.insert( params, kEbauche )
| |
− | end
| |
− | end
| |
− | local comp = function( eb1, eb2 )
| |
− | return eb1.clef < eb2.clef
| |
− | end
| |
− | table.sort( params, comp )
| |
− | table.sort( paramAdj, comp )
| |
− | table.sort( paramType, comp )
| |
− |
| |
− | wikiTab
| |
− | :insert('\n=== Ébauches normales ===\n')
| |
− | :insert('<caption>Liste des paramètres d\'ébauche</caption>')
| |
− | :insert('<th scope=col style="width:15%;">nom</th>')
| |
− | :insert('<th scope=col style="width:50px; box-sizing:border-box;">i</th>')
| |
− | :insert('<th scope=col style="width:20%;">sujet</th>')
| |
− | :insert('<th scope=col style="width:20%;">catégorie</th>')
| |
− | :insert('<th scope=col>selon</th>')
| |
− | for k, ebauche in ipairs( params ) do
| |
− | wikiTab
| |
− | :insert('<tr><td>')
| |
− | :insert( ebauche.clef )
| |
− | :insert('</td><td>')
| |
− | if ebauche.icone then
| |
− | wikiTab:insert( cfg.formatLien:format( ebauche.icone, '45x35', ebauche.altIcone or '' ) )
| |
− | end
| |
− | wikiTab
| |
− | :insert('</td><td>')
| |
− | :insert( ebauche.sujet )
| |
− | :insert('</td><td>')
| |
− | if ebauche.categ then
| |
− | wikiTab
| |
− | :insert( '[[:Catégorie:Wikipédia:ébauche ' .. ebauche.categ .. '|' .. ebauche.categ .. ']]' )
| |
− | end
| |
− | if ebauche.cageg2 then
| |
− | wikiTab
| |
− | :insert('<br>')
| |
− | :insert( '[[:Catégorie:Wikipédia:ébauche ' .. ebauche.categ2 .. '|' .. ebauche.categ2 .. ']]' )
| |
− | end
| |
− | wikiTab
| |
− | :insert('</td><td>')
| |
− | :insert( ebauche.selon )
| |
− | :insert('</td></tr>')
| |
− | end
| |
− | wikiTab:insert('</table>')
| |
− |
| |
− | -- seconde table pour les adjectifs
| |
− | wikiTab
| |
− | :insert('\n=== Adjectifs ===\n')
| |
− | :insert('<table class="wikitable">')
| |
− | :insert('<caption>Liste des adjectifs</caption>')
| |
− | :insert('<th scope=col>adjectif</th>')
| |
− | :insert('<th scope=col>féminin</th>')
| |
− | :insert('<th scope=col style="width:50px;">icone</th>')
| |
− | :insert('<th scope=col>sujet</th>')
| |
− | :insert('<th scope=col>sujet féminin</th>')
| |
− | :insert('<th scope=col>catégorie</th>')
| |
− | for k, ebauche in ipairs( paramAdj ) do
| |
− | wikiTab
| |
− | :insert('<tr><td>')
| |
− | :insert( ebauche.clef )
| |
− | :insert('</td><td>')
| |
− | :insert( ebauche.feminin )
| |
− | :insert('</td><td>')
| |
− | if ebauche.icone then
| |
− | wikiTab
| |
− | :insert( cfg.formatLien:format( ebauche.icone, '45x35', ebauche.altIcone or '' ) )
| |
− | end
| |
− | wikiTab
| |
− | :insert('</td><td>')
| |
− | :insert( ebauche.sujet )
| |
− | :insert('</td><td>')
| |
− | :insert( ebauche.sujetF or ebauche.sujet:gsub( ebauche.nom .. '%f[%W]', ebauche.feminin ) )
| |
− | :insert('</td><td>')
| |
− | if ebauche.categ then
| |
− | wikiTab
| |
− | :insert( '[[:Catégorie:Wikipédia:ébauche ' .. ebauche.categ .. '|' .. ebauche.categ .. ']]' )
| |
− | end
| |
− | wikiTab
| |
− | :insert('</td></tr>')
| |
− | end
| |
− | wikiTab:insert('</table>')
| |
− |
| |
− | -- troisième table pour les types
| |
− | wikiTab
| |
− | :insert('\n=== Types ===\n')
| |
− | :insert('<table class="wikitable">')
| |
− | :insert('<caption>Liste des paramètres de type</caption>')
| |
− | :insert('<th scope=col style="width:15%;">nom</th>')
| |
− | :insert('<th scope=col style="width:50px;">icone</th>')
| |
− | :insert('<th scope=col style="width:20%;">type</th>')
| |
− | :insert('<th scope=col style="width:15%;">sujet</th>')
| |
− | :insert('<th scope=col style="width:15%;">catégorie</th>')
| |
− | :insert('<th scope=col>message</th>')
| |
− | for k, ebauche in ipairs( paramType ) do
| |
− | wikiTab
| |
− | :insert('<tr><td>')
| |
− | :insert( ebauche.clef )
| |
− | :insert('</td><td>')
| |
− | if ebauche.icone then
| |
− | wikiTab:insert( cfg.formatLien:format( ebauche.icone, '45x35', ebauche.altIcone or '' ) )
| |
− | end
| |
− | wikiTab
| |
− | :insert('</td><td>')
| |
− | :insert ( ebauche.type )
| |
− | :insert('</td><td>')
| |
− | :insert( ebauche.sujet )
| |
− | :insert('</td><td>')
| |
− | if ebauche.categ then
| |
− | wikiTab:insert( '[[:Catégorie:Wikipédia:ébauche ' .. ebauche.categ .. '|' .. ebauche.categ .. ']]' )
| |
− | end
| |
− | wikiTab
| |
− | :insert('</td><td>')
| |
− | :insert( ebauche.message )
| |
− | :insert('</td></tr>')
| |
− | end
| |
− | wikiTab:insert('</table>')
| |
− |
| |
− | return table.concat( wikiTab ):gsub( ' <adjF?>', '' )
| |
− | end
| |
− |
| |
− | -- fonction destiné au gadget MediaWiki:Gadget-BandeauxEbauches.js
| |
− | function p.listeEbauches( frame )
| |
− | local paramEbauche = mw.loadData( moduleEbauche )
| |
− | local liste = {}
| |
− | for k in pairs( paramEbauche ) do
| |
− | if k ~="" then
| |
− | table.insert( liste, k )
| |
− | end
| |
− | end
| |
− | table.sort( liste )
| |
− | return table.concat( liste, '\n' )
| |
− | end
| |
− |
| |
− |
| |
| | | |
| -- Insertion dans la table p des fonctions appelées par les | | -- Insertion dans la table p des fonctions appelées par les |