mirror of
https://github.com/geoffleyland/lua-csv.git
synced 2024-11-23 01:34:19 +00:00
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:
parent
ec99b22fae
commit
0ebafce1f7
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user