Modul:LinkISBN: Unterschied zwischen den Versionen

K
31 Versionen von wikivoyage:Modul:LinkISBN importiert
(code check)
K (31 Versionen von wikivoyage:Modul:LinkISBN importiert)
 
(3 dazwischenliegende Versionen von einem anderen Benutzer werden nicht angezeigt)
Zeile 2: Zeile 2:
local LinkISBN = {
local LinkISBN = {
suite  = 'LinkISBN',
suite  = 'LinkISBN',
serial = '2020-05-16',
serial = '2021-04-08',
item  = 65157187
item  = 65157187
}
}
-- module variable, i18n
local li = {}


-- 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:LinkISBN/i18n' )
local lb = require( 'Module:LinkBase' )
local lu = require( 'Module:Link utilities' )
local li = require( 'Module:LinkBase/i18n' )
local yn = require( 'Module:Yesno' )
local yn = require( 'Module:Yesno' )
-- module variable and administration
local li = {
moduleInterface = LinkISBN
}


-- link a single ISBN
-- link a single ISBN
Zeile 24: Zeile 25:


local comment = ''
local comment = ''
m, comment = lb.extractComment( m )
m, comment = lu.extractComment( m )


m = m:gsub( 'ISBN *', '' ):upper() -- x -> X
m = m:gsub( 'ISBN *', '' ):upper() -- x -> X
local t = '<span class="' .. li.classes.booksources .. '" title="'
local t = '<span class="' .. lb.booksourcesClass .. '">[[Special:Booksources/'
.. li.categories.special .. m .. '">[[' .. li.categories.special
.. m .. '|' .. 'ISBN ' .. m .. ']]</span>'
.. m .. '|' .. 'ISBN ' .. m .. ']]</span>'
if not ignoreError then
if not ignoreError then
t = t .. ci._check_isbn( m,
t = t .. ci._check_isbn( m,
li.categories.invalidISBN .. ( demo and '' or li.categories.invalidCat ) )
lb.invalidISBN .. ( demo and '' or lb.invalidCat ) )
end
end
if comment ~= '' then
if comment ~= '' then
Zeile 51: Zeile 51:
local ns    = mw.title.getCurrentTitle().namespace
local ns    = mw.title.getCurrentTitle().namespace
local isDemo = ns == 10 or ns == 828
local isDemo = ns == 10 or ns == 828
 
-- split separate ISBNs
-- split separate ISBNs
local items = lb.splitItems( args.isbn, li.delimiters )
local items = lu.splitItems( args.isbn, lb.delimiters )
-- analyse ISBNs
-- analyse ISBNs
Zeile 65: Zeile 65:
end
end
return result
return result
end
function li.LinkISBN()
return LinkISBN
end
function li.failsafe( version )
return fs._failsafe( version, LinkISBN ) or ''
end
end