La documentation pour ce module peut être créée à Module:Biblio/doc

-- Lo modulo biblio centralise les difèrentes fonccions utiles por les bibliografies et rèferences.

local Biblio = {  }

require( 'Module:No globals' )
local Outils = require( 'Module:Outils' )


Biblio.ovra = function ( frame )
	local args = Outils.extractArgs( frame )
	local Ovra = require( 'Module:Biblio/Ôvra' )
	return Ovra.ovra( args ) 
end


Biblio.chapitro = function ( frame )
	local args = Outils.extractArgs( frame )
	local Ovra = require( 'Module:Biblio/Ôvra' )
	return Ovra.chapitro( args ) 
end


Biblio.articllo = function ( frame )
	local args = Outils.extractArgs( frame )
	local Ovra = require( 'Module:Biblio/Articllo' )
	return Ovra.articllo( args ) 
end


Biblio.limVouebe = function( frame )
	local args = Outils.extractArgs( frame )
	local Ovra = require( 'Module:Biblio/Lim Vouèbe' )
	return Ovra.limVouebe( args ) 
end

Biblio.limCasso = function( frame )
	local args = Outils.extractArgs( frame )
	local Ovra = require( 'Module:Biblio/Lim Vouèbe' )
	return Ovra.limCasso( args )
end


Biblio.diccionero = function( frame )
	local args = Outils.extractArgs( frame )
	local articllo = Outils.validTextArg( args, 'notiça', 'articllo', 'titro chapitro' )
	local Ovra = require( 'Module:Biblio/Ôvra' )
	if articllo then
		args['titro chapitro'] = articllo
		return Ovra.chapitro( args ) 
	else
		args.titro = args['titro ôvra']
		args['sot-titro'] = args['sot-titro ôvra']
		args.otor1 = args['ôtor ôvra']
		args.otors = args['ôtors ôvra']
		return Ovra.ovra( args )
	end
end

-- catégorise une page en fonction du namespace
local function categorise(args)
	local namespaceCategorisation = { [0] = true, [4] = true, [10] = true, [12] = true, [14] = true, [100] = true, [104] = true }
	local category = args[1]
	local flag = args[2]
	if type(category) == 'string'
		and flag 
		and namespaceCategorisation[ mw.title.getCurrentTitle().namespace ]
	then
		return '[[Category:' .. category .. ']]'
	end
	return ''
end

Biblio.ISBN = function ( frame )
	local args = Outils.extractArgs( frame )
	if Outils.trim( args[1] ) then
		local newArgs = { isbn = args[1] }
		local i = 2
		while args[i] do
			newArgs[ 'isbn' .. i ] = args[i]
			i = i + 1
		end
		return Biblio.identifientsBiblio( newArgs )
	else 
		return '<small>([[International Standard Book Number|ISBN]]&nbsp;encognu)</small>' .. categorise{ 'ISBN nècèssèro', true }
	end
end

Biblio.rechercheIsbn = function( frame )
	local args = Outils.extractArgs( frame )
	local References = require( 'Module:Biblio/Rèferences' )
	local newArgs = { isbn = args[1], senLambel = true, categ = {} }
	local isbn = References.isbn( newArgs ) or ''
	local categ = categorise{ 'Pâge avouéc ISBN envalido', newArgs.categ.isbnInvalid }
	return isbn .. categ
end


Biblio.EAN = function ( frame )
	local args = Outils.extractArgs( frame )
	if Outils.trim( args[1] ) then
		local newArgs = { ean = args[1], categ = {} }
		local i = 2
		while args[i] do
			newArgs[ 'ean' .. i ] = args[i]
			i = i + 1
		end
		return Biblio.identifientsBiblio( newArgs )
	else 
		return '<small>([[EAN 13|EAN]]&nbsp;encognu)</small>[[Catègorie:EAN nècèssèro]]'
	end
end


Biblio.ISSN = function ( frame )
	local args = Outils.extractArgs( frame )
	if Outils.trim( args[1] ) then
		local newArgs = { issn = args[1], categ = {} }
		local i = 2
		while args[i] do
			newArgs[ 'issn' .. i ] = args[i]
			i = i + 1
		end
		return Biblio.identifientsBiblio( newArgs )
	else 
		return '<small>([[International Standard Serial Number|ISSN]]&nbsp;encognu)</small>' .. categorise{ 'ISSN nècèssèro', true }
	end
end

Biblio.rechercheIssn = function( frame )
	local args = Outils.extractArgs( frame )
	local References = require( 'Module:Biblio/Rèferences' )
	local newArgs = { issn = args[1], senLambel = true, categ = {} }
	local issn = References.issn( newArgs ) or ''
	local categ = categorise{ 'Pâge avouéc ISSN envalido', newArgs.categ.issnInvalid }
	return issn .. categ
end

Biblio.BNF = function ( frame )
	local References = require( 'Module:Biblio/Rèferences' )
	return References.bnf( Outils.extractArgs( frame )[1] )
end

Biblio.enLegne = function ( frame )
	local args = Outils.extractArgs( frame )
	local References = require( 'Module:Biblio/Rèferences' )
	return '<small>[' .. References.enLegne( args )  .. ']</small>'
end

Biblio.identifientsBiblio = function( frame )
	local args = Outils.extractArgs( frame )
	args.categ = {}
	local References = require( 'Module:Biblio/Rèferences' )
	return References.afichajoLimsDeDefor( args, nil, true, true ) 
		.. categorise{ 'Pâge avouéc ISBN envalido', args.categ.isbnInvalid }
		.. categorise{ 'Pâge avouéc ISSN envalido', args.categ.issnInvalid }
		.. categorise{ 'Pâge avouéc EAN envalido', args.categ.eanInvalid }
end

return Biblio