normalise more title characters to spaces in column_map:new - in fact the same ones as in column_map:read_header

This commit is contained in:
Geoff Leyland 2014-06-17 14:17:15 +12:00
parent ec99b22fae
commit 0ebafce1f7

View File

@ -46,10 +46,10 @@ function column_map:new(columns)
if type(v) == "table" then if type(v) == "table" then
t = { transform = v.transform, default = v.default } t = { transform = v.transform, default = v.default }
if v.name then if v.name then
names = { (v.name:gsub("_+", " ")) } names = { (v.name:gsub("[^%w%d]+", " ")) }
elseif v.names then elseif v.names then
names = v.names names = v.names
for i, n in ipairs(names) do names[i] = n:gsub("_+", " ") end for i, n in ipairs(names) do names[i] = n:gsub("[^%w%d]+", " ") end
end end
else else
if type(v) == "function" then if type(v) == "function" then
@ -60,7 +60,7 @@ function column_map:new(columns)
end end
if not names then if not names then
names = { (n:lower():gsub("_", " ")) } names = { (n:lower():gsub("[^%w%d]+", " ")) }
end end
t.name = n t.name = n