Skip to content

Commit

Permalink
Handling spaces better
Browse files Browse the repository at this point in the history
Switches single spaces and empty cells to   and back to spaces.
  • Loading branch information
guntrip committed Oct 8, 2015
1 parent 02f8cbd commit 2eb610e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion magic.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,12 +395,15 @@ function html2array_cells(html, splitter) {
var cell = html_cell.replace(/<(?:.|\n)*?>/gm, '');
cell=cell.trim();

cell=cell.replace(/&nbsp;/g, ' ');

if ( (cell!=="") ) { result.push(cell); }


}

}

console.log(result);
return result;

}
Expand Down Expand Up @@ -442,6 +445,7 @@ var html = " <tr>\n";

for (var c = 0; c < row.length; c++) {

if ((row[c]==="")||(row[c]===" ")) { row[c]="&nbsp;"; }
html += " <"+tag+">"+row[c]+"</"+tag+">\n";

}
Expand Down

0 comments on commit 2eb610e

Please sign in to comment.