mercurial/minirst.py
changeset 15036 bb96e12a3242
parent 15015 ee6988aea74e
child 15037 df47381b41d6
equal deleted inserted replaced
15035:cc669e4fec95 15036:bb96e12a3242
    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