def split_table_cells(self, row):
        """
        An iterator returning all the table cells in a row with their positions,
        accounting for escaping.
        """

        row = iter(row)
        col = 0
        start_col = col + 1
        cell = ''
        first_cell = True
        while True:
            char = next(row, None)
            col += 1
            if char == '|':
                if first_cell:
                    # First cell (content before the first |) is skipped
                    first_cell = False
                else:
                    yield (cell, start_col)
                cell = ''
                start_col = col + 1
            elif char == '\\':
                char = next(row)
                col += 1
                if char == 'n':
                    cell += '\n'
                else:
                    if char not in ['|', '\\']:
                        cell += '\\'
                    cell += char
            elif char:
                cell += char
            else:
                break
def split_table_cells ( self , row ) : row = iter ( row ) col = 0 start_col = col + 1 cell = '' first_cell = True while True : char = next ( row , None ) col += 1 if char == '|' : if first_cell : first_cell = False else : yield ( cell , start_col ) cell = '' start_col = col + 1 elif char == '\\' : char = next ( row ) col += 1 if char == 'n' : cell += '\n' else : if char not in [ '|' , '\\' ] : cell += '\\' cell += char elif char : cell += char else : break
An iterator returning all the table cells in a row with their positions,
        accounting for escaping.