Zum Inhalt springen

Modul:LinkISBN: Unterschied zwischen den Versionen

+Failsafe
(Wartung)
(+Failsafe)
Zeile 21: Zeile 21:
-- module import
-- module import
local ci = require( 'Module:Check_isxn' )
local ci = require( 'Module:Check_isxn' )
local fs = require( 'Module:Failsafe' )
local lb = require( 'Module:LinkBase' )
local lb = require( 'Module:LinkBase' )
local yn = require( 'Module:Yesno' )
local yn = require( 'Module:Yesno' )


function li.linkISBN( m, noerror, demo )
-- link a single ISBN
function li._linkISBN( m, noerror, demo )
m = mw.text.trim( m )
m = mw.text.trim( m )
if m == '' then -- empty string
if m == '' then -- empty string
Zeile 45: Zeile 47:
end
end


function li.linkISBNSet( args )
-- link a list of several ISBNs
function li._linkISBNSet( args )
args.isbn    = args.isbn or args[ 1 ] or ''
args.isbn    = args.isbn or args[ 1 ] or ''
args.noerror = yn( args.noerror, false )
args.noerror = yn( args.noerror, false )
Zeile 62: Zeile 65:
-- analyse ISBNs
-- analyse ISBNs
for i = 1, #items, 1 do
for i = 1, #items, 1 do
s = li.linkISBN( items[ i ], args.noerror, isDemo )
s = li._linkISBN( items[ i ], args.noerror, isDemo )
if s ~= '' then
if s ~= '' then
result = ( result ~= '' and result .. ', ' or '' ) .. s
result = ( result ~= '' and result .. ', ' or '' ) .. s
Zeile 68: Zeile 71:
end
end
return result
return result
end
function li.LinkISBN()
return LinkISBN
end
fs.failsafe = function( version )
return fs._failsafe( version, LinkISBN ) or ''
end
end


function li.linkISBNs( frame )
function li.linkISBNs( frame )
return li.linkISBNSet( frame:getParent().args )
return li._linkISBNSet( frame:getParent().args )
end
end


return li
return li
Anonymer Benutzer