Fix argument_call_classes breaking on "==".

This commit is contained in:
voussoir 2021-09-24 16:18:00 -07:00
parent 89dcb5ee0e
commit ada3fc4caa
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -498,6 +498,7 @@ def fix_argument_call_classes(element):
''' '''
# print('INPUT', repr(element)) # print('INPUT', repr(element))
paren_depth = 0 paren_depth = 0
last_known_candidate = None
while True: while True:
element = next_element_sibling(element) element = next_element_sibling(element)
# print(element, paren_depth) # print(element, paren_depth)
@ -512,9 +513,10 @@ def fix_argument_call_classes(element):
if 'n' in element['class']: if 'n' in element['class']:
last_known_candidate = element last_known_candidate = element
if 'o' in element['class'] and innertext == '=': if last_known_candidate and 'o' in element['class'] and innertext == '=':
last_known_candidate['class'].remove('n') last_known_candidate['class'].remove('n')
last_known_candidate['class'].append('narg') last_known_candidate['class'].append('narg')
last_known_candidate = None
if paren_depth == 0: if paren_depth == 0:
break break