Module:Piechart/sandbox: Difference between revisions

Content deleted Content added
changes from Github • Wikiploy
Report unknown $var • Wikiploy
 
(3 intermediate revisions by the same user not shown)
Line 179:
return options
end
 
-- internal for testing legend rendering
p.__priv.legendDebug = false
 
--[[
Line 215 ⟶ 218:
if options.legend then
html = html .. p.renderLegend(data, options)
end
 
if p.__priv.legendDebug then
return html
end
 
Line 368 ⟶ 375:
local bcolor = entry.bcolor
local html = "\n<li>"
if p.__priv.legendDebug then
forPrinting = ""
end
html = html .. '<span class="l-color" style="'..forPrinting..bcolor..'"></span>'
html = html .. '<span class="l-label">'..label..'</span>'
Line 423 ⟶ 433:
if (value < 0.03) then
mw.log('value too small', value, label)
mw.addWarning("pie chart: Value too small ↆ "..value.."% ("..label..")")
return ""
end
Line 605 ⟶ 615:
tpl = "$v"
else
if stringentry.label:find(entry.label, '"%$'[a-z]") then
tpl = entry.label
else
Line 634 ⟶ 644:
:gsub("%$d", d)
:gsub("%$v", v)
 
-- Report unknown variables
for var in label:gmatch("%$[a-zA-Z]+") do
-- in preview
mw.addWarning("pie chart: Unknown variable (wrong format of your label): " .. var)
-- tracing links
_ = mw.title.new("Module:Piechart/tracing/unknown-variable").id
end
 
return label
end