« Module:Header template » : différence entre les versions
Contenu supprimé Contenu ajouté
supporte LoremIpsum.djvu/4 pour l'image de couverture |
Import des données de Wikidata via Module:Index_data |
||
Ligne 141 :
function headerTemplate( frame )
local parentFrame = frame:getParent()
local data = (require 'Module:Index_data').indexDataWithWikidata(parentFrame)
local args =
local page = mw.title.getCurrentTitle()
local item = mw.wikibase.getEntity()
local headerType = args.value
if args.header_type
headerType = args.header_type
end
Ligne 154 ⟶ 155 :
--Custom page numbers
local from = ''
if args.displayed_from
from = args.displayed_from
elseif args.from then
Ligne 161 ⟶ 162 :
local to = ''
if args.displayed_to
to = args.displayed_to
elseif args.to then
Ligne 226 ⟶ 227 :
--Auteur
if args.auteur
headertemplate:tag('div')
:addClass('headertemplate-author')
Ligne 235 ⟶ 236 :
local titre = formatString( page.baseText, 'name' )
if args.type == 'collection' then
if args.recueil
-- Commenté pour tester avec uniquement le nom du recueil, le titre lui est déjà
-- dans le navigateur et fréquemment en début de la page.
Ligne 250 ⟶ 251 :
end
if args.publication
titre = titre .. ' <span style="font-size:90%;">(' .. args.publication .. ')</span>'
end
Ligne 270 ⟶ 271 :
titre = parseTitleWikitext(titre, 'isPartOf')
end
if args.publication
titre = titre .. ' <span style="font-size:90%;">(' .. args.publication .. ')</span>'
end
end
if estSommaire and args
titre = titre .. ' <br/><small>' .. args['sous_titre'] .. '</small>'
end
Ligne 284 ⟶ 285 :
local references = headertemplate:tag('div')
:addClass('headertemplate-reference')
if args.traducteur
references:wikitext('Traduction par ' .. parseLinkWikitext(args.traducteur, 'translator') .. '.')
:tag('br')
end
if estSommaire and args.illustrateur
references:wikitext('Illustrations par ' .. parseLinkWikitext(args.illustrateur, 'illustrator') .. '.')
:tag('br')
end
if estSommaire and args.volume
references:wikitext( formatString( args.volume, 'volumeNumber' ) )
:tag('br')
Ligne 300 ⟶ 301 :
local infos = {} --Liste des données à afficher séparés par une virgule
if args.type == 'collection' then
if args.titre
table.insert( infos, '<i>' .. parseTitleWikitext(args.titre, 'isPartOf') .. '</i>' )
end
if args.editeur_scientifique
table.insert( infos, 'Texte établi par ' .. parseLinkWikitext( args.editeur_scientifique, 'editor' ) )
end
if args.editeur
table.insert( infos, formatPublisherWithName( args.editeur ) )
end
if args.annee
table.insert( infos, formatYear( args.annee, 'datePublished' ) )
end
if not estSommaire then
if args.volume
table.insert( infos, formatString( args.volume, 'volumeNumber' ) )
end
Ligne 320 ⟶ 321 :
if not estSommaire then
table.insert( infos, '<i>' .. parseTitleWikitext( args.titre, 'isPartOf' ) .. '</i>' )
if args.volume
table.insert( infos, formatString( args.volume, 'volumeNumber' ) )
end
end
if args.annee
table.insert( infos, formatYear( args.annee, 'datePublished' ) )
end
else
if args.editeur_scientifique
table.insert( infos, 'Texte établi par ' .. parseLinkWikitext( args.editeur_scientifique, 'editor' ) )
end
if args.editeur
table.insert( infos, formatPublisherWithName( args.editeur ) )
end
if args.annee
table.insert( infos, formatYear( args.annee, 'datePublished' ) )
end
Ligne 346 ⟶ 347 :
if not estSommaire and from ~= '' then
local temp = ''
if args.volume
temp = formatString( args.volume, 'volumeNumber' ) .. ', '
end
Ligne 375 ⟶ 376 :
end
if (not estSommaire or (args.header_type and args.header_type =='toc')) and
local maxwidth = 50
if args.type ~= 'collection' and args.current
maxwidth = 33
end
Ligne 388 ⟶ 389 :
:css('padding-right', '0px')
:css('background-color', 'transparent')
if args.prev
nav:tag('div')
:css('text-align', 'left')
Ligne 401 ⟶ 402 :
:wikitext(parseLinkWikitext(args.prev, 'previousItem'))
end
if args.next
nav:tag('div')
:css('text-align', 'right')
Ligne 413 ⟶ 414 :
:wikitext(' ►')
end
if args.type ~= 'collection' and args.current
nav:tag('div')
:attr('itemprop', 'name')
Ligne 433 ⟶ 434 :
-- Inclusion de l'épigraphe et du sommaire
if headerType == 'toc' then
if args.epigraphe
container:wikitext(args.epigraphe)
:newline()
Ligne 452 ⟶ 453 :
:attr('itemprop', 'inLanguage')
:attr('content', 'fr') --TODO: que faire pour l'ancien français...
if args.lieu
container:tag('meta')
:attr('itemprop', 'http://purl.org/library/placeOfPublication')
:attr('content', args.lieu) --TODO: is it the best property URI and the best value format?
end
if args.index
local indexFile = mw.title.makeTitle('File', args.index)
if indexFile ~= nil and indexFile.file.exists then
Ligne 525 ⟶ 526 :
end
datahtml:node( outputMicroformatRow( 'title', titre ) )
if args.auteur
datahtml:node( outputMicroformatRow( 'author', args.auteur ) )
coins['rft.au'] = cleanCoinsParameter( args.auteur )
end
if args.traducteur
datahtml:node( outputMicroformatRow( 'translator', args.traducteur ) )
end
if args.illustrateur
datahtml:node( outputMicroformatRow( 'illustrator', args.illustrateur ) )
end
if args.school
datahtml:node( outputMicroformatRow( 'school', args.school ) )
end
if args.editeur
datahtml:node( outputMicroformatRow( 'publisher', args.editeur ) )
coins['rft.pub'] = cleanCoinsParameter( args.editeur )
end
if args.annee
datahtml:node( outputMicroformatRow( 'year', args.annee ) )
coins['rft.date'] = args.annee
end
if args.lieu
datahtml:node( outputMicroformatRow( 'place', args.lieu ) )
coins['rft.place'] = args.lieu
end
if args.avancement
datahtml:node( outputMicroformatRow( 'progress', args.avancement ) )
end
if args.volume
datahtml:node( outputMicroformatRow( 'volume', args.volume ) )
end
if args.current
datahtml:node( outputMicroformatRow( 'chapter', args.current ) )
end
Ligne 622 ⟶ 623 :
local p = {
}
▲ return headerTemplate( frame )
function p.voirEditions( frame )
|