From 0ebafce1f7cf455568020b21d250e14b9f886e0d Mon Sep 17 00:00:00 2001 From: Geoff Leyland Date: Tue, 17 Jun 2014 14:17:15 +1200 Subject: [PATCH] normalise more title characters to spaces in column_map:new - in fact the same ones as in column_map:read_header --- lua/csv.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/csv.lua b/lua/csv.lua index 972c431..e732b46 100644 --- a/lua/csv.lua +++ b/lua/csv.lua @@ -46,10 +46,10 @@ function column_map:new(columns) if type(v) == "table" then t = { transform = v.transform, default = v.default } if v.name then - names = { (v.name:gsub("_+", " ")) } + names = { (v.name:gsub("[^%w%d]+", " ")) } elseif v.names then 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 else if type(v) == "function" then @@ -60,7 +60,7 @@ function column_map:new(columns) end if not names then - names = { (n:lower():gsub("_", " ")) } + names = { (n:lower():gsub("[^%w%d]+", " ")) } end t.name = n