Module:Dièse couleur web

De Les Mots de l'agronomie
Aller à la navigationAller à la recherche

local z = {}

function z.main(frame)

   local value = mw.text.trim(frame.args[1])
   if value:find('#') == 1 then
       return '#' .. value:sub(2)
   elseif mw.ustring.match(value, '^%x%x%x%x%x%x$') or mw.ustring.match(value, '^%x%x%x$') then
       return '#' .. value
   else
       return value
   end

end

return z