From dd3fa4ac52ae5bad546e405fe372de0de08cd437 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Tue, 20 Apr 2021 15:46:14 -0700 Subject: [PATCH] templates: Mark all void tags as self-closing. This reverses the policy that was set, but incompletely enforced, by commit 951514dd7dd2fafb67e9e9c6930d31b9295741c0. The self-closing tag syntax is clearer, more consistent, simpler to parse, compatible with XML, preferred by Prettier, and (most importantly now) required by FormatJS. Signed-off-by: Anders Kaseorg --- analytics/tests/test_views.py | 4 +- static/html/5xx.html | 6 +- static/templates/admin_profile_field_list.hbs | 2 +- .../templates/buddy_list_tooltip_content.hbs | 4 +- static/templates/compose_control_buttons.hbs | 2 +- static/templates/giphy_picker.hbs | 4 +- static/templates/hotspot_overlay.hbs | 2 +- static/templates/intro_reply_hotspot.hbs | 2 +- static/templates/markdown_help.hbs | 2 +- static/templates/message_edit_form.hbs | 6 +- static/templates/message_edit_history.hbs | 2 +- static/templates/move_topic_to_stream.hbs | 10 +-- static/templates/new_stream_users.hbs | 2 +- static/templates/recent_topics_table.hbs | 2 +- .../templates/settings/account_settings.hbs | 2 +- .../settings/default_streams_list_admin.hbs | 2 +- static/templates/stream_sidebar_actions.hbs | 2 +- static/templates/stream_subscription_info.hbs | 2 +- static/templates/topic_sidebar_actions.hbs | 2 +- .../user_group_info_popover_content.hbs | 4 +- .../templates/user_info_popover_content.hbs | 8 +- static/templates/user_profile_modal.hbs | 4 +- static/templates/widgets/poll_widget.hbs | 2 +- .../templates/widgets/todo_widget_tasks.hbs | 2 +- templates/500.html | 2 +- templates/analytics/activity.html | 4 +- templates/analytics/realm_details.html | 48 +++++------ templates/analytics/stats.html | 2 +- templates/analytics/support.html | 36 ++++----- templates/corporate/billing.html | 8 +- templates/corporate/jobs.html | 10 +-- templates/corporate/upgrade.html | 44 +++++----- templates/corporate/zephyr.html | 4 +- templates/zerver/accounts_accept_terms.html | 4 +- templates/zerver/accounts_home.html | 2 +- templates/zerver/app/home.html | 4 +- templates/zerver/app/index.html | 6 +- templates/zerver/app/keyboard_shortcuts.html | 2 +- templates/zerver/app/search_operators.html | 2 +- templates/zerver/apps.html | 2 +- templates/zerver/base.html | 8 +- templates/zerver/config_error.html | 2 +- .../zerver/confirm_continue_registration.html | 4 +- templates/zerver/deactivated.html | 2 +- templates/zerver/desktop_redirect.html | 2 +- templates/zerver/development/dev_tools.html | 4 +- templates/zerver/development/email_log.html | 2 +- .../development/integrations_dev_panel.html | 10 +-- templates/zerver/documentation_main.html | 2 +- templates/zerver/email.html | 2 +- templates/zerver/emails/digest.source.html | 2 +- .../zerver/emails/email_base_messages.html | 2 +- .../zerver/emails/followup_day1.source.html | 10 +-- .../zerver/emails/followup_day2.source.html | 2 +- .../zerver/emails/missed_message.source.html | 12 +-- .../emails/notify_change_in_email.source.html | 2 +- .../emails/notify_new_login.source.html | 2 +- .../zerver/emails/sponsorship_request.html | 10 +-- templates/zerver/for-companies.html | 2 +- templates/zerver/for-open-source.html | 4 +- templates/zerver/for-research.html | 2 +- .../for-working-groups-and-communities.html | 2 +- templates/zerver/hello.html | 54 ++++++------- templates/zerver/help/linking-to-zulip.md | 2 +- templates/zerver/history.html | 2 +- templates/zerver/integrations/index.html | 6 +- templates/zerver/invalid_realm.html | 2 +- templates/zerver/login.html | 4 +- templates/zerver/meta_tags.html | 26 +++--- templates/zerver/plans.html | 12 +-- templates/zerver/privacy.html | 2 +- templates/zerver/realm_creation_failed.html | 2 +- templates/zerver/register.html | 4 +- templates/zerver/security.html | 2 +- templates/zerver/team.html | 18 ++--- templates/zerver/terms.html | 2 +- templates/zerver/why-zulip.html | 2 +- templates/zerver/why-zulip.md | 6 +- tools/lib/template_parser.py | 80 +++++++++---------- tools/tests/test_html_branches.py | 79 +++++++++--------- tools/tests/test_pretty_print.py | 8 +- tools/tests/test_template_parser.py | 8 +- version.py | 2 +- zerver/tests/test_docs.py | 18 ++--- 84 files changed, 345 insertions(+), 346 deletions(-) diff --git a/analytics/tests/test_views.py b/analytics/tests/test_views.py index e7d1f795a1..bfa522755e 100644 --- a/analytics/tests/test_views.py +++ b/analytics/tests/test_views.py @@ -584,8 +584,8 @@ class TestSupportEndpoint(ZulipTestCase): 'user\n', f"

{full_name}

", f"Email: {email}", - "Is active: True
", - f"Role: {role}
", + "Is active: True
", + f"Role: {role}
", ], html_response, ) diff --git a/static/html/5xx.html b/static/html/5xx.html index 8d13754a78..7270824701 100644 --- a/static/html/5xx.html +++ b/static/html/5xx.html @@ -1,11 +1,11 @@ - + Zulip - 500 internal server error - + - + diff --git a/static/templates/admin_profile_field_list.hbs b/static/templates/admin_profile_field_list.hbs index 3ec05000b0..28f2148ff5 100644 --- a/static/templates/admin_profile_field_list.hbs +++ b/static/templates/admin_profile_field_list.hbs @@ -39,7 +39,7 @@
-
+
{{#each choices}} {{> settings/profile_field_choice }} diff --git a/static/templates/buddy_list_tooltip_content.hbs b/static/templates/buddy_list_tooltip_content.hbs index ab9c8eebeb..9c803e8baa 100644 --- a/static/templates/buddy_list_tooltip_content.hbs +++ b/static/templates/buddy_list_tooltip_content.hbs @@ -5,9 +5,9 @@ {{/if}} {{#if second_line}} -
{{second_line}} +
{{second_line}} {{/if}} {{#if third_line}} -
{{third_line}} +
{{third_line}} {{/if}}
diff --git a/static/templates/compose_control_buttons.hbs b/static/templates/compose_control_buttons.hbs index de2e1a82c3..0f2e795d59 100644 --- a/static/templates/compose_control_buttons.hbs +++ b/static/templates/compose_control_buttons.hbs @@ -8,7 +8,7 @@ {{#if giphy_api_available }} - + {{/if}} {{t 'Drafts' }} diff --git a/static/templates/giphy_picker.hbs b/static/templates/giphy_picker.hbs index 4be9fb257a..1353e5abac 100644 --- a/static/templates/giphy_picker.hbs +++ b/static/templates/giphy_picker.hbs @@ -2,7 +2,7 @@
diff --git a/static/templates/hotspot_overlay.hbs b/static/templates/hotspot_overlay.hbs index b4729118fc..734464f96c 100644 --- a/static/templates/hotspot_overlay.hbs +++ b/static/templates/hotspot_overlay.hbs @@ -7,7 +7,7 @@

{{description}}

- _("hotspot + _("hotspot
diff --git a/static/templates/intro_reply_hotspot.hbs b/static/templates/intro_reply_hotspot.hbs index b967202e4b..310d3311ae 100644 --- a/static/templates/intro_reply_hotspot.hbs +++ b/static/templates/intro_reply_hotspot.hbs @@ -1,7 +1,7 @@

Send a reply

- +

{{t 'Click anywhere on a message to reply.' }}

diff --git a/static/templates/markdown_help.hbs b/static/templates/markdown_help.hbs index d0226c7af3..2decf7c588 100644 --- a/static/templates/markdown_help.hbs +++ b/static/templates/markdown_help.hbs @@ -24,7 +24,7 @@
-
+
{{t "Detailed message formatting documentation" }}
diff --git a/static/templates/message_edit_form.hbs b/static/templates/message_edit_form.hbs index ff853c3279..77a10731d1 100644 --- a/static/templates/message_edit_form.hbs +++ b/static/templates/message_edit_form.hbs @@ -20,13 +20,13 @@ -
+
{{/each}} diff --git a/static/templates/move_topic_to_stream.hbs b/static/templates/move_topic_to_stream.hbs index 5757231d1c..33eb2d8d22 100644 --- a/static/templates/move_topic_to_stream.hbs +++ b/static/templates/move_topic_to_stream.hbs @@ -20,17 +20,17 @@ {{/each}} - - - + + +
diff --git a/static/templates/new_stream_users.hbs b/static/templates/new_stream_users.hbs index db5f8afaa2..de804d539b 100644 --- a/static/templates/new_stream_users.hbs +++ b/static/templates/new_stream_users.hbs @@ -17,7 +17,7 @@ {{/each}}
-
+
diff --git a/static/templates/recent_topics_table.hbs b/static/templates/recent_topics_table.hbs index 2275c21135..b5eca45881 100644 --- a/static/templates/recent_topics_table.hbs +++ b/static/templates/recent_topics_table.hbs @@ -3,7 +3,7 @@ {{> recent_topics_filters}}
- + diff --git a/static/templates/settings/account_settings.hbs b/static/templates/settings/account_settings.hbs index ed5ef03594..b8d6eaafc9 100644 --- a/static/templates/settings/account_settings.hbs +++ b/static/templates/settings/account_settings.hbs @@ -184,7 +184,7 @@
-
+

{{t "API key" }}

diff --git a/static/templates/settings/default_streams_list_admin.hbs b/static/templates/settings/default_streams_list_admin.hbs index e16304c68d..35aba7860e 100644 --- a/static/templates/settings/default_streams_list_admin.hbs +++ b/static/templates/settings/default_streams_list_admin.hbs @@ -11,7 +11,7 @@
{{t "Add new default stream" }}
- +
diff --git a/static/templates/stream_sidebar_actions.hbs b/static/templates/stream_sidebar_actions.hbs index ccc51769ba..229c3c5727 100644 --- a/static/templates/stream_sidebar_actions.hbs +++ b/static/templates/stream_sidebar_actions.hbs @@ -11,7 +11,7 @@

-
+
{{! tabindex="0" Makes anchor tag focusable. Needed for keyboard support. }}
  • diff --git a/static/templates/stream_subscription_info.hbs b/static/templates/stream_subscription_info.hbs index 18001c96bd..9df98dadc2 100644 --- a/static/templates/stream_subscription_info.hbs +++ b/static/templates/stream_subscription_info.hbs @@ -4,7 +4,7 @@ {{/if}} {{#unless @last}},{{else}}.{{/unless}} {{/each}} -
    +
    {{#each already_subscribed_users}} {{#if @first}} {{t "Already subscribed users:" }} diff --git a/static/templates/topic_sidebar_actions.hbs b/static/templates/topic_sidebar_actions.hbs index ff68d4cb2f..7edfa36551 100644 --- a/static/templates/topic_sidebar_actions.hbs +++ b/static/templates/topic_sidebar_actions.hbs @@ -6,7 +6,7 @@

  • -
    +
    {{#if can_mute_topic}}
  • diff --git a/static/templates/user_group_info_popover_content.hbs b/static/templates/user_group_info_popover_content.hbs index b7e059093f..062f800789 100644 --- a/static/templates/user_group_info_popover_content.hbs +++ b/static/templates/user_group_info_popover_content.hbs @@ -5,7 +5,7 @@ {{group_description}}
  • -
    +
    -
    +
    - +
    {% if free_trial %} @@ -133,13 +133,13 @@
    -
    +
    diff --git a/templates/zerver/app/home.html b/templates/zerver/app/home.html index 5a2a406572..cb7b5483ff 100644 --- a/templates/zerver/app/home.html +++ b/templates/zerver/app/home.html @@ -159,6 +159,6 @@
    diff --git a/templates/zerver/app/index.html b/templates/zerver/app/index.html index 6337ba6bc1..e4d9c2a3e3 100644 --- a/templates/zerver/app/index.html +++ b/templates/zerver/app/index.html @@ -4,12 +4,12 @@ {# Includes some other templates as tabs. #} {% block meta_viewport %} - + {% endblock %} {% block customhead %} - - + + diff --git a/templates/zerver/base.html b/templates/zerver/base.html index 0525ae29cb..bbace19bad 100644 --- a/templates/zerver/base.html +++ b/templates/zerver/base.html @@ -4,7 +4,7 @@ {# Base template for the whole site. #} - + {% block title %} {% if user_profile and user_profile.realm.name %} {{user_profile.realm.name}} - Zulip @@ -16,10 +16,10 @@ {% endif %} {% endif %} {% endblock %} - - + + {% block meta_viewport %} - + {% endblock %} {% if not user_profile %} {% include 'zerver/meta_tags.html' %} diff --git a/templates/zerver/config_error.html b/templates/zerver/config_error.html index f41ea176a5..99eb33f35e 100644 --- a/templates/zerver/config_error.html +++ b/templates/zerver/config_error.html @@ -9,7 +9,7 @@

    Configuration error

    -
    +
    {% if error_name == "ldap_error_realm_is_none" %} {% trans %} You are trying to log in using LDAP without creating an diff --git a/templates/zerver/confirm_continue_registration.html b/templates/zerver/confirm_continue_registration.html index 0f54bc21f2..6b60fb01cc 100644 --- a/templates/zerver/confirm_continue_registration.html +++ b/templates/zerver/confirm_continue_registration.html @@ -26,14 +26,14 @@ {{ _("Log in with another account") }} -
    +
    {% if full_name %} - + {% endif %}
    diff --git a/templates/zerver/deactivated.html b/templates/zerver/deactivated.html index 484ef71f91..92a1897354 100644 --- a/templates/zerver/deactivated.html +++ b/templates/zerver/deactivated.html @@ -2,7 +2,7 @@ {% block customhead %} {{ super() }} - + {% endblock %} {% block portico_content %} diff --git a/templates/zerver/desktop_redirect.html b/templates/zerver/desktop_redirect.html index fed4f12f08..2d5efa4e39 100644 --- a/templates/zerver/desktop_redirect.html +++ b/templates/zerver/desktop_redirect.html @@ -4,7 +4,7 @@ {% block content %}
    -
    +

    {% trans %}Copy this login token and return to your Zulip app to finish logging in:{% endtrans %}

    diff --git a/templates/zerver/development/dev_tools.html b/templates/zerver/development/dev_tools.html index 3d5b7316f7..fc7ca766ba 100644 --- a/templates/zerver/development/dev_tools.html +++ b/templates/zerver/development/dev_tools.html @@ -41,14 +41,14 @@ /emails - ./scripts/setup/inline_email_css.py
    + ./scripts/setup/inline_email_css.py
    Run the command if you made changes to source.html email templates. View outgoing and example emails. /stats/realm/analytics/ - ./manage.py populate_analytics_db
    + ./manage.py populate_analytics_db
    Run the command after changing analytics data population logic. View the /stats page with some pre-populated data diff --git a/templates/zerver/development/email_log.html b/templates/zerver/development/email_log.html index 60dfc0e579..949c09ff74 100644 --- a/templates/zerver/development/email_log.html +++ b/templates/zerver/development/email_log.html @@ -46,7 +46,7 @@

    -
    +
    -
    +
    -
    +
    -
    +
    diff --git a/templates/zerver/email.html b/templates/zerver/email.html index df9268e693..14b9812751 100644 --- a/templates/zerver/email.html +++ b/templates/zerver/email.html @@ -23,4 +23,4 @@ -
    +
    diff --git a/templates/zerver/emails/digest.source.html b/templates/zerver/emails/digest.source.html index 6938dcbdd3..db4d4fea92 100644 --- a/templates/zerver/emails/digest.source.html +++ b/templates/zerver/emails/digest.source.html @@ -29,7 +29,7 @@

    {{ new_streams.html|display_list(1000)|safe }}.

    {% endif %} -
    +

    {% trans %}Click here to log in to Zulip and catch up.{% endtrans %}

    {% endblock %} diff --git a/templates/zerver/emails/email_base_messages.html b/templates/zerver/emails/email_base_messages.html index c35452aae8..c93a4469a0 100644 --- a/templates/zerver/emails/email_base_messages.html +++ b/templates/zerver/emails/email_base_messages.html @@ -1,7 +1,7 @@ - + Zulip {% if has_preheader %} diff --git a/templates/zerver/emails/followup_day1.source.html b/templates/zerver/emails/followup_day1.source.html index 11fcb231a9..a2b2cefc4b 100644 --- a/templates/zerver/emails/followup_day1.source.html +++ b/templates/zerver/emails/followup_day1.source.html @@ -17,15 +17,15 @@

    {{ _('Your account details:') }} -

  • {% trans organization_url=macros.link_tag(realm_uri) %}Organization URL: {{ organization_url }}{% endtrans %}
  • +
  • {% trans organization_url=macros.link_tag(realm_uri) %}Organization URL: {{ organization_url }}{% endtrans %}
  • {% if ldap %} {% if ldap_username %} -
  • {% trans %}Username: {{ ldap_username }}{% endtrans %}
  • +
  • {% trans %}Username: {{ ldap_username }}{% endtrans %}
  • {% else %} -
  • {{ _('Use your LDAP account to log in') }}
  • +
  • {{ _('Use your LDAP account to log in') }}
  • {% endif %} {% else %} -
  • {% trans email=macros.email_tag(email) %}Email: {{ email }}{% endtrans %}
  • +
  • {% trans email=macros.email_tag(email) %}Email: {{ email }}{% endtrans %}
  • {% endif %} {% trans apps_page_link="https://zulip.com/apps" %}(you'll need these to sign in to the mobile and desktop apps){% endtrans %}

    @@ -39,7 +39,7 @@

    - {{ _("Cheers,") }}
    + {{ _("Cheers,") }}
    {{ _("Team Zulip") }}

    diff --git a/templates/zerver/emails/followup_day2.source.html b/templates/zerver/emails/followup_day2.source.html index 991f6da693..24bd30815b 100644 --- a/templates/zerver/emails/followup_day2.source.html +++ b/templates/zerver/emails/followup_day2.source.html @@ -24,7 +24,7 @@

    {{ _("Take it for a spin now.") }}

    -

    {{ _("Thanks,") }}
    {{ _("Zulip") }}

    +

    {{ _("Thanks,") }}
    {{ _("Zulip") }}

    {% endblock %} {% block manage_preferences %} diff --git a/templates/zerver/emails/missed_message.source.html b/templates/zerver/emails/missed_message.source.html index a2da7fefc6..45679b186d 100644 --- a/templates/zerver/emails/missed_message.source.html +++ b/templates/zerver/emails/missed_message.source.html @@ -24,19 +24,19 @@ {% block manage_preferences %}
    -
    +
    diff --git a/templates/zerver/for-research.html b/templates/zerver/for-research.html index ebea07cf4e..5e6f5738a4 100644 --- a/templates/zerver/for-research.html +++ b/templates/zerver/for-research.html @@ -11,7 +11,7 @@ conversations and focus work.' %} {% endblock %} {% block customhead %} - + {% endblock %} {% block portico_content %} diff --git a/templates/zerver/for-working-groups-and-communities.html b/templates/zerver/for-working-groups-and-communities.html index 8e9e28d64b..31c6001333 100644 --- a/templates/zerver/for-working-groups-and-communities.html +++ b/templates/zerver/for-working-groups-and-communities.html @@ -6,7 +6,7 @@ {% endblock %} {% block customhead %} - + {% endblock %} {% block portico_content %} diff --git a/templates/zerver/hello.html b/templates/zerver/hello.html index 6651d6aaf0..2b01ce8ea8 100644 --- a/templates/zerver/hello.html +++ b/templates/zerver/hello.html @@ -2,7 +2,7 @@ {% set entrypoint = "landing-page" %} {% block customhead %} - +