« Module:Biblio/Ouvrage » : différence entre les versions

Contenu supprimé Contenu ajouté
m 2 coquilles dans un commentaire
Utilisation de Commun.fusionTexteLien pour le titre et l'éditeur ; ajout paramètres "traduction titre volume", "traduction titre tome" et "traduction titre chapitre", ; variables categ → args.categ ; simplification insertion attribut lang.
Ligne 44 :
local genre = ( chapitre and 'chapitre' ) or 'ouvrage'
-- VariablesTable servant à la catégorisation
args.categ = {}
local categTitre, categTitreChapitre, categTitreOuvrage, categIsbnInvalid --, categLangue (déclaré lors de l'indication de langue)
 
local modeNormal = not validArg( 'nocat' )
-- Clarification des paramètres nécessaires pour les COinS
args.titre = validArg( 'titre', 'title' )
args['pages totales'] = validArg( 'pages totales', 'pages' )
Ligne 63 ⟶ 64 :
-- Indication de langue
local indicLangue, codeLangue, categLangue = Commun.indicationDeLangue ( args, validArg )
local dir, attributsLangue
if Outils.notEmpty( indicLangue ) then
wiki.minsert( indicLangue, ' ' )
Ligne 71 ⟶ 72 :
dir = Langue.directionLangue( codeLangue )
if dir == 'rtl' then
dirattributsLangue = ' lang="' .. codeLangue .. '" dir="rtl"'
else
dir = nil
wiki.minsert(attributsLangue = '<span lang="', .. codeLangue, dir,.. '">' )
end
end
Ligne 96 ⟶ 98 :
if chapitre then
if args.titreChap then
wiki.minsert( '« <cite style="font-style:normal"', attributsLangue, '>« ', args.titreChap )
if codeLangue then
wiki.minsert( '<span lang="', codeLangue, dir, '">' )
end
wiki.minsert( '« <cite style="font-style:normal">', args.titreChap )
if args['sous-titre chapitre'] then
wiki.minsert( ' : ', args['sous-titre chapitre'] )
end
wiki.minsert( ' »</cite> »' )
if codeLangue then
wiki.minsert( '</span>' )
end
elseif modeNormal then
wiki.minsert( Outils.erreur( ' [[Modèle:Chapitre|{{Chapitre}}]] : paramètre « <code>titre chapitre</code> » manquant' ) )
categTitreChapitreargs.categ.titreChapitre = true
end
Ligne 122 ⟶ 118 :
-- Titre
if args.titre then
local titre, sousTitre = args.titre, validArg( 'sous-titre' )
if codeLangue then
wiki.minsert( '<cite class="italique" lang="', codeLangue, dir, '">')
else
wiki.minsert( '<cite class="italique">')
end
local lienTitre = validArg( 'lien titre' )
if lienTitre then
wiki.minsert( '[[', lienTitre, '|' )
end
wiki.minsert( args.titre )
local sousTitre = validArg( 'sous-titre' )
if sousTitre then
wikititre = titre ..minsert( ' : ', sousTitre.. )sousTitre
end
if lienTitre then
wiki.minsert( ']]' )
end
titre = Commun.fusionTexteLien( titre, args['lien titre'], args.categ )
wiki.minsert( '</cite>' )
wiki.minsert( '<cite class="italique" lang="', codeLangueattributsLangue, dir'>', titre, '"</cite>' )
elseif modeNormal then
if chapitre then
categTitreOuvrageargs.categ.titreOuvrage = true
if categTitreChapitreargs.categ.titreChapitre then
wiki.minsert( Outils.erreur( 'paramètre « <code>titre ouvrage</code> » manquant' ) )
else
wiki.minsert( Outils.erreur( '[[Modèle:Chapitre|{{Chapitre}}]] : paramètre « <code>titre ouvrage</code> » manquant' ) )
end
else
categTitreargs.categ.titre = true
wiki.minsert( Outils.erreur( '[[Modèle:Ouvrage|{{Ouvrage}}]] : paramètre « <code>titre</code> » manquant' ) )
end
end
Ligne 160 ⟶ 142 :
local original = validArg( 'titre original', 'titre vo', 'traduction titre' )
if original and original ~= args.titre then
Langue = Langue or require( 'Module:Langue' )
wiki.minsert( ' [« ', Langue.langue{ args['langue originale'], original }, ' »]' )
end
if not auteur then
Ligne 187 ⟶ 170 :
if codeLangue then
Langue = Langue or require( 'Module:Langue' )
wiki.minsert( Langue.langlangue{ codeLangue, titreVolTome }, [['']] )
else
wiki.minsert( titreVolTome, [['']] )
end
local tradTitreVolTome = validArg( 'traduction titre volume', 'traduction titre tome' )
if tradTitreVolTome then
wiki.minsert( ' [[« ', lienTitretradTitreVolTome, '| »]' )
end
end
Ligne 201 ⟶ 188 :
if editeur then
local lienEditeur = validArg( 'lien éditeur' )
wiki.minsert( ', ', Commun.fusionTexteLien( editeur, lienEditeur, args.categ ) )
if lienEditeur then
wiki.minsert( ', [[', lienEditeur, '|', editeur, ']]' )
else
wiki.minsert( ', ', editeur )
end
end
Ligne 271 ⟶ 254 :
-- Lien vers l'ouvrage en ligne (isbn, issn, pmid, doi, lire en ligne, résumé...)
wiki.minsert( References.affichageLiensExternes( args, validArg, true, false ) )
-- « consulté le » n'est plus affiché, voir [[Discussion_modèle:Ouvrage#Évolution documentation]]
categIsbnInvalid = args.categIsbnInvalid
-- « consulté le » n'est plus affiché, voir [[Discussion_modèle:Ouvrage#Évolution documentation]]
-- Précision sur le passage concerné
Ligne 298 ⟶ 280 :
if codeLangue then
Langue = Langue or require( 'Module:Langue' )
titreChapitre = Langue.langlangue{ codeLangue, titreChapitre }
end
wiki.minsert( titreChapitre )
local lienTitretradTitreChap = validArg( 'lientraduction titre chapitre' )
if codeLanguetradTitreChap then
wiki.minsert( '</span> [« ', tradTitreChap, ' »]' )
end
end
local passage = validArg( 'passage', 'page' )
Ligne 326 ⟶ 312 :
end
wiki.minsert( Commun.commentaire( args ) )
local x = References.i
if mw.title.getCurrentTitle().namespace == 0 and modeNormal then
wiki.minsert(
categLangueargs.categ.langue and '[[Catégorie:Page du modèle Ouvrage comportant une erreur|langue]]',
categTitreargs.categ.titre and '[[Catégorie:Page du modèle Ouvrage comportant une erreur|titre]]',
categTitreChapitreargs.categ.titreChapitre and '[[Catégorie:Page du modèle Chapitre comportant une erreur|Chapitre]]',
categTitreOuvrageargs.categ.titreOuvrage and '[[Catégorie:Page du modèle Chapitre comportant une erreur|Ouvrage]]',
categIsbnInvalidargs.categ.lienExterne and '[[Catégorie:Page du modèle Ouvrage aveccomportant ISBNune invalideerreur|Externe]]',
args.categ.isbnInvalid and '[[Catégorie:Ouvrage avec ISBN invalide]]'
)
if dir then