Module:Pistes
Apparence
La documentation pour ce module peut être créée à Module:Pistes/doc
--[[local p = {}
local langue = require 'Module:Langue'
local nbPistes = 0
local function piste (i)
if {{{piste1|{{{title1|}}}}}} or {{{note1|}}} or {{{temps1|{{{length1|}}}}}} then
local ligne = mw.html.create( 'tr' )
if i%2 == 0 then
ligne:css( 'background-color', 'var(--background-color-base, #fff)')
else
ligne:css( 'background-color', '#f7f7f7') --couleur pas adaptée selon mode sombre / pas sombre
end
ligne
:tag( 'th' )
:attr{ scope = 'row' }
:cssText( 'padding-right: 10px; text-align: right;font-weight:normal;' )
:wikitext( {{{numero1|1}}}. )
<td style="text-align: left;">
if {{{piste1|{{{title1|}}}}}} then
if {{{langue|}}} then
{{#invoke:Langue|{{{langue|}}}|{{#ifeq: {{#invoke:Langue|nonLatin| {{{piste1|{{{title1|}}}}}} }} | true | {{{2}}} | ''<nowiki/>{{{piste1|{{{title1|}}}}}}<nowiki/>'' }}}}
else
{{#ifeq: {{#invoke:Langue|nonLatin| {{{piste1|{{{title1|}}}}}} }} | true | {{{piste1|{{{title1|}}}}}} | ''<nowiki/>{{{piste1|{{{title1|}}}}}}<nowiki/>''
else
Sans titre
if {{{note1|}}} then
' <small>({{{note1|}}})</small>'
end
</td>
if {{{credits_paroles}}} == 'oui' then
<td>{{{paroles1|{{{lyrics1|}}}}}}</td>
end
if {{{credits_musique}}} == 'oui' then
<td>{{{musique1|{{{music1|}}}}}}</td>
end
if {{{credits_ecriture}}} == 'oui' then
<td>{{{auteur1|{{{writer1|}}}}}}</td>
end
if {{{colonne_extra|}}} then
<td>{{{extra1|}}}</td>
end
<td style="padding-right: 10px; text-align: right;">{{{temps1|{{{length1|}}}}}}</td>
</tr>
end
end
function p.main( frame )
local args = {}
for k, v in pairs(frame:getParent().args) do
local matchNb = mw.ustring.match( k, '(.+)(%d+)' )
if matchNb
local param, nb = matchNb[1], matchNb[2]
if args[nb] == nil then
if nb > nbPistes
nbPistes = nb
end
args[nb] = {}
end
args[nb][param] = v
else
args[k] = v -- manque résolution des alias
end
end
<div style="margin:0 auto;padding-left:1px; margin-bottom:{{#if:{{{total_temps|}}}|0.5|1}}em;overflow:hidden;" class="overflow"><table class="tracklist{{#ifeq: {{{collapsed}}}|oui|<nowiki> </nowiki>collapsible collapsed}}" cellpadding="0" style="width: 100%;border-width: 0px; border-collapse: collapse;">
{{#if: {{{titre|{{{headline|}}}}}} |
<tr>
<th class="tlheader" colspan="10" style="text-align: left; background-color: var(--background-color-base, #fff); color:var(--color-base, #202122); border-width: 0;" scope="col">
{{#if:{{{langue titre|{{{langue titres|}}}}}}|{{langue|{{{langue titre|{{{langue titres|}}}}}}|{{{titre|{{{headline|}}}}}}}}|{{{titre|{{{headline|}}}}}}}}</th>
</tr> |
{{#ifeq: {{{collapsed}}}|oui|
<tr>
<th class="tlheader" colspan="10" style="text-align: left; background-color: var(--background-color-base, #fff); color:var(--color-base, #202122); border-width: 0;"> </th>
</tr>
}}
}}
<tr>
<th class="tlheader" style="width: 20px; padding-left: 10px; padding-right: 10px; text-align: right; background-color: var(--background-color-neutral, #eaecf0); color:var(--color-base, #202122);" scope="col">{{Numéro avec majuscule|espace=non}}</th>
<th class="tlheader" scope="col" style="{{#switch: {{#expr: {{#ifeq: {{{credits_paroles|{{{lyrics_credits|}}}}}}|oui|1|0}} + {{#ifeq: {{{credits_musique|{{{music_credits|}}}}}}|oui|1|0}} + {{#ifeq: {{{credits_ecriture|{{{writing_credits|}}}}}}|oui|1|0}} + {{#if: {{{colonne_extra|{{{extra_column|}}}}}}|1|0}} }} | 0 = width: 100%; | 1 = width: 60%; | 2 = width: 40%; | 3 = width: 30%; | 4 = width: 20%;}} text-align: left; background-color: var(--background-color-neutral, #eaecf0); color:var(--color-base, #202122);">Titre</th>{{ #ifeq: {{{credits_paroles|{{{lyrics_credits|}}}}}}|oui|<th scope="col" style="{{#switch: {{#expr: ({{#ifeq: {{{credits_paroles|{{{lyrics_credits|}}}}}}|oui|1|0}} + {{#ifeq: {{{credits_musique|{{{music_credits|}}}}}}|oui|1|0}} + {{#ifeq: {{{credits_ecriture|{{{writing_credits|}}}}}}|oui|1|0}} + {{#if: {{{colonne_extra|{{{extra_column|}}}}}}|1|0}}) }} | 1 = width: 40%; | 2 = width: 30%; | 3 = width: 20%; | 4 = width: 20%;}} text-align: left; background-color: var(--background-color-neutral, #eaecf0); color:var(--color-base, #202122);">Paroles</th>}}{{ #ifeq: {{{credits_musique|{{{music_credits|}}}}}}|oui|<th scope="col" style="{{#switch: {{#expr: ({{#ifeq: {{{credits_paroles|{{{lyrics_credits|}}}}}}|oui|1|0}} + {{#ifeq: {{{credits_musique|{{{music_credits|}}}}}}|oui|1|0}} + {{#ifeq: {{{credits_ecriture|{{{writing_credits|}}}}}}|oui|1|0}} + {{#if: {{{colonne_extra|{{{extra_column|}}}}}}|1|0}}) }} | 1 = width: 40%; | 2 = width: 30%; | 3 = width: 20%; | 4 = width: 20%;}} text-align: left; background-color: var(--background-color-neutral, #eaecf0); color:var(--color-base, #202122);">Musique</th>}}{{ #ifeq: {{{credits_ecriture|{{{writing_credits|}}}}}}|oui|<th scope="col" style="{{#switch: {{#expr: ({{#ifeq: {{{credits_paroles|{{{lyrics_credits|}}}}}}|oui|1|0}} + {{#ifeq: {{{credits_musique|{{{music_credits|}}}}}}|oui|1|0}} + {{#ifeq: {{{credits_ecriture|{{{writing_credits|}}}}}}|oui|1|0}} + {{#if: {{{colonne_extra|{{{extra_column|}}}}}}|1|0}}) }} | 1 = width: 40%; | 2 = width: 30%; | 3 = width: 20%; | 4 = width: 20%;}} text-align: left; background-color: var(--background-color-neutral, #eaecf0); color:var(--color-base, #202122);">Auteur</th>}}{{ #if: {{{colonne_extra|{{{extra_column|}}}}}}|<th scope="col" style="{{#switch: {{#expr: ({{#ifeq: {{{credits_paroles|{{{lyrics_credits|}}}}}}|oui|1|0}} + {{#ifeq: {{{credits_musique|{{{music_credits|}}}}}}|oui|1|0}} + {{#ifeq: {{{credits_ecriture|{{{writing_credits|}}}}}}|oui|1|0}} + {{#if: {{{colonne_extra|{{{extra_column|}}}}}}|1|0}}) }} | 1 = width: 40%; | 2 = width: 30%; | 3 = width: 20%; | 4 = width: 20%;}} text-align: left; background-color: var(--background-color-neutral, #eaecf0); color:var(--color-base, #202122);">{{{colonne_extra|{{{extra_column|}}}}}}</th>}}
<th class="tlheader" style="width: 60px; padding-right: 10px; text-align: right; background-color: var(--background-color-neutral, #eaecf0); color:var(--color-base, #202122);" scope="col">Durée</th>
</tr>
for i = 1, nbPistes do
piste (i)
end
{{ #if: {{{total_temps|}}} |
<tr>
<td colspan="10" style="padding-right: 10px; text-align: right; background-color: var(--background-color-base, #fff); border-width: 0;">'''{{{total_temps}}}'''</td>
</tr>
}}</table></div>
end
return p
]]--