Ouvrir le menu principal

Modifications

549 octets ajoutés ,  2 mai 2020 à 20:40
m
Correction typo.
--Ce module implémente le modèle {{DocumentationMéta documentation de modèle}}.
local p = {}
end
local function nomDocumentationnomSouspage(page, souspage)
--On n'est pas dans une sous-page
if not page.isSubpage then
return page.subjectNsText .. ':' .. page.text .. '/Documentation'.. souspage
end
or sousPage == 'Bac à sable'
or sousPage == 'Test' then
return page.subjectNsText .. ':' .. page.baseText .. '/Documentation'.. souspage
else
return page.subjectNsText .. ':' .. page.text .. '/Documentation'.. souspage
end
end
local function lienUrl(nomPage, titrePagetexteLien, action, pagePreload) local argument arguments = {}  if action then arguments['action'] = action or 'edit'} end
if pagePreload then
argumentarguments['preload'] = 'Modèle:Documentation/Preload' .. pagePreload
end
if arguments['action'] or arguments['preload'] then return mw.ustring.format('[%s %s]', nomPage:fullUrl(argumentarguments), titrePagetexteLien) else return mw.ustring.format('[[%s|%s]]', nomPage.fullText, texteLien) end
end
local res = mw.html.create('div')
-- Titre
res
:css('margin-bottom', '1ex')
:done()
if not args.contenu then-- Liens local editionLien = res:tag('span') :addClass('mw-editsection -like plainlinks') :css('vertical-align', 'middle')  if args['aucun contenu additionnel'] == nil then if not args.contenu then if existeDoc then editionLien :wikitext('[') :wikitext(lienUrl(doc, 'voir')) :wikitext('] ')  :wikitext('[') :wikitext(lienUrl(doc, 'modifier', 'edit')) :wikitext(']')
if existeDoc then editionLien :wikitext(lienUrl(doc, 'modifier[')) else if args.module then editionLien :wikitext(lienUrl(doc, 'créerhistorique', 'edithistory', )) :wikitext('Module] '))
else
local pagePreload = 'Preload' if page.namespace == 828 then pagePreload = 'PreloadModule' end  editionLien :wikitext('[') :wikitext(lienUrl(doc, 'créer', 'edit', pagePreload)) :wikitext('] '))
end
end
end
editionLien :wikitext('] [') :wikitext(lienUrl(page, 'purger', 'purge')) :wikitext(']') end
return res
local res = mw.html.create():newline()
-- Contenu auto haut if existeDoc args['contenu auto haut'] then res:wikitext(args['contenu auto haut']) :newline() end  -- Contenu ou sous-page de doc if args['aucun contenu additionnel'] == nil then
if args.contenu then
res :newline() :wikitext(args.contenu) :newline() :newline() end
elseif existeDoc then local frame contenuDoc = mw.getCurrentFrame() if frame.args and frame.args['contenu sous-page'] then local contenuDoc :expandTemplate{title = framedoc.args['contenu sous-page']prefixedText}
if page.subpageText == 'Bac à sable' or page.subpageText == 'Test' then
contenuDoc = retireBalisesCategories(contenuDoc)
end
res:newline() :wikitext(contenuDoc) :newline()  elseelseif page.subpageText ~= 'Bac à sable' and page.subpageText ~= 'Test' and args['contenu facultatif'] == nil then local contenuDoc texteBandeau = '<b>Ce %s ne possède aucune [[Aide:Documentation de modèle|documentation]] ' ..'explicative en sous-page</b>, pas même une description succincte.<br> ' ..'Vous pouvez %s afin de documenter ce %s adéquatement.' if page.namespace == 828 then -- Module texteBandeau = frametexteBandeau:expandTemplate{title format( 'module', lienUrl(doc, 'créer cette sous-page', 'edit', 'PreloadModule'), 'module' ) else -- Modèle texteBandeau = texteBandeau:format( 'modèle', lienUrl(doc.prefixedText}, 'créer cette sous-page', 'edit', 'Preload'), 'modèle' ) end if page.subpageText namespace == 10 then -- Modèle texteBandeau = texteBandeau .. 'Bac à sable[[Catégorie:Modèle sans documentation]]' or elseif page.namespace == 828 then -- Module if page.subpageText text:sub(1, 12) == 'TestUtilisateur:' then -- Pas de catégorisation pour le pseudo-namespace "Module:Utilisateur:Toto/Nom du module" contenuDoc elseif existeDoc == false then texteBandeau = retireBalisesCategories(contenuDoc)texteBandeau .. '[[Catégorie:Module sans documentation]]' end
end
local param = { ['icône'] = 'OOjs_UI_icon_book-ltr.svg', alt = 'MIT', style = 'width:80%;', texte = texteBandeau, } res:wikitext(contenuDocrequire('Module:Bandeau')._bandeau(param))
end
end
-- Contenu auto bas if args['complémentcontenu auto bas'] then res :newline() :newline() :wikitext(args['complément']) end  elseif args.contenu then res:wikitext(args.contenu)  elseif page.subpageText ~= 'Bac à sable' and page.subpageText ~= 'Test' then local texteBandeau = '<b>Ce %s ne possède aucune [[Aide:Documentation de modèle|documentation]] ' ..'explicative en sous-page</b>, pas même une description succincte.<br> ' ..'Vous pouvez %s afin de documenter ce %s adéquatement.' if args.module then texteBandeau = texteBandeau:format( 'module', lienUrl(doc, 'créer cette sous-page', 'edit', 'Module'), 'module' ) if page.baseText == 'Country data' or page.text:sub(1, 12) == 'Utilisateur:' then -- pas de catégorisation pour : modèles de données, pseudo-namespace "Module:Utilisateur:Toto/Nom du module" else texteBandeau = texteBandeau .. '[[Catégorie:Module sans documentation]]' end else texteBandeau = texteBandeau:format( 'modèle', lienUrl(doc, 'créer cette sous-page', 'edit', ''), 'modèle' ) texteBandeau = texteBandeau .. '[[Catégorie:Modèle sans documentation]]' end local param = { ['icôneauto bas'] = 'Book-cover-A-Z.svg', alt = 'domaine public', style = 'width:80%;', texte = texteBandeau, } res:wikitext(require('Module:Bandeau')._bandeau(param))
end
res
:newline()
:tag('div')
:css('clear', 'both')
:css('font-style', 'italic')
-- Phrase "la documentation est générée par ..." if args.contenu ['nom modèle'] then local lienAide = '[[Aide:Modèle|modèle]]' if argspage.notice namespace == 828 then lienAide = '[[Aide:Module|module]]' end  contenuParagraphe :wikitext('La [[Aide:Documentation de modèle|documentation]] de ce ') :wikitext(lienAide) :wikitext(' est générée par le modèle ') :wikitext(mw.getCurrentFrame():expandTemplate{title = 'm', args= {args['nom modèle']} }) :wikitext('.notice <br>') else contenuParagraphe :tag('span') :addClass('error') :wikitext('Erreur : le paramètre <code>nom modèle</code> n\'est pas renseigné.. '<br />') end  -- Phrase indiquant la provenance du contenu (dans le corps ou en sous-page) if args['aucun contenu additionnel'] == nil then elseif args.contenu then
contenuParagraphe
:wikitext('La [[Aide:Documentation de modèle|documentation]] ') :wikitext('de ce [[Aide:Modèle|modèle]] Elle est directement ') :wikitext('[[Aide:Inclusion|incluse]] dans le corps l\'appel de ce dernier. ') :wikitext(lienUrl(page, 'Cliquez ici pour purger le cache', 'purge')) :wikitext('.<br /> Si cette page est protégée, veuillez ')
:wikitext('transférer le contenu de la documentation vers sa ')
:wikitext(lienUrl(doc, 'sous-page dédiée', 'edit', 'Preload')) :wikitext('.<br /> ') end else if elseif existeDoc then local lienAide = contenuParagraphe :wikitext('Elle est [[Aide:ModèleInclusion|modèleincluse]]depuis ')  if args['page doc'] then contenuParagraphe :wikitext('la page [[') :wikitext(tostring(doc)) :wikitext(']].module then') else lienAide = contenuParagraphe :wikitext('sa [[Aide') :wikitext(tostring(doc)) :Modulewikitext('|modulesous-page de documentation]]. ')
end
 
contenuParagraphe
:wikitext('La [[Aide:Documentation de modèle|documentation]] de ce ') :wikitext(lienAide) :wikitext(' est [[Aide:Inclusion|incluse]] depuis sa [[') :wikitext(tostring(doc)) :wikitext('|sous-page de documentation]]&nbsp;') :tag('span') :css('font-size', '89%') :css('font-style', 'normal') :wikitext('(') :wikitext(lienUrl(doc, 'modifier')) :wikitext('&nbsp;|&nbsp;') :wikitext(lienUrl(doc, 'historique', 'history')) :wikitext(').<br /> ') :done() :wikitext('Veuillez placer les catégories dans la soussur cette page-page ') :wikitext(lienUrl(doc, '/Documentation')) :wikitext('.<br /> ')
end
end
-- Phrase indiquant les liens vers le bac à sable et la page de test contenuParagraphe :wikitext('Les éditeurs peuvent travailler dans le ')
local titrePageBacasable = nomDocumentationnomSouspage(page):gsub('/Documentation', '/Bac à sable')
local pageBacasable = mw.title.new(titrePageBacasable)
:css('font-style', 'normal')
:wikitext('(')
:wikitext(lienUrl(pageBacasable, 'modifier', 'edit'))
:wikitext(')')
else
local preLoad pagePreload = '2Preload2' if argspage.module namespace == 828 then preLoad pagePreload = nil
end
contenuParagraphe
:css('font-style', 'normal')
:wikitext('(')
:wikitext(lienUrl(pageBacasable, 'créer', 'edit', preLoadpagePreload))
:wikitext(')')
end
if not argspage.module namespace ~= 828 then
contenuParagraphe:wikitext(' et la page de ')
local titrePageTest = nomDocumentationnomSouspage(page):gsub('/Documentation', '/Test')
local pageTest = mw.title.new(titrePageTest)
:css('font-style', 'normal')
:wikitext('(')
:wikitext(lienUrl(pageTest, 'modifier', 'edit'))
:wikitext(')')
else
:css('font-style', 'normal')
:wikitext('(')
:wikitext(lienUrl(pageTest, 'créer', 'edit', '3Preload3'))
:wikitext(')')
end
function p._documentation(args)
local page = mw.title.getCurrentTitle()
local titreDoc titrePageDoc = nomDocumentationargs['page doc'] or nomSouspage(page, 'Documentation') local doc = mw.title.new(args[1] or titreDoctitrePageDoc)
local existeDoc = existePage(doc)
local res = mw.html.create()
--Génération de la documentation
local couleur = '#ecfcf4'
if page.namespace == 828 then
couleur = '#ecf0fc'
end
 
res
:tag('div')
:css('margin', '1em 0 0 0')
:css('border', '1px solid #aaa')
:css('background', args.couleur or '#ecfcf4')
:css('padding', '1em 1em 0.8em')
:node(entete(args, page, doc, existeDoc))
:node(notice(args, page, doc, existeDoc))
--Catégorisation des modules, en rangeant à part par défaut pour les modules de donnéessans documentation if argspage.module namespace == 828 and page.subpageText ~= 'Bac à sable' and page.subpageText ~= 'Test' then if page.isSubpage and page.baseText existeDoc == 'Country data' false then res:wikitext("[[Catégorie:Module d'informations pays|" .. page.subpageText .. "]]") else
res:wikitext("[[Catégorie:Module en langage Lua]]")
end
--Paramètres vides interprétés par Lua
for cle, val in pairs(argsParent) do
val = mw.text.trim(val)
if val ~= '' then
args[cle] = mw.text.trim(val)
end
end
return p._documentation(args)
end
 
function p.nomDocumentation(frame)
if frame.args[1] and mw.text.trim(frame.args[1]) ~= '' then
return frame.args[1]
else
local titreDoc = nomDocumentation(mw.title.getCurrentTitle())
if mw.title.new(titreDoc).exists then
return titreDoc
end
end
end
return p
Utilisateur anonyme