יחידה:ParamValidator: הבדלים בין גרסאות בדף

תוכן שנמחק תוכן שנוסף
מ עיצוב
לדרישת הקהל
שורה 29:
after replacing the follwing tokens:
-- "templatename" is replaced with the actual template name,
-- "tname-naked" is replaced with the naked template name, i.e. without colon and namespace
-- "paramname" is replaced by a comma-separated list of parameters offending the rule.
-- "paramandvalue" is replaced by comma-separated list of "name: value" pairs of parameters and values
שורה 92 ⟵ 93:
local td_p = templatedata and templatedata.params -- now we have options, template args, and td params metadata. we can work now.
local report = ''
 
local wrap_report = function()
if empty( report ) then return '' end
local rawreport = ( options['wrapper-prefix'] or "<div class = 'paramvalidator-wrapper'>" )
.. report
.. ( options['wrapper-suffix'] or "</div>" )
local naked = mw.title.new(template_name)['text']
return ( mw.ustring.gsub( raw, 'templatename', template_name ) )
report = mw.ustring.gsub( raw, 'tname-naked', template_name )
returnreport (= mw.ustring.gsub( rawreport, 'templatename', template_name ) )
return report
end
 
שורה 110 ⟵ 115:
local replace_macros = function( s, param_names )
local paramstr, paramvaluestr, paramvaluetab = '', '', {}
if type( param_names ) == 'table' then
paramstr = table.concat( param_names, ', ' )