Módulo:Citas: Diferenzas entre revisións
Contido eliminado Contido engadido
m Protexeu "Módulo:Citas" ([Editar=Permitir só aos usuarios autoconfirmados] (indefinido) [Mover=Permitir só aos usuarios autoconfirmados] (indefinido)) |
m corrixo local function lccn(lccn) copiando da wiki en: |
||
Liña 274:
]]
local function lccn(
local handler = cfg.id_handlers['LCCN'];
local err_cat = ''; -- presume that LCCN is valid
local id = lccn; -- local copy of the lccn
id = normalize_lccn (id); -- get canonical form (no whitespace, hyphens, forward slashes)
local len = id:len(); -- get the length of the lccn
if 8 == len then
if id:match("[^%d]") then -- if LCCN has anything but digits (nil if only digits)
err_cat = ' ' ..
end
elseif 9 == len then -- LCCN should be adddddddd
if nil == id:match("%
err_cat = ' ' ..
end
elseif 10 == len then -- LCCN should be aadddddddd or dddddddddd
if id:match("[^%d]") then -- if LCCN has anything but digits (nil if only digits) ...
if nil == id:match("^%
err_cat = ' ' ..
end
end
elseif 11 == len then -- LCCN should be aaadddddddd or adddddddddd
if not (id:match("^%
err_cat = ' ' ..
end
elseif 12 == len then -- LCCN should be aadddddddddd
if not id:match("^%
err_cat = ' ' ..
end
else
err_cat = ' ' ..
end
if not is_set (err_cat) and nil ~= lccn:find ('%s') then
return externallinkid({link = handler.link, label = handler.label,▼
err_cat = ' ' .. set_error( 'bad_lccn' ); -- lccn contains a space, set an error message
prefix=handler.prefix,id=id,separator=handler.separator, encode=handler.encode}) .. err_cat;▼
end
end
|