diff --git a/tools/inline-email-css b/tools/inline-email-css index 3f68371674..21285383c1 100755 --- a/tools/inline-email-css +++ b/tools/inline-email-css @@ -59,10 +59,21 @@ if __name__ == "__main__": # template, since we'll end up with 2 copipes of those tags. # Thus, we strip this stuff out if the template extends # another template. + end_block = '\n' start = output.find('{% extends') - end = output.find('{% endblock %}\n') + end = output.rfind(end_block) if start != -1 and end != -1: - output = output[start:end+len('{% endblock %}')] + output = output[start:end] + else: + # Only the base-default template should not be using this system. + assert template == 'email_base_default' + + if ('zerver/emails/compiled/email_base_default.html' in output or + 'zerver/emails/email_base_messages.html' in output): + assert output.count('') == 0 + assert output.count('') == 0 + assert output.count('') == 0 + assert output.count('') == 0 with open(compiled_template_path, 'w') as final_template_file: final_template_file.write(output)