linter: Enforce 2 space indents on tags spread over multiple lines.

We make some specific cases of tags use 2 space indents.
The case description:
* A tag with opening tag spread over multiple lines and closing tag
on the same line as of the closing angle bracket of the opening tag.
* A tag with opening tag spread over multiple lines and closing tag
not on the same line as of the closing angle bracket of the opening
tag.

Example:
Case 1:

Not linted:
<button type="button"
class="btn btn-primary btn-small">{{t "Yes" }}</button>

After linting:
<button type="button"
  class="btn btn-primary btn-small">{{t "Yes" }}</button>

Case 2:

Before linting:
<div class = "foo"
     id = "bar"
     role = "whatever">
     {{ bla }}
</div>

After linting:
<div class = "foo"
  id = "bar"
  role = "whatever">
    {{ bla }}
</div>
This commit is contained in:
Aditya Bansal 2018-04-05 12:08:46 +05:30 committed by Tim Abbott
parent 550222dede
commit b9f1acb300
42 changed files with 142 additions and 117 deletions

View File

@ -1,5 +1,5 @@
<div id="default_language_modal" class="modal hide modal-bg" tabindex="-1" role="dialog"
aria-labelledby="default_language_modal_label" aria-hidden="true">
aria-labelledby="default_language_modal_label" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="{{t 'Close' }}"><span aria-hidden="true">&times;</span></button>
<h3 id="default_language_modal_label">{{t "Select default language" }}</h3>

View File

@ -4,7 +4,7 @@
<div class="message_header message_header_stream">
<div class="message-header-contents">
<div class="message_label_clickable stream_label"
style="background: {{stream_color}}; border-left-color: {{stream_color}};">
style="background: {{stream_color}}; border-left-color: {{stream_color}};">
{{stream}}
</div>
@ -29,7 +29,7 @@
{{/if}}
<div class="message_row{{^is_stream}} private-message{{/is_stream}}">
<div class="messagebox"
style="box-shadow: inset 2px 0px 0px 0px {{#if is_stream}}{{stream_color}}{{else}}#444444{{/if}}, -1px 0px 0px 0px {{#if is_stream}}{{stream_color}}{{else}}#444444{{/if}};">
style="box-shadow: inset 2px 0px 0px 0px {{#if is_stream}}{{stream_color}}{{else}}#444444{{/if}}, -1px 0px 0px 0px {{#if is_stream}}{{stream_color}}{{else}}#444444{{/if}};">
<div class="messagebox-content">
<div class="message_top_line">
<div class="draft_controls">

View File

@ -1,5 +1,5 @@
<form class="edit_bot_form form-horizontal" data-target="edit-bot" data-title="{{t 'Edit bot' }}" data-bot_id="{{bot.bot_id}}"
data-email="{{bot.email}}" data-type="{{bot.bot_type}}">
data-email="{{bot.email}}" data-type="{{bot.bot_type}}">
<div class="bot_edit_errors alert alert-error hide"></div>
<div class="">
<label>{{t "Bot email" }}</label>

View File

@ -4,9 +4,9 @@
<div class="control-group">
<div class="controls propagate-notifications-controls">
<button type="button"
class="yes_propagate_notifications btn btn-primary btn-small">{{t "Yes" }}</button>
class="yes_propagate_notifications btn btn-primary btn-small">{{t "Yes" }}</button>
<button type="button"
class="no_propagate_notifications btn btn-default btn-small">{{t "No" }}</button>
class="no_propagate_notifications btn btn-default btn-small">{{t "No" }}</button>
</div>
</div>
</div>

View File

@ -8,17 +8,17 @@
<label class="inline-block title">{{t "Email" }}</label>
<a id="change_email" {{#if page_params.is_admin}}href="#change_email"{{else}}{{#unless page_params.realm_email_changes_disabled}}href="#change_email"{{/unless}}{{/if}}>
<button type="button" class="button small rounded inline-block" id='email_value'
{{#unless page_params.is_admin}}{{#if page_params.realm_email_changes_disabled}}disabled="disabled"{{/if}}{{/unless}}>
{{#unless page_params.is_admin}}{{#if page_params.realm_email_changes_disabled}}disabled="disabled"{{/if}}{{/unless}}>
{{page_params.email}}
<i class="fa fa-pencil"></i>
</button>
</a>
<i class="icon-vector-question-sign change_email_tooltip settings-info-icon" {{#if page_params.is_admin}}style="display:none"{{else}}{{#unless page_params.realm_email_changes_disabled}}style="display:none"{{/unless}}{{/if}} data-toggle="tooltip"
title="{{t 'Changing email addresses has been disabled by your Zulip organization administrators. Contact an administrator for help.' }}"></i>
title="{{t 'Changing email addresses has been disabled by your Zulip organization administrators. Contact an administrator for help.' }}"></i>
</div>
<div id="change_email_modal" class="modal modal-bg hide" tabindex="-1" role="dialog"
aria-labelledby="change_email_modal_label" aria-hidden="true">
aria-labelledby="change_email_modal_label" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="{{t 'Close' }}"><span aria-hidden="true">&times;</span></button>
<h3 id="change_email_modal_label">{{t "Change email" }}</h3>
@ -52,7 +52,7 @@
title="{{t 'Changing your name has been disabled by your Zulip organization administrators. Contact an administrator for help.' }}"/>
</div>
<div id="change_full_name_modal" class="modal modal-bg hide" tabindex="-1" role="dialog"
aria-labelledby="change_full_name_modal_label" aria-hidden="true">
aria-labelledby="change_full_name_modal_label" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="{{t 'Close' }}"><span aria-hidden="true">&times;</span></button>
<h3 id="change_full_name_modal_label">{{t "Change full name" }}</h3>
@ -86,7 +86,7 @@
{{/if}}
<div id="change_password_modal" class="modal modal-bg hide" tabindex="-1" role="dialog"
aria-labelledby="change_password_modal_label" aria-hidden="true">
aria-labelledby="change_password_modal_label" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="{{t 'Close' }}"><span aria-hidden="true">&times;</span></button>
<h3 id="change_password_modal_label">{{t "Change password" }}</h3>
@ -196,7 +196,7 @@
</div>
<div class="control-group">
<button type="submit" name="view_api_key"
class="button sea-green">{{t 'Get API key' }}</button>
class="button sea-green">{{t 'Get API key' }}</button>
</div>
</form>
</div>

View File

@ -1,6 +1,6 @@
{{#with stream}}
<li class="stream_name" role="presentation"
title="{{subscriber_count}} {{t 'Subscribers' }}" data-stream-id="{{stream_id}}">
title="{{subscriber_count}} {{t 'Subscribers' }}" data-stream-id="{{stream_id}}">
<a role="menuitem" tabindex="0">
{{name}}
</a>

View File

@ -14,7 +14,7 @@
<div class="progressive-table-wrapper" data-list-render="uploaded-files-list">
<table class="table table-condensed table-striped wrapped-table">
<tbody class="required-text" data-empty="{{t 'You have not uploaded any files.' }}"
id="uploaded_files_table" ></tbody>
id="uploaded_files_table" ></tbody>
</table>
</div>
</div>

View File

@ -16,7 +16,7 @@
<div class="progressive-table-wrapper">
<table class="table table-condensed table-striped wrapped-table">
<tbody id="admin_bots_table" class="admin_bot_table required-text thick"
data-empty="{{t 'No bots match your current filter.' }}"></tbody>
data-empty="{{t 'No bots match your current filter.' }}"></tbody>
</table>
</div>
<div id="admin_page_bots_loading_indicator"></div>

View File

@ -28,13 +28,13 @@
<div id="add-a-new-bot-form">
<form id="create_bot_form"
class="form-horizontal no-padding {{#unless admin_only_bot_creation}}hide{{/unless}}">
class="form-horizontal no-padding {{#unless admin_only_bot_creation}}hide{{/unless}}">
<div class="new-bot-form">
<div class="input-group">
<label for="bot_type">
{{t "Bot type" }}
<i class="icon-vector-question-sign settings-info-icon bot_type_tooltip" data-toggle="tooltip"
title='{{t "Incoming webhooks can only send messages." }}'></i>
title='{{t "Incoming webhooks can only send messages." }}'></i>
</label>
<select name="bot_type" id="create_bot_type">
{{#each page_params.bot_types}}

View File

@ -33,7 +33,7 @@
{{/if}}
</thead>
<tbody class="required-text" data-empty="{{t 'No default streams match you current filter.' }}"
id="admin_default_streams_table" class="admin_default_stream_table"></tbody>
id="admin_default_streams_table" class="admin_default_stream_table"></tbody>
</table>
</div>

View File

@ -18,7 +18,7 @@
<div class="input-group admin-realm">
<label for="realm_description">{{t "Your organization's description" }}</label>
<textarea id="id_realm_description" name="realm_description" class="admin-realm-description"
maxlength="1000">{{ realm_description }}</textarea>
maxlength="1000">{{ realm_description }}</textarea>
</div>
</div>
</div>
@ -34,10 +34,10 @@
</div>
<div class="inline-block avatar-controls">
<button class="button rounded sea-green w-200 block input-size"
id="realm_icon_upload_button">{{t 'Upload new icon' }}</button>
id="realm_icon_upload_button">{{t 'Upload new icon' }}</button>
<div id="realm_icon_file_input_error" class="text-error"></div>
<button class="button rounded btn-danger w-200 m-t-10 block input-size"
id="realm_icon_delete_button">{{t 'Delete icon' }}</button>
id="realm_icon_delete_button">{{t 'Delete icon' }}</button>
</div>
</div>

View File

@ -18,7 +18,7 @@
<div class="input-group disableable {{#unless realm_allow_message_editing}}control-label-disabled{{/unless}}">
<label for="id_realm_message_content_edit_limit_minutes"
id="id_realm_message_content_edit_limit_minutes_label">
id="id_realm_message_content_edit_limit_minutes_label">
{{t 'Message edit limit in minutes (0 for no limit)' }}
</label>
<input type="text" id="id_realm_message_content_edit_limit_minutes"
@ -58,7 +58,7 @@
{{#if false}}
<div class="input-group">
<label for="realm_message_retention_days"
id="id_realm_message_retention_days_label">
id="id_realm_message_retention_days_label">
{{t 'Messages retention period in days (blank means messages are retained forever)' }}
</label>
<input type="text" id="id_realm_message_retention_days"
@ -129,10 +129,10 @@
<div class="input-group">
<label for="realm_notifications_stream" id="realm_notifications_stream_label" class="inline-block"
title="{{t 'The stream to which new stream notifications go to.' }}">
title="{{t 'The stream to which new stream notifications go to.' }}">
{{t "New stream notifications:" }}
<span class="dropup actual-dropdown-menu" id="id_realm_notifications_stream"
name="realm_notifications_stream" aria-labelledby="realm_notifications_stream_label">
name="realm_notifications_stream" aria-labelledby="realm_notifications_stream_label">
<button class="button small rounded dropdown-toggle" data-toggle="dropdown">
<span id="realm_notifications_stream_name"></span>
<i class="fa fa-pencil"></i>
@ -152,10 +152,10 @@
<div class="input-group">
<label for="realm_signup_notifications_stream" id="realm_signup_notifications_stream_label" class="inline-block"
title="{{t 'The stream which new user signup notifications go to.' }}">
title="{{t 'The stream which new user signup notifications go to.' }}">
{{t "New user notifications:" }}
<span class="dropup actual-dropdown-menu" id="id_realm_signup_notifications_stream"
name="realm_signup_notifications_stream" aria-labelledby="realm_signup_notifications_stream_label">
name="realm_signup_notifications_stream" aria-labelledby="realm_signup_notifications_stream_label">
<button class="button small rounded dropdown-toggle" data-toggle="dropdown">
<span id="realm_signup_notifications_stream_name"></span>
<i class="fa fa-pencil"></i>

View File

@ -13,7 +13,7 @@
<th class="actions">{{t "Actions" }}</th>
</thead>
<tbody id="admin_streams_table" class="admin_stream_table required-text"
data-empty="{{t 'No streams match your current filter.' }}"></tbody>
data-empty="{{t 'No streams match your current filter.' }}"></tbody>
</table>
</div>
<div id="admin_page_streams_loading_indicator"></div>

View File

@ -15,7 +15,7 @@
<div class="progressive-table-wrapper">
<table class="table table-condensed table-striped wrapped-table">
<tbody id="admin_users_table" class="admin_user_table required-text thick"
data-empty="{{t 'No users match your current filter.' }}"></tbody>
data-empty="{{t 'No users match your current filter.' }}"></tbody>
</table>
</div>
<div id="admin_page_users_loading_indicator"></div>

View File

@ -1,8 +1,8 @@
<div zid="{{msg/id}}" id="{{table_name}}{{msg/id}}"
class="message_row{{^msg/is_stream}} private-message{{/msg/is_stream}}{{#include_sender}} include-sender{{/include_sender}}{{#contains_mention}} mention{{/contains_mention}}{{#include_footer}} last_message{{/include_footer}}{{#msg.unread}} unread{{/msg.unread}} {{#if msg.locally_echoed}}local{{/if}} selectable_row">
class="message_row{{^msg/is_stream}} private-message{{/msg/is_stream}}{{#include_sender}} include-sender{{/include_sender}}{{#contains_mention}} mention{{/contains_mention}}{{#include_footer}} last_message{{/include_footer}}{{#msg.unread}} unread{{/msg.unread}} {{#if msg.locally_echoed}}local{{/if}} selectable_row">
<div class="unread_marker"><div class="unread-marker-fill"></div></div>
<div class="messagebox{{^include_sender}} prev_is_same_sender{{/include_sender}}{{^msg/is_stream}} private-message{{/msg/is_stream}} {{#if next_is_same_sender}}next_is_same_sender{{/if}}"
style="box-shadow: inset 2px 0px 0px 0px {{#if msg/is_stream}}{{background_color}}{{else}}#444444{{/if}}, -1px 0px 0px 0px {{#if msg/is_stream}}{{background_color}}{{else}}#444444{{/if}};">
style="box-shadow: inset 2px 0px 0px 0px {{#if msg/is_stream}}{{background_color}}{{else}}#444444{{/if}}, -1px 0px 0px 0px {{#if msg/is_stream}}{{background_color}}{{else}}#444444{{/if}};">
<div class="messagebox-border">
<div class="messagebox-content">
<div class="message_top_line">

View File

@ -1,7 +1,7 @@
{{! Stream sidebar rows }}
<li class="narrow-filter{{#if not_in_home_view}} out_of_home_view{{/if}}"
data-stream-id="{{id}}" data-stream-name="{{name}}">
data-stream-id="{{id}}" data-stream-name="{{name}}">
<div class="subscription_block selectable_sidebar_block">
<span id="stream_sidebar_privacy_swatch_{{id}}" class="stream-privacy" style="color: {{color}}">

View File

@ -1,5 +1,5 @@
<div class="hide" id="stream-creation" tabindex="-1" role="dialog"
aria-label="{{t 'Stream creation' }}">
aria-label="{{t 'Stream creation' }}">
<form id="stream_creation_form" class="form-inline">
<div class="alert stream_create_info"></div>
<div id="stream_creating_indicator"></div>
@ -17,7 +17,7 @@
{{t "Stream description (optional)"}}
</div>
<textarea name="stream_description" id="create_stream_description"
placeholder="{{t 'Stream description' }}" value="" autocomplete="off"></textarea>
placeholder="{{t 'Stream description' }}" value="" autocomplete="off"></textarea>
</section>
<section class="block" id="make-invite-only">
<div class="stream-title">

View File

@ -63,21 +63,21 @@
</li>
<li>
<div id="sub_desktop_notifications_setting"
class="sub_setting_checkbox sub_notification_setting {{#unless in_home_view}}muted-sub{{/unless}}">
class="sub_setting_checkbox sub_notification_setting {{#unless in_home_view}}muted-sub{{/unless}}">
<input id="desktop-notifystream-{{stream_id}}" class="sub_setting_control" type="checkbox" tabindex="-1" {{#if desktop_notifications}}checked{{/if}} {{#unless in_home_view}}disabled="disabled"{{/unless}}/>
<label class="subscription-control-label">{{t "Visual desktop notifications" }}</label>
</div>
</li>
<li>
<div id="sub_audible_notifications_setting"
class="sub_setting_checkbox sub_notification_setting {{#unless in_home_view}}muted-sub{{/unless}}">
class="sub_setting_checkbox sub_notification_setting {{#unless in_home_view}}muted-sub{{/unless}}">
<input id="audible-notifystream-{{stream_id}}" class="sub_setting_control" type="checkbox" tabindex="-1" {{#if audible_notifications}}checked{{/if}} {{#unless in_home_view}}disabled="disabled"{{/unless}}/>
<label class="subscription-control-label">{{t "Audible desktop notifications" }}</label>
</div>
</li>
<li>
<div id="sub_push_notifications_setting"
class="sub_setting_checkbox sub_notification_setting {{#unless in_home_view}}muted-sub{{/unless}}">
class="sub_setting_checkbox sub_notification_setting {{#unless in_home_view}}muted-sub{{/unless}}">
<input id="push-notifystream-{{stream_id}}" class="sub_setting_control" type="checkbox" tabindex="-1" {{#if push_notifications}}checked{{/if}} {{#unless in_home_view}}disabled="disabled"{{/unless}}/>
<label class="subscription-control-label">{{t "Mobile notifications" }}</label>
</div>

View File

@ -22,7 +22,7 @@
<div class="modal-footer">
<button class="btn btn-default close-privacy-modal">{{t "Cancel" }}</button>
<button class="btn{{#if is_private}} btn-primary{{else}} btn-danger{{/if}}" id="change-stream-privacy-button"
tabindex="-1" data-stream-id="{{stream_id}}">
tabindex="-1" data-stream-id="{{stream_id}}">
{{#if is_private}}
{{t "Make stream public"}}
{{else}}

View File

@ -17,6 +17,6 @@
{{#if is_unsubscribed}}
&nbsp;
<span class="fa fa-exclamation-triangle unsubscribed_icon"
title="{{t 'You are not currently subscribed to this stream.' }}"></span>
title="{{t 'You are not currently subscribed to this stream.' }}"></span>
{{/if}}
{{~/if}}

View File

@ -21,8 +21,8 @@
<td>
<span class="edit-attachment-buttons">
<button type="submit"
class="button small no-style remove-attachment"
title="{{t 'Delete file' }}" data-attachment="{{id}}">
class="button small no-style remove-attachment"
title="{{t 'Delete file' }}" data-attachment="{{id}}">
<i class="fa fa-trash" aria-hidden="true"></i>
</button>
</span>

View File

@ -2,9 +2,9 @@
<span class="selectable_sidebar_block">
<span class="user-status-indicator"></span>
<a href="{{href}}"
data-user-id="{{user_id}}"
data-name="{{name}}"
title="{{name}} {{type_desc}}">{{name}}</a>
data-user-id="{{user_id}}"
data-name="{{name}}"
title="{{name}} {{type_desc}}">{{name}}</a>
</span>
<span class="count"><span class="value">{{#if num_unread}}{{num_unread}}{{/if}}</span></span>
<span class="arrow"><i class="icon-vector-chevron-down"></i></span>

View File

@ -58,8 +58,8 @@
</td>
<td {% if row.is_new %}
class="good" {% else %}
class="neutral" {% endif %} >
class="good" {% else %}
class="neutral" {% endif %} >
{{ row.date_created_day }}
</td>

View File

@ -53,7 +53,7 @@ $(function () {
{% else %}
{% if password_auth_enabled %}
<form class="form-inline" id="send_confirm" name="email_form"
action="{{ current_url() }}" method="post">
action="{{ current_url() }}" method="post">
{{ csrf_input }}
<div class="input-box no-validate">

View File

@ -1,5 +1,5 @@
<div class="modal hide modal-bg new-style" id="bankruptcy" tabindex="-1" role="dialog"
aria-labelledby="bankruptcy-label" aria-hidden="true">
aria-labelledby="bankruptcy-label" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="{{ _('Close') }}"><span aria-hidden="true">&times;</span></button>
@ -9,9 +9,8 @@
<div id="bankruptcy-unread-count"></div>
<div class="modal-footer">
<button id="yes-bankrupt" class="bankruptcy_button button small rounded sea-green"
>{{ _('Yes, please!') }}</button>
<button id="yes-bankrupt" class="bankruptcy_button button small rounded sea-green">{{ _('Yes, please!') }}</button>
<button id="no-bankrupt" class="bankruptcy_button button small rounded"
data-dismiss="modal">{{ _("No, I'll catch up.") }}</button>
data-dismiss="modal">{{ _("No, I'll catch up.") }}</button>
</div>
</div>

View File

@ -18,24 +18,24 @@
</span>
<span class="new_message_button">
<button type="button" class="button small rounded compose_stream_button"
id="left_bar_compose_stream_button_big"
title="{{ _('New topic') }} (c)">
id="left_bar_compose_stream_button_big"
title="{{ _('New topic') }} (c)">
<span class="compose_stream_button_label">{{ _('New topic') }}</span>
</button>
</span>
{% if not embedded %}
<span class="new_message_button">
<button type="button" class="button small rounded compose_private_button"
id="left_bar_compose_private_button_big"
title="{{ _('New private message') }} (x)">
id="left_bar_compose_private_button_big"
title="{{ _('New private message') }} (x)">
<span class="compose_private_button_label">{{ _('New private message') }}</span>
</button>
</span>
{% endif %}
<span class="new_message_button">
<button type="button" class="button small rounded compose_reply_button"
id="left_bar_compose_reply_button_big"
title="{{ _('Reply') }} (r)">
id="left_bar_compose_reply_button_big"
title="{{ _('Reply') }} (r)">
<span class="compose_reply_button_label">{{ _('Reply') }}</span>
</button>
</span>
@ -86,7 +86,7 @@
<div class="pm_recipient">
<div class="pill-container" data-before="{{ _('You and') }}">
<div class="input" contenteditable="true" id="private_message_recipient" name="recipient"
data-no-recipients-text="{{ _('Add one or more users') }}" data-some-recipients-text="{{ _('Add another user...') }}"></div>
data-no-recipients-text="{{ _('Add one or more users') }}" data-some-recipients-text="{{ _('Add another user...') }}"></div>
</div>
</div>
</td>
@ -94,7 +94,7 @@
<tr>
<td class="messagebox" colspan="2">
<textarea class="new_message_textarea" name="content" id='compose-textarea'
value="" placeholder="{{ _('Compose your message here') }}" tabindex="0" maxlength="10000" aria-label="{{ _('Compose your message here...') }}"></textarea>
value="" placeholder="{{ _('Compose your message here') }}" tabindex="0" maxlength="10000" aria-label="{{ _('Compose your message here...') }}"></textarea>
<div class="scrolling_list" id="preview_message_area" style="display:none;">
<div id="markdown_preview_spinner"></div>
<div id="preview_content"></div>
@ -103,22 +103,22 @@
<div id="below-compose-content">
<input type="file" id="file_input" class="notvisible pull-left" multiple />
<a class="message-control-button icon-vector-smile"
id="emoji_map" href="#" title="{{ _('Add emoji') }}"></a>
id="emoji_map" href="#" title="{{ _('Add emoji') }}"></a>
<a class="message-control-button icon-vector-font"
title="{{ _('Formatting') }}" data-overlay-trigger="markdown-help"></a>
title="{{ _('Formatting') }}" data-overlay-trigger="markdown-help"></a>
<a class="message-control-button icon-vector-dropbox notdisplayed"
id="attach_dropbox_files" href="#" title="{{ _('Attach files from Dropbox') }}"></a>
id="attach_dropbox_files" href="#" title="{{ _('Attach files from Dropbox') }}"></a>
<a class="message-control-button icon-vector-paper-clip notdisplayed"
id="attach_files" href="#" title="{{ _('Attach files') }}"></a>
id="attach_files" href="#" title="{{ _('Attach files') }}"></a>
{% if jitsi_server_url %}
<a class="message-control-button fa fa-video-camera"
id="video_link" href="#" title="{{ _('Add video call') }}"></a>
id="video_link" href="#" title="{{ _('Add video call') }}"></a>
{% endif %}
<a id="undo_markdown_preview"
class="message-control-button icon-vector-edit"
style="display:none;" title="{{ _('Write') }}"></a>
class="message-control-button icon-vector-edit"
style="display:none;" title="{{ _('Write') }}"></a>
<a id="markdown_preview" class="message-control-button icon-vector-eye-open"
title="{{ _('Preview') }}"></a>
title="{{ _('Preview') }}"></a>
<a class="drafts-link" href="#drafts" title="{{ _('Drafts') }} (d)">{{ _('Drafts') }}</a>
<span id="sending-indicator"></span>
<div id="send_controls" class="new-style">

View File

@ -29,7 +29,7 @@
</p>
<div style="text-align: left;">
<form class="form-inline" id="send_confirm" name="send_confirm"
action="/login/" method="get">
action="/login/" method="get">
<input type="hidden"
id="email"
name="email"
@ -41,7 +41,7 @@
{# TODO: Ideally, this should allow users to register #}
{# without going over to /register and re-authenticating. #}
<form class="form-inline" id="send_confirm" name="send_confirm"
action="/register/" method="get">
action="/register/" method="get">
<button class="outline">
{{ _("Sign up instead") }}
</button>

View File

@ -18,7 +18,7 @@ $(function () {
<h1 class="get-started">{{ _("Create a new Zulip organization") }}</h1>
</div>
<form class="form-inline" id="send_confirm" name="email_form"
action="{{ current_url() }}" method="post">
action="{{ current_url() }}" method="post">
{{ csrf_input }}
<div class="input-box horizontal">
<div class="inline-block relative">

View File

@ -1,5 +1,5 @@
<div class="modal hide modal-bg new-style" id="deprecation-notice-modal" role="dialog"
aria-labelledby="deprecation-notice-label" aria-hidden="true">
aria-labelledby="deprecation-notice-label" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="{{ _('Close') }}"><span aria-hidden="true">&times;</span></button>

View File

@ -26,7 +26,7 @@
<form id="smtp_form">
{{ csrf_input }}
<div class="alert alert-info"
id="smtp_form_status" style="display:none;">
id="smtp_form_status" style="display:none;">
Updated successfully.
</div>
<label for="forward">

View File

@ -6,18 +6,18 @@
</head>
<body>
<span style="display:none !important;
visibility:hidden;
color:transparent;
mso-hide:all;
font-size:1px;
color:#ffffff;
line-height:1px;
max-height:0px;
height:0px;
max-width:0px;
width:0px;
opacity:0;
overflow:hidden;">
visibility:hidden;
color:transparent;
mso-hide:all;
font-size:1px;
color:#ffffff;
line-height:1px;
max-height:0px;
height:0px;
max-width:0px;
width:0px;
opacity:0;
overflow:hidden;">
{% block preheader %}{% endblock %}
</span>
{% block content %}{% endblock %}

View File

@ -33,7 +33,7 @@
any Zulip organization(s) associated with the addresses you enter below.
</p>
<form class="form-inline" id="find_account" name="email_form"
action="{{ current_url() }}" method="post">
action="{{ current_url() }}" method="post">
{{ csrf_input }}
<div class="input-box moving-label horizontal">
<div class="inline-block relative">

View File

@ -40,12 +40,12 @@
{% elif only_sso %}
<a href="{{ url('login-sso') }}">
<button href="" class="download-button" type="button"
name="button">{{ _('Log in now!') }}</button>
name="button">{{ _('Log in now!') }}</button>
</a>
{% else %}
<a href="{{ url('register') }}">
<button href="" class="download-button" type="button"
name="button">{{ _('Sign up now!') }}</button>
name="button">{{ _('Sign up now!') }}</button>
</a>
{% endif %}
<!-- we want this to be il-block so we'll put a <br> above so it's on
@ -609,12 +609,12 @@
{% elif only_sso %}
<a href="{{ url('login-sso') }}">
<button href="" type="button"
name="button">{{ _('Log in now!') }}</button>
name="button">{{ _('Log in now!') }}</button>
</a>
{% else %}
<a href="{{ url('register') }}">
<button href="" type="button"
name="button">{{ _('Sign up now!') }}</button>
name="button">{{ _('Sign up now!') }}</button>
</a>
{% endif %}
<div class="zulip-octopus"></div>

View File

@ -87,12 +87,12 @@
{% if integration.is_enabled() %}
<a href="/integrations/doc/{{ integration.name }}">
<div
{% if integration.legacy %}
class="integration-lozenge integration-{{ integration.name }} legacy"{% else %}
class="integration-lozenge integration-{{ integration.name }}"
{% endif %}
data-categories="{{ integration.categories }}"
data-name="{{ integration.name }}">
{% if integration.legacy %}
class="integration-lozenge integration-{{ integration.name }} legacy"{% else %}
class="integration-lozenge integration-{{ integration.name }}"
{% endif %}
data-categories="{{ integration.categories }}"
data-name="{{ integration.name }}">
<img class="integration-logo" src="/{{ integration.logo }}"
alt="{{ integration.display_name }} logo"/>
{% if integration.secondary_line_text %}

View File

@ -1,12 +1,12 @@
<div id="invite-user" class="overlay flex new-style" tabindex="-1" role="dialog" data-overlay="invite"
aria-labelledby="invite-user-label" aria-hidden="true">
aria-labelledby="invite-user-label" aria-hidden="true">
<div class="overlay-content modal-bg">
<div class="modal-header">
<button type="button" class="exit" aria-label="{{ _('Close') }}"><span aria-hidden="true">&times;</span></button>
<h3 id="invite-user-label">{% trans %}Invite users to Zulip{% endtrans %}</h3>
</div>
<form id="invite_user_form" class="form-horizontal"
action="/json/invites" method="POST">{{ csrf_input }}
action="/json/invites" method="POST">{{ csrf_input }}
<div class="modal-body">
<div class="control-group">
<div id="invite-result"></div>
@ -38,7 +38,7 @@
<div class="modal-footer">
<button class="button exit small rounded" data-dismiss="modal">{{ _('Cancel') }}</button>
<button id="submit-invitation" class="button small rounded sea-green"
data-loading-text="{{ _('Inviting...') }}" type="submit">{{ _('Invite') }}</button>
data-loading-text="{{ _('Inviting...') }}" type="submit">{{ _('Invite') }}</button>
</div>
</form>
</div>

View File

@ -1,5 +1,5 @@
<div class="overlay-modal" id="keyboard-shortcuts" tabindex="-1" role="dialog"
aria-label="{{ _('Keyboard shortcuts') }}">
aria-label="{{ _('Keyboard shortcuts') }}">
<div class="modal-body" tabindex="0">
<div>
<table class="hotkeys_full_table hotkeys_table wide table table-striped table-bordered table-condensed">

View File

@ -65,7 +65,7 @@
{% else %}
{% if password_auth_enabled %}
<form name="login_form" id="login_form" method="post" class="login-form"
action="{{ url('django.contrib.auth.views.login') }}?next={{ next }}">
action="{{ url('django.contrib.auth.views.login') }}?next={{ next }}">
{{ csrf_input }}

View File

@ -1,5 +1,5 @@
<div class="modal hide modal-bg new-style" id="message-edit-history" tabindex="-1" role="dialog"
aria-labelledby="message-history-label" aria-hidden="true">
aria-labelledby="message-history-label" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="{{ _('Close') }}"><span aria-hidden="true">&times;</span></button>
<h3 id="message-history-label">{{ _('Message edit history') }}</h3>

View File

@ -131,7 +131,7 @@ Form is validated both client-side using jquery-validate (see signup.js) and ser
{% endif %}
<div class="inline-block" id="subdomain_section" {% if root_domain_available and
not form.realm_subdomain.errors and not form.realm_subdomain.value() %}style="display: none;"{% endif %}>
not form.realm_subdomain.errors and not form.realm_subdomain.value() %}style="display: none;"{% endif %}>
<div class="or"><span>{{ _('OR') }}</span></div>
<div class="inline-block relative">
<input id="id_team_subdomain"

View File

@ -1,5 +1,5 @@
<div class="overlay-modal hide" id="search-operators" tabindex="-1" role="dialog"
aria-label="{{ _('Search operators') }}">
aria-label="{{ _('Search operators') }}">
<div class="modal-body" tabindex="0">
<table class="table table-striped table-condensed table-rounded table-bordered help-table">
<thead>

View File

@ -121,17 +121,12 @@ def pretty_print_html(html, num_spaces=4):
info['extra_indent'] -
info['extra_indent_prev'])
elif (start_line + info['line_span'] - 1 == end_line and
(info['line_span'] > 2 or
(info['line_span'] == 2 and
token.kind in
('html_singleton_end',
'handlebars_singleton_end')))):
info['line_span'] > 1):
offsets[end_line] = (1 + info['extra_indent'] +
(info['depth'] + 1) * num_spaces) - adjustment
if token.kind in ('html_singleton_end', 'handlebars_singleton_end'):
# We would like singleton tags to have 2 space
# indentation in case they span over multiple lines.
offsets[end_line] -= 2
# We would like singleton tags and tags which spread over
# multiple lines to have 2 space indentation.
offsets[end_line] -= 2
elif token.line != info['line']:
offsets[end_line] = info['offset']
if token.tag != 'pre' and token.tag != 'script':
@ -148,9 +143,9 @@ def pretty_print_html(html, num_spaces=4):
extra_indent = info['extra_indent']
adjustment = len(line)-len(line.lstrip()) + 1
offset = (1 + extra_indent + new_depth * num_spaces) - adjustment
if token.kind in ('html_singleton_end', 'handlebars_singleton_end'):
# We would like singleton tags to have 2 space
# indentation in case they span over multiple lines.
if line_num <= start_line + info['line_span'] - 1:
# We would like singleton tags and tags which spread over
# multiple lines to have 2 space indentation.
offset -= 2
offsets[line_num] = offset
elif (token.kind in ('handlebars_end', 'django_end') and

View File

@ -63,8 +63,8 @@ GOOD_HTML = """
print 'hello world'
</pre>
<div class = "foo"
id = "bar"
role = "whatever">{{ bla }}</div>
id = "bar"
role = "whatever">{{ bla }}</div>
</body>
</html>
<!-- test -->
@ -438,6 +438,36 @@ GOOD_HTML16 = """
</div>
"""
BAD_HTML17 = """
<div>
<button type="button"
class="btn btn-primary btn-small">{{t "Yes" }}</button>
<button type="button"
id="confirm_btn"
class="btn btn-primary btn-small">{{t "Yes" }}</button>
<div class = "foo"
id = "bar"
role = "whatever">
{{ bla }}
</div>
</div>
"""
GOOD_HTML17 = """
<div>
<button type="button"
class="btn btn-primary btn-small">{{t "Yes" }}</button>
<button type="button"
id="confirm_btn"
class="btn btn-primary btn-small">{{t "Yes" }}</button>
<div class = "foo"
id = "bar"
role = "whatever">
{{ bla }}
</div>
</div>
"""
class TestPrettyPrinter(unittest.TestCase):
def compare(self, a: str, b: str) -> None:
self.assertEqual(a.split('\n'), b.split('\n'))
@ -461,3 +491,4 @@ class TestPrettyPrinter(unittest.TestCase):
self.compare(pretty_print_html(BAD_HTML14), GOOD_HTML14)
self.compare(pretty_print_html(BAD_HTML15), GOOD_HTML15)
self.compare(pretty_print_html(BAD_HTML16), GOOD_HTML16)
self.compare(pretty_print_html(BAD_HTML17), GOOD_HTML17)