equal
deleted
inserted
replaced
37 |
37 |
38 Returns a list of dictionaries representing the blocks. Each block |
38 Returns a list of dictionaries representing the blocks. Each block |
39 has an 'indent' field and a 'lines' field. |
39 has an 'indent' field and a 'lines' field. |
40 """ |
40 """ |
41 blocks = [] |
41 blocks = [] |
42 for b in _blockre.split(text.strip()): |
42 for b in _blockre.split(text.lstrip('\n').rstrip()): |
43 lines = b.splitlines() |
43 lines = b.splitlines() |
44 indent = min((len(l) - len(l.lstrip())) for l in lines) |
44 indent = min((len(l) - len(l.lstrip())) for l in lines) |
45 lines = [l[indent:] for l in lines] |
45 lines = [l[indent:] for l in lines] |
46 blocks.append(dict(indent=indent, lines=lines)) |
46 blocks.append(dict(indent=indent, lines=lines)) |
47 return blocks |
47 return blocks |