Differenze tra le versioni di "Modulo:Css"

230 byte aggiunti ,  01:41, 14 lug 2018
m
Managed empty strings in parsing. Fixed mw.clone errors
(Added supoort for predefinite styles and classes/styles parsing)
m (Managed empty strings in parsing. Fixed mw.clone errors)
local css = {}
 
local str = require('Modulo:Wikilib/strings') -- luacheck: no unused
local w = require('Modulo:Wikilib')
local c = mw.loadData('Modulo:Colore/data')
-- Parses an HTML class attribute value into a list of strings
parser.parseClasses = function(classes)
returnif type(classes) == 'string' and mw.text.split(classes, ' ') or classesthen
return --]]{}
elseif type(classes) ~= 'string' then
return classes
end
 
return mw.text.split(classes, ' ')
end
 
--]]
parser.parseStyles = function(stys)
if type(stys) ~== 'string' then
return {}
elseif type(stys) ~= 'string' then
return stys
end
stys = parser.parseStyles(stys or {})
 
if pdfs and pdfs ~= '' then
pdfs = type(pdfs) == 'string' and mw.text.split(pdfs, ' ') or pdfs
for _, predef in pairs(pdfs) do
classeslocal pdf = table.merge(classes, predefs[predef[predefs].classes)
--[[if pdf then
stysclasses is the second argument of= table.merge(classes, so thatpdf.classes)
user-supplied styles override predefinite ones-[[
stys is the second argument of table.merge so that
--]]
stys = table.merge(predefs[predef]. user-supplied styles, stys)override predefinite ones
--]]
stys = table.merge(pdf.styles, stys)
end
end
end
--]]
css['horiz-grad'] = function(frame)
return css.horizGradLua(mwtable.clonecopy(frame.args))
end
css.horizGrad, css.horiz_grad = css['horiz-grad'], css['horiz-grad']
--]]
css['vert-grad'] = function(frame)
return css.vertGradLua(mwtable.clonecopy(frame.args))
end
css.vertGrad, css.vert_grad = css['vert-grad'], css['vert-grad']
--]]
css['slanted-grad'] = function(frame)
return css.slantedGradLua(mwtable.clonecopy(frame.args))
end
css.slantedGrad, css.slanted_grad =
--]]
css['radial-grad'] = function(frame)
return css.radialGradLua(mwtable.clonecopy(frame.args))
end
css.radialGrad, css.radial_grad =