Modulo:Check bibcode: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
Grasso Luigi (discussione | contributi)
Nuova pagina: require('Modulo:No globals'); local p = {} --[[--------------------------< B I B C O D E >-------------------------------------------------------------------- Validat...
 
m modulo no globals obsoleto
 
(Una versione intermedia di un altro utente non mostrate)
Riga 1:
require('Modulo:No globalsstrict');
 
local p = {}
 
Line 26 ⟶ 27:
 
if 19 ~= id:len() then
err_type = 'lengthlunghezza';
else
year = id:match ("^(%d%d%d%d)[%a][%a&%.][%a&%.%d][%a&%.%d][%a%d%.]+[%a%.]$") --
if not year then -- if nil then no pattern match
err_type = 'valuevalore'; -- so value error
else
local next_year = tonumber(os.date ('%Y'))+1; --get the current year as a number and add one for next year
year = tonumber (year); -- convert year portion of bibcode to a number
if (1000 > year) or (year > next_year) then
err_type = 'yearanno'; -- year out of bounds
end
if id:find('&%.') then
err_type = 'journalpubblicazione'; -- journal abbreviation must not have '&.' (if it does its missing a letter)
end
end
Line 60 ⟶ 61:
local err_type = bibcode (frame.args[1]);
if err_type then
return '<span style="font-size:100%" class="error citation-comment">CheckAnalisi del bibcode: ' .. err_type .. ' ([[Template:Bibcode#Error_messagesMessaggi di errore|helpaiuto]])</span>';
end
return '';