« Module:Romain » : différence entre les versions

Contenu supprimé Contenu ajouté
Aucun résumé des modifications
changement de la gestion des paramètres erronés
Ligne 66 :
str = str:upper()
if not str:find( '^[MDCLXVI]+$' ) then
ifreturn tonumber( str ) or default thenor str
return default
else
error( 'fromRoman expect a string containing only M, D, C, L, X, V or I letters' )
end
end
local smallRomans = { I = 1, V = 5, X = 10, L = 50, C = 100, D = 500, M = 1000 }
Ligne 104 ⟶ 100 :
num = frame
end
return p.toRoman( mw.text.trim( num or '' ) )
end
 
function p.nombreDepuisRomain( frame )
local numstr
if frame == mw.getCurrentFrame() then
numstr = frame.args[1] or frame:getParent().args[1]
else
numstr = frame
end
return p.fromRoman( mw.text.trim( numstr or '' ) )
end