Skip to content

Commit

Permalink
updating ST2 version of Table Cleaner scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
drewda committed May 15, 2014
1 parent b60e414 commit c5ba480
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion table_cleaner.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,23 @@ def get_settings(self):

# Split the lines by a separator
def split_lines(self, lines, separator):

for line in lines:
line[1] = line[1].split(separator)

# if there is no escaped separator, just use normal version
if "\\" + separator not in line[1]:
line[1] = line[1].split(separator)

# if there is escaped separator in table (eg: \&)
else:
temp_line = []
last_i = 0
for i in xrange(len(line[1])):
if line[1][i] == separator and line[1][i-1] != "\\":
temp_line.append(line[1][last_i:i])
last_i = i+1
temp_line.append(line[1][last_i:])
line[1] = temp_line

return lines

Expand Down

0 comments on commit c5ba480

Please sign in to comment.