Naruto Wiki
(Correction.)
Balise : sourceedit
(Correction.)
Balise : sourceedit
Ligne 7 : Ligne 7 :
 
 
 
local chaine = frame.args[1]
 
local chaine = frame.args[1]
local ret = ''
 
 
 
 
--si la donnée n'est pas vide
 
--si la donnée n'est pas vide
 
if (chaine ~= nil and chaine ~= '') then
 
if (chaine ~= nil and chaine ~= '') then
 
 
return frame:preprocess(string.gsub( chaine, '%d([^%s]*)', '{{Exp|%1}}'))
+
return frame:preprocess(string.gsub( chaine, '(%d)([^%s]*)', '%1{{Exp|%2}}'))
 
 
 
end
 
end

Version du 29 février 2016 à 18:53

La documentation pour ce module peut être créée à Module:FormatageChaine/doc

--@author: Celdrøn
--<nowiki>
 
local p = {}
 
function p.formatageChaine(frame)
 
    local chaine = frame.args[1]
 
    --si la donnée n'est pas vide
    if (chaine ~= nil and chaine ~= '') then
 
        return frame:preprocess(string.gsub( chaine, '(%d)([^%s]*)', '%1{{Exp|%2}}'))
 
    end
 
    return chaine
 
end
 
return p
 
--</nowiki>
 
--[[Catégorie:Modules Lua]]