« Module:Biblio » : différence entre les versions
+ |
m retouche de la modification précédente ; Généralisation d'indentation par tab |
||
Ligne 8 : | Ligne 8 : | ||
Biblio.ouvrage = function ( frame ) | Biblio.ouvrage = function ( frame ) | ||
local args = Outils.extractArgs( frame ) | |||
local Ouvrage = require( 'Module:Biblio/Ouvrage' ) | |||
return Ouvrage.ouvrage( args ) | |||
end | end | ||
Biblio.chapitre = function ( frame ) | Biblio.chapitre = function ( frame ) | ||
local args = Outils.extractArgs( frame ) | |||
local Ouvrage = require( 'Module:Biblio/Ouvrage' ) | |||
return Ouvrage.chapitre( args ) | |||
end | end | ||
Biblio.article = function ( frame ) | Biblio.article = function ( frame ) | ||
local args = Outils.extractArgs( frame ) | |||
local Ouvrage = require( 'Module:Biblio/Article' ) | |||
return Ouvrage.article( args ) | |||
end | end | ||
Biblio.lienWeb = function( frame ) | Biblio.lienWeb = function( frame ) | ||
local args = Outils.extractArgs( frame ) | |||
local Ouvrage = require( 'Module:Biblio/Lien web' ) | |||
return Ouvrage.lienWeb( args ) | |||
end | end | ||
Biblio.dictionnaire = function( frame ) | Biblio.dictionnaire = function( frame ) | ||
local args = Outils.extractArgs( frame ) | |||
local article = Outils.validTextArg( args, 'notice', 'article', 'titre chapitre' ) | |||
local Ouvrage = require( 'Module:Biblio/Ouvrage' ) | |||
if article then | if article then | ||
args['titre chapitre'] = article | args['titre chapitre'] = article | ||
Ligne 53 : | Ligne 53 : | ||
Biblio.ISBN = function ( frame ) | Biblio.ISBN = function ( frame ) | ||
local args = Outils.extractArgs( frame ) | |||
local References = require( 'Module:Biblio/Références' ) | |||
if Outils.trim(args[1]) then | |||
local newArgs = { isbn = args[1], categ = { isbnInvalid = false } } | |||
local i = 2 | |||
while args[i] do | |||
newArgs['isbn' .. i] = args[i] | |||
i = i + 1 | |||
end | |||
local listeISBN = References.isbn( newArgs ) | |||
local categ = References.categorise{'Ouvrage avec ISBN invalide', newArgs.categ.isbnInvalid } | |||
return '<small>(' .. listeISBN .. ')</small>' .. categ | |||
else | else | ||
return '<small>([[International Standard Book Number|ISBN]] inconnu)</small>' .. References.categorise{'ISBN nécessaire'} | return '<small>([[International Standard Book Number|ISBN]] inconnu)</small>' .. References.categorise{'ISBN nécessaire'} | ||
Ligne 73 : | Ligne 72 : | ||
Biblio.ISSN = function ( frame ) | Biblio.ISSN = function ( frame ) | ||
local args = Outils.extractArgs( frame ) | |||
local References = require( 'Module:Biblio/Références' ) | |||
if Outils.trim(args[1]) then | |||
local newArgs = { issn = args[1], categ = { issnInvalid = false } } | |||
local i = 2 | |||
while args[i] do | |||
newArgs['issn' .. i] = args[i] | |||
i = i + 1 | |||
end | |||
local listeISSN = References.issn( newArgs ) | |||
local categ = References.categorise{'Page avec ISSN invalide', newArgs.categ.issnInvalid } | |||
return '<small>(' .. listeISSN .. ')</small>' .. categ | |||
else | else | ||
return '<small>(inconnu)</small>' .. References.categorise{'ISSN nécessaire'} | return '<small>(inconnu)</small>' .. References.categorise{'ISSN nécessaire'} | ||
Ligne 99 : | Ligne 98 : | ||
return issn .. categ | return issn .. categ | ||
end | end | ||
Biblio.enLigne = function ( frame ) | Biblio.enLigne = function ( frame ) | ||
local args = Outils.extractArgs( frame ) | |||
local References = require( 'Module:Biblio/Références' ) | |||
return '<small>[' .. References.enLigne( args ) .. ']</small>' | |||
end | end | ||
return Biblio | return Biblio |
Version du 6 janvier 2016 à 18:07
-- Le module biblio centralise les différentes fonctions utiles pour les bibliographie et références.
local Biblio = { }
local Outils = require( 'Module:Outils' )
Biblio.ouvrage = function ( frame )
local args = Outils.extractArgs( frame )
local Ouvrage = require( 'Module:Biblio/Ouvrage' )
return Ouvrage.ouvrage( args )
end
Biblio.chapitre = function ( frame )
local args = Outils.extractArgs( frame )
local Ouvrage = require( 'Module:Biblio/Ouvrage' )
return Ouvrage.chapitre( args )
end
Biblio.article = function ( frame )
local args = Outils.extractArgs( frame )
local Ouvrage = require( 'Module:Biblio/Article' )
return Ouvrage.article( args )
end
Biblio.lienWeb = function( frame )
local args = Outils.extractArgs( frame )
local Ouvrage = require( 'Module:Biblio/Lien web' )
return Ouvrage.lienWeb( args )
end
Biblio.dictionnaire = function( frame )
local args = Outils.extractArgs( frame )
local article = Outils.validTextArg( args, 'notice', 'article', 'titre chapitre' )
local Ouvrage = require( 'Module:Biblio/Ouvrage' )
if article then
args['titre chapitre'] = article
return Ouvrage.chapitre( args )
else
args.titre = args['titre ouvrage']
args['sous-titre'] = args['sous-titre ouvrage']
args.auteur1 = args['auteur ouvrage']
args.auteurs = args['auteurs ouvrage']
return Ouvrage.ouvrage( args )
end
end
Biblio.ISBN = function ( frame )
local args = Outils.extractArgs( frame )
local References = require( 'Module:Biblio/Références' )
if Outils.trim(args[1]) then
local newArgs = { isbn = args[1], categ = { isbnInvalid = false } }
local i = 2
while args[i] do
newArgs['isbn' .. i] = args[i]
i = i + 1
end
local listeISBN = References.isbn( newArgs )
local categ = References.categorise{'Ouvrage avec ISBN invalide', newArgs.categ.isbnInvalid }
return '(' .. listeISBN .. ')' .. categ
else
return '(ISBN inconnu)' .. References.categorise{'ISBN nécessaire'}
end
end
Biblio.ISSN = function ( frame )
local args = Outils.extractArgs( frame )
local References = require( 'Module:Biblio/Références' )
if Outils.trim(args[1]) then
local newArgs = { issn = args[1], categ = { issnInvalid = false } }
local i = 2
while args[i] do
newArgs['issn' .. i] = args[i]
i = i + 1
end
local listeISSN = References.issn( newArgs )
local categ = References.categorise{'Page avec ISSN invalide', newArgs.categ.issnInvalid }
return '(' .. listeISSN .. ')' .. categ
else
return '(inconnu)' .. References.categorise{'ISSN nécessaire'}
end
end
Biblio.rechercheIssn = function( frame ) local args = Outils.extractArgs( frame ) local References = require( 'Module:Biblio/Références' ) local newArgs = { issn = args[1], categ = { issnInvalid = false } } local issn = References.issn( newArgs ) or issn = issn:gsub('^.- ', ) -- supprime le lien ISSN local categ = References.categorise{'Page avec ISSN invalide', newArgs.categ.issnInvalid } return issn .. categ end
Biblio.enLigne = function ( frame ) local args = Outils.extractArgs( frame ) local References = require( 'Module:Biblio/Références' ) return '[' .. References.enLigne( args ) .. ']' end
return Biblio