« Module:Documentation » : différence entre les versions
remplacement d'une couleur de bordure par le design token de codex associé
m (2 versions importées depuis w:Module:Documentation) |
(remplacement d'une couleur de bordure par le design token de codex associé) |
||
| Ligne 7 : | Ligne 7 : | ||
end | end | ||
local function | local function textPagebase(page) | ||
--On n'est pas dans une sous-page | --On n'est pas dans une sous-page | ||
if not page.isSubpage then | if not page.isSubpage then | ||
return | return page.text | ||
end | end | ||
| Ligne 18 : | Ligne 18 : | ||
or sousPage == 'Bac à sable' | or sousPage == 'Bac à sable' | ||
or sousPage == 'Test' then | or sousPage == 'Test' then | ||
return | return page.baseText | ||
else | else | ||
return | return page.text | ||
end | end | ||
end | |||
local function nomSouspage(page, souspage) | |||
return page.subjectNsText .. ':' .. textPagebase(page) .. '/' .. souspage | |||
end | end | ||
| Ligne 47 : | Ligne 51 : | ||
-- Titre | -- Titre | ||
res | res | ||
:css('margin-bottom', ' | :css('margin-bottom', '1em') | ||
:css('border-bottom', '1px solid # | :css('border-bottom', '1px solid var(--border-color-base, #a2a9b1)') | ||
:css('padding-bottom', '3px') | :css('padding-bottom', '3px') | ||
:tag('span') | |||
:addClass('documentation-icone') | |||
:css('font-weight', 'bold') | |||
:css('font-size', '125%') | |||
:css('vertical-align', 'middle') | |||
:wikitext(' ') | |||
:wikitext(args.titre or 'Documentation') | |||
:done() | |||
-- Liens | -- Liens | ||
| Ligne 202 : | Ligne 206 : | ||
local param = { | local param = { | ||
['icône'] = 'OOjs_UI_icon_book-ltr.svg', | ['icône'] = 'OOjs_UI_icon_book-ltr.svg', | ||
['classe icône'] = 'skin-invert', | |||
alt = 'MIT', | alt = 'MIT', | ||
class = 'plainlinks', | |||
style = 'width:80%;', | style = 'width:80%;', | ||
texte = texteBandeau, | texte = texteBandeau, | ||
| Ligne 221 : | Ligne 227 : | ||
return res | return res | ||
end | |||
local function lienWstat(nomPage, texteLien) | |||
local nomPageEncoded = mw.text.encode(nomPage) | |||
local nomPageNoSpaces = mw.ustring.gsub(nomPageEncoded, ' ', '_') | |||
local url = 'https://wstat.fr/template/info/' .. nomPageNoSpaces | |||
return mw.ustring.format('[%s %s]', url, texteLien) | |||
end | |||
local function lienRechercheModule(nomModule, texteLien) | |||
local nomModuleEncoded = mw.text.encode(nomModule) | |||
local nomModuleNoSpaces = mw.ustring.gsub(nomModuleEncoded, ' ', '+') | |||
local quote = mw.text.encode('"') | |||
local url = 'https://fr.wikipedia.org/w/index.php?title=Spécial:Recherche&ns828=1&search=insource:' .. quote .. nomModuleNoSpaces .. quote | |||
return mw.ustring.format('[%s %s]', url, texteLien) | |||
end | end | ||
local function notice(args, page, doc, existeDoc) | local function notice(args, page, doc, existeDoc) | ||
local res = mw.html.create('div') | local res = mw.html.create('div') | ||
:css('border-top', '1px solid # | :css('border-top', '1px solid var(--border-color-base, #a2a9b1)') | ||
:css('margin', '1.5em 0 0') | :css('margin', '1.5em 0 0') | ||
| Ligne 342 : | Ligne 363 : | ||
end | end | ||
end | end | ||
contenuParagraphe:wikitext('.') | contenuParagraphe:wikitext('.<br>') | ||
-- Phrase indiquant les liens vers les statistiques | |||
local nomStat, texteWstat | |||
if page.namespace == 828 then | |||
nomStat = 'Module:' .. textPagebase(page) | |||
texteWstat = "statistiques d'appel depuis le wikicode" | |||
else | |||
nomStat = textPagebase(page) | |||
texteWstat = "statistiques d'utilisation du modèle" | |||
end | |||
contenuParagraphe | |||
:wikitext('Voir les ') | |||
:wikitext(lienWstat(nomStat, texteWstat)) | |||
:wikitext(" sur l'outil [[Aide:Wstat|wstat]]") | |||
if page.namespace == 828 then --pour les modules, recherche de "Module:..." dans l'espace de noms Module: | |||
contenuParagraphe | |||
:wikitext(' et les ') | |||
:wikitext(lienRechercheModule(nomStat, "appels depuis d'autres modules")) | |||
end | |||
contenuParagraphe:wikitext(".") | |||
return res | return res | ||
| Ligne 364 : | Ligne 408 : | ||
--Génération de la documentation | --Génération de la documentation | ||
local | local classeNamespace = 'documentation-modele' | ||
if page.namespace == 828 then | if page.namespace == 828 then | ||
classeNamespace = 'documentation-module' | |||
end | end | ||
| Ligne 372 : | Ligne 416 : | ||
:tag('div') | :tag('div') | ||
:addClass('documentation') | :addClass('documentation') | ||
:addClass(classeNamespace) | |||
:css('clear', 'both') | :css('clear', 'both') | ||
:css('margin', '1em 0 0 0') | :css('margin', '1em 0 0 0') | ||
:css('border', '1px solid # | :css('border', '1px solid var(--border-color-base, #a2a9b1)') | ||
:css('padding', '0.5em 1em 0.8em') | |||
:css('padding', ' | |||
:node(entete(args, page, doc, existeDoc)) | :node(entete(args, page, doc, existeDoc)) | ||
:wikitext(protection(page, doc, existeDoc, args['message protection'])) | :wikitext(protection(page, doc, existeDoc, args['message protection'])) | ||