tools/lib: Text-wrap long lines exceeding 110.

This commit is contained in:
rht
2017-11-08 03:47:28 +01:00
committed by Tim Abbott
parent 53e37aa511
commit 7a96b8c7ad
4 changed files with 13 additions and 7 deletions

View File

@@ -25,7 +25,8 @@ if __name__ == "__main__":
properties[Profiles.CSS_LEVEL_2]['-webkit-text-size-adjust'] = r'none|auto|{percentage}' properties[Profiles.CSS_LEVEL_2]['-webkit-text-size-adjust'] = r'none|auto|{percentage}'
properties[Profiles.CSS_LEVEL_2]['-webkit-font-smoothing'] = r'none|antialiased|subpixel-antialiased' properties[Profiles.CSS_LEVEL_2]['-webkit-font-smoothing'] = r'none|antialiased|subpixel-antialiased'
properties[Profiles.CSS_LEVEL_2]['mso-hide'] = 'all' properties[Profiles.CSS_LEVEL_2]['mso-hide'] = 'all'
properties[Profiles.CSS_LEVEL_2]['pointer-events'] = (r'auto|none|visiblePainted|visibleFill|visibleStroke|' properties[Profiles.CSS_LEVEL_2]['pointer-events'] = (r'auto|none|visiblePainted|'
r'visibleFill|visibleStroke|'
r'visible|painted|fill|stroke|all|inherit') r'visible|painted|fill|stroke|all|inherit')
profile.addProfiles([(Profiles.CSS_LEVEL_2, properties[Profiles.CSS_LEVEL_2], macros[Profiles.CSS_LEVEL_2])]) profile.addProfiles([(Profiles.CSS_LEVEL_2, properties[Profiles.CSS_LEVEL_2], macros[Profiles.CSS_LEVEL_2])])

View File

@@ -94,8 +94,9 @@ def pretty_print_html(html, num_spaces=4):
ignore_lines=[] ignore_lines=[]
) )
stack.append(info) stack.append(info)
elif token.kind in ('html_end', 'handlebars_end', elif (token.kind in ('html_end', 'handlebars_end', 'html_singleton_end',
'html_singleton_end', 'django_end') and (stack[-1]['tag'] != 'pre' or token.tag == 'pre'): 'django_end') and
(stack[-1]['tag'] != 'pre' or token.tag == 'pre')):
info = stack.pop() info = stack.pop()
if info['block']: if info['block']:
# We are at the end of an indentation block. We # We are at the end of an indentation block. We
@@ -121,7 +122,8 @@ def pretty_print_html(html, num_spaces=4):
info['extra_indent_prev']) info['extra_indent_prev'])
elif (start_line + info['line_span'] - 1 == end_line and elif (start_line + info['line_span'] - 1 == end_line and
info['line_span'] > 2 and token.kind != 'html_singleton_end'): info['line_span'] > 2 and token.kind != 'html_singleton_end'):
offsets[end_line] = (1 + info['extra_indent'] + (info['depth'] + 1) * num_spaces) - adjustment offsets[end_line] = (1 + info['extra_indent'] +
(info['depth'] + 1) * num_spaces) - adjustment
elif token.line != info['line']: elif token.line != info['line']:
offsets[end_line] = info['offset'] offsets[end_line] = info['offset']
if token.tag != 'pre' and token.kind != 'html_singleton_end' and token.tag != 'script': if token.tag != 'pre' and token.kind != 'html_singleton_end' and token.tag != 'script':
@@ -184,7 +186,8 @@ def validate_indent_html(fn):
temp_file = open('/var/tmp/pretty_html.txt', 'w') temp_file = open('/var/tmp/pretty_html.txt', 'w')
temp_file.write(phtml) temp_file.write(phtml)
temp_file.close() temp_file.close()
print('Invalid Indentation detected in file: %s\nDiff for the file against expected indented file:' % (fn)) print('Invalid Indentation detected in file: '
'%s\nDiff for the file against expected indented file:' % (fn))
subprocess.call(['diff', fn, '/var/tmp/pretty_html.txt'], stderr=subprocess.STDOUT) subprocess.call(['diff', fn, '/var/tmp/pretty_html.txt'], stderr=subprocess.STDOUT)
return 0 return 0
return 1 return 1

View File

@@ -88,7 +88,8 @@ if platform.architecture()[0] == '64bit':
elif platform.architecture()[0] == '32bit': elif platform.architecture()[0] == '32bit':
arch = "i386" arch = "i386"
else: else:
logging.critical("Only x86 is supported; ping zulip-devel@googlegroups.com if you want another architecture.") logging.critical("Only x86 is supported;"
"ping zulip-devel@googlegroups.com if you want another architecture.")
sys.exit(1) sys.exit(1)
# Ideally we wouldn't need to install a dependency here, before we # Ideally we wouldn't need to install a dependency here, before we

View File

@@ -15,5 +15,6 @@ def check_venv(filename):
if user_name != 'vagrant' and user_name != 'zulipdev': if user_name != 'vagrant' and user_name != 'zulipdev':
print("If you are using Vagrant, you can `vagrant ssh` to enter the Vagrant guest.") print("If you are using Vagrant, you can `vagrant ssh` to enter the Vagrant guest.")
else: else:
print("You can `source /srv/zulip-py3-venv/bin/activate` to enter the Zulip development environment.") print("You can `source /srv/zulip-py3-venv/bin/activate` "
"to enter the Zulip development environment.")
sys.exit(1) sys.exit(1)