Mercurial > hg
comparison mercurial/minirst.py @ 41759:aaad36b88298
cleanup: use () to wrap long lines instead of \
This is a little less brittle, and often helps indentation. In a
surprising number of cases the entire cleanup was deleting the \, as
the expression was *already* parenthesized in a workable way.
Differential Revision: https://phab.mercurial-scm.org/D5993
author | Augie Fackler <augie@google.com> |
---|---|
date | Wed, 20 Feb 2019 19:28:51 -0500 |
parents | 876494fd967d |
children | f9cdd732cb58 |
comparison
equal
deleted
inserted
replaced
41758:15d3facfa40a | 41759:aaad36b88298 |
---|---|
112 i -= 1 | 112 i -= 1 |
113 elif blocks[i]['lines'][-1].endswith(' ::'): | 113 elif blocks[i]['lines'][-1].endswith(' ::'): |
114 # Partially minimized form: remove space and both | 114 # Partially minimized form: remove space and both |
115 # colons. | 115 # colons. |
116 blocks[i]['lines'][-1] = blocks[i]['lines'][-1][:-3] | 116 blocks[i]['lines'][-1] = blocks[i]['lines'][-1][:-3] |
117 elif len(blocks[i]['lines']) == 1 and \ | 117 elif (len(blocks[i]['lines']) == 1 and |
118 blocks[i]['lines'][0].lstrip(' ').startswith('.. ') and \ | 118 blocks[i]['lines'][0].lstrip(' ').startswith('.. ') and |
119 blocks[i]['lines'][0].find(' ', 3) == -1: | 119 blocks[i]['lines'][0].find(' ', 3) == -1): |
120 # directive on its own line, not a literal block | 120 # directive on its own line, not a literal block |
121 i += 1 | 121 i += 1 |
122 continue | 122 continue |
123 else: | 123 else: |
124 # Fully minimized form: remove just one colon. | 124 # Fully minimized form: remove just one colon. |
788 while pointer < len(secs): | 788 while pointer < len(secs): |
789 section = secs[-pointer][2][0] | 789 section = secs[-pointer][2][0] |
790 if section['type'] != 'margin': | 790 if section['type'] != 'margin': |
791 sindent = section['indent'] | 791 sindent = section['indent'] |
792 if len(section['lines']) > 1: | 792 if len(section['lines']) > 1: |
793 sindent += len(section['lines'][1]) - \ | 793 sindent += (len(section['lines'][1]) - |
794 len(section['lines'][1].lstrip(' ')) | 794 len(section['lines'][1].lstrip(' '))) |
795 if bindent >= sindent: | 795 if bindent >= sindent: |
796 break | 796 break |
797 pointer += 1 | 797 pointer += 1 |
798 if pointer > 1: | 798 if pointer > 1: |
799 blevel = secs[-pointer][1] | 799 blevel = secs[-pointer][1] |