Skip to content

Commit

Permalink
chore(html): consistently use spacing in template tags
Browse files Browse the repository at this point in the history
  • Loading branch information
nijel committed Oct 23, 2024
1 parent f055092 commit b181056
Show file tree
Hide file tree
Showing 24 changed files with 55 additions and 56 deletions.
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -280,13 +280,12 @@ strict_settings = false
blank_line_after_tag = "load,extends,endblock"
# - reconsider T032 and H014 once formatter is in use
# T003 - Endblock should have name.
# T001 - Variables should be wrapped in a whitespace.
# T002 - Double quotes should be used in tags. (makes using tags in attributes hard)
# H013 - Img tag should have an alt attribute.
# H006 - Img tag should have height and width attributes.
# H021 - Inline styles should be avoided.
# H031 - Consider adding meta keywords.
ignore = "T003,H014,T032,T002,H013,T001,H006,H021,H031"
ignore = "T003,H014,T032,T002,H013,H006,H021,H031"
indent = 2
max_attribute_length = 80
max_blank_lines = 2
Expand Down
2 changes: 1 addition & 1 deletion weblate/templates/accounts/register.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
{% endif %}

{% if form.errors %}
{% trans "Please fix errors in the registration form." as msg%}
{% trans "Please fix errors in the registration form." as msg %}
{% show_message "error" msg %}
{% endif %}

Expand Down
2 changes: 1 addition & 1 deletion weblate/templates/accounts/token.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
{% trans "Redirecting you to the authentication provider." as msg %}
{% show_message "info" msg %}

<a href="" class="btn btn-link link-auto link-post" data-href="{% url 'social:complete' backend %}?partial_token={{ partial_token}}&amp;verification_code={{verification_code}}&amp;confirm=1">{% auth_name backend %}</a>
<a href="" class="btn btn-link link-auto link-post" data-href="{% url 'social:complete' backend %}?partial_token={{ partial_token }}&amp;verification_code={{ verification_code }}&amp;confirm=1">{% auth_name backend %}</a>

{% endblock %}
8 changes: 4 additions & 4 deletions weblate/templates/accounts/user.html
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ <h3>{{ page_user }}</h3>

<div class="tab-pane active" id="contributed">
<div class="list-group">
{% include "snippets/list-objects.html" with objects=page_user_translations label=_("Translation") show_admin_badge=True name_source="translation" empty_message=_("No recent contributions found.")%}
{% include "snippets/list-objects.html" with objects=page_user_translations label=_("Translation") show_admin_badge=True name_source="translation" empty_message=_("No recent contributions found.") %}
<a href="{% url 'user_contributions' user=page_user.username %}" class="btn btn-primary">{% trans "Browse all translations with contribution" %}</a>
</div>
</div>
Expand All @@ -177,7 +177,7 @@ <h3>{{ page_user }}</h3>
<div class="list-group">
{% include "list-projects.html" with projects=page_owned_projects %}
{% if page_owned_projects_more %}
<a href="{% url 'projects' %}?owned={{page_user.username}}" class="btn btn-primary">{% trans "Browse all managed projects" %}</a>
<a href="{% url 'projects' %}?owned={{ page_user.username }}" class="btn btn-primary">{% trans "Browse all managed projects" %}</a>
{% endif %}
</div>
</div>
Expand All @@ -186,7 +186,7 @@ <h3>{{ page_user }}</h3>
<div class="list-group">
{% include "list-projects.html" with projects=page_watched_projects %}
{% if page_watched_projects_more %}
<a href="{% url 'projects' %}?watched={{page_user.username}}" class="btn btn-primary">{% trans "Browse all watched projects" %}</a>
<a href="{% url 'projects' %}?watched={{ page_user.username }}" class="btn btn-primary">{% trans "Browse all watched projects" %}</a>
{% endif %}
</div>
</div>
Expand Down Expand Up @@ -306,7 +306,7 @@ <h3>{{ page_user }}</h3>
<th>{{ group.name }}</th>
<td class="number">{{ group.user__count }}</td>
<td>
<a href="" class="btn btn-link btn-xs red link-post" data-href="{{ page_user.get_absolute_url }}" data-params='{"remove_group": {{ group.pk }}}' title="{% trans "Remove user from this team" %}">
<a href="" class="btn btn-link btn-xs red link-post" data-href="{{ page_user.get_absolute_url }}" data-params='{"remove_group": {{ group.pk }} }' title="{% trans "Remove user from this team" %}">
{% icon 'delete.svg' %}
</a>
</td>
Expand Down
2 changes: 1 addition & 1 deletion weblate/templates/addons/addon_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@

<div class="tab-pane" id="history">
{% include "last-changes-content.html" %}
<a class="btn btn-primary" href="{% if object %}{% url 'changes' path=object.get_url_path %}{% else %}{% url 'changes' %}{% endif %}?{% for action in change_actions %}action={{action}}{% if not forloop.last %}&amp;{% endif %}{% endfor %}">{% trans "Browse all add-on changes" %}</a>
<a class="btn btn-primary" href="{% if object %}{% url 'changes' path=object.get_url_path %}{% else %}{% url 'changes' %}{% endif %}?{% for action in change_actions %}action={{ action }}{% if not forloop.last %}&amp;{% endif %}{% endfor %}">{% trans "Browse all add-on changes" %}</a>
</div>

</div>
Expand Down
2 changes: 1 addition & 1 deletion weblate/templates/auth/team.html
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ <h4 class="panel-title">
</table>
{% if users.paginator.num_pages > 1 %}
<div class="panel-footer">
{% include "paginator.html" with page_obj=users anchor="users" paginator_form="paginator-form"%}
{% include "paginator.html" with page_obj=users anchor="users" paginator_form="paginator-form" %}
</div>
{% endif %}
<div class="panel-footer">
Expand Down
2 changes: 1 addition & 1 deletion weblate/templates/bootstrap3/field.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<div class="controls {% for offset in bootstrap_checkbox_offsets %}{{ offset }} {% endfor %}{{ field_class }}">
{% endif %}
{% endif %}
<{% if tag %}{{ tag }}{% else %}div{% endif %} id="div_{{ field.auto_id }}" {% if not field|is_checkbox %}class="form-group{% else %}class="checkbox{% endif %}{% if wrapper_class %} {{ wrapper_class }}{% endif %}{% if form_show_errors%}{% if field.errors %} has-error{% endif %}{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}">
<{% if tag %}{{ tag }}{% else %}div{% endif %} id="div_{{ field.auto_id }}" {% if not field|is_checkbox %}class="form-group{% else %}class="checkbox{% endif %}{% if wrapper_class %} {{ wrapper_class }}{% endif %}{% if form_show_errors %}{% if field.errors %} has-error{% endif %}{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}">
{% if field.label and not field|is_checkbox and form_show_labels %}
<label {% if field.id_for_label and not field|is_radioselect %}for="{{ field.id_for_label }}" {% endif %} class="control-label {{ label_class }}{% if field.field.required %} requiredField{% endif %}">
{{ field.label }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div id="div_{{ field.auto_id }}" class="form-group{% if wrapper_class %} {{ wrapper_class }}{% endif %}{% if form_show_errors and field.errors %} has-error{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}">
{% if field.label %}
<label for="{{ field.auto_id }}" class="control-label {{ label_class }}{% if field.field.required %} requiredField{% endif %}">
{{ field.label|safe }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %} {% documentation_icon 'admin/access' 'acl'%}
{{ field.label|safe }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %} {% documentation_icon 'admin/access' 'acl' %}
</label>
{% endif %}

Expand Down
16 changes: 8 additions & 8 deletions weblate/templates/check_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,37 +39,37 @@
<td class="number" data-value="{{ row.check_count }}">
{% if translate_links %}
<a href="{{ row.get_translate_url }}?q={{ row.check_obj.url_id }} OR dismissed_{{ row.check_obj.url_id }}">
{{ row.check_count |intcomma}}
{{ row.check_count | intcomma }}
</a>
{% else %}
{{ row.check_count |intcomma}}
{{ row.check_count | intcomma }}
{% endif %}
</td>
<td class="number" data-value="{{ row.dismissed_check_count }}">
{% if translate_links %}
<a href="{{ row.get_translate_url }}?q=dismissed_{{ row.check_obj.url_id }}">
{{ row.dismissed_check_count |intcomma}}
{{ row.dismissed_check_count | intcomma }}
</a>
{% else %}
{{ row.dismissed_check_count |intcomma}}
{{ row.dismissed_check_count | intcomma }}
{% endif %}
</td>
<td class="number" data-value="{{ row.active_check_count }}">
{% if translate_links %}
<a href="{{ row.get_translate_url }}?q={{ row.check_obj.url_id }}">
{{ row.active_check_count |intcomma}}
{{ row.active_check_count | intcomma }}
</a>
{% else %}
{{ row.active_check_count |intcomma}}
{{ row.active_check_count | intcomma }}
{% endif %}
</td>
<td class="number" data-value="{{ row.translated_check_count }}">
{% if translate_links %}
<a href="{{ row.get_translate_url }}?q={{ row.check_obj.url_id }} AND state:&gt;=translated">
{{ row.translated_check_count |intcomma}}
{{ row.translated_check_count | intcomma }}
</a>
{% else %}
{{ row.translated_check_count |intcomma}}
{{ row.translated_check_count | intcomma }}
{% endif %}
</td>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion weblate/templates/dashboard/user.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<div {% active_tab "managed" %}>
{% include "snippets/list-objects.html" with objects=owned_projects label=_("Project") %}
{% if all_owned_projects|length > 10 %}
<a href="{% url 'projects' %}?owned={{user.username}}" class="btn btn-primary">{% trans "Browse all managed projects" %}</a>
<a href="{% url 'projects' %}?owned={{ user.username }}" class="btn btn-primary">{% trans "Browse all managed projects" %}</a>
{% endif %}
</div>
{% endif %}
Expand Down
36 changes: 18 additions & 18 deletions weblate/templates/keyboard-shortcuts.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ <h4 id="shortcutsModal" class="panel-title">{% trans "Available Shortcuts" %}</h
</tr>
<tr>
<td><kbd>Alt</kbd> + <kbd>Home</kbd></td>
<td>{% trans "Navigate to the first translation in the current search."%}</td>
<td>{% trans "Navigate to the first translation in the current search." %}</td>
</tr>
<tr>
<td><kbd>Alt</kbd> + <kbd>End</kbd></td>
<td>{% trans "Navigate to the last translation in the current search."%}</td>
<td>{% trans "Navigate to the last translation in the current search." %}</td>
</tr>
<tr>
<td>
Expand All @@ -38,7 +38,7 @@ <h4 id="shortcutsModal" class="panel-title">{% trans "Available Shortcuts" %}</h
<kbd>Alt</kbd> + <kbd></kbd> {% translate "or" context "between keyboard shortcuts" %} <br>
<kbd>Cmd</kbd> + <kbd></kbd> {% translate "or" context "between keyboard shortcuts" %} <br>
</td>
<td>{% trans "Navigate to the last translation in the current search."%}</td>
<td>{% trans "Navigate to the last translation in the current search." %}</td>
</tr>
<tr>
<td>
Expand All @@ -47,50 +47,50 @@ <h4 id="shortcutsModal" class="panel-title">{% trans "Available Shortcuts" %}</h
<kbd>Alt</kbd> + <kbd></kbd> {% translate "or" context "between keyboard shortcuts" %} <br>
<kbd>Cmd</kbd> + <kbd></kbd> {% translate "or" context "between keyboard shortcuts" %} <br>
</td>
<td>{% trans "Navigate to the next translation in the current search."%}</td>
<td>{% trans "Navigate to the next translation in the current search." %}</td>
</tr>

<tr>
<td>
<kbd>Ctrl</kbd> + <kbd>Enter</kbd> {% translate "or" context "between keyboard shortcuts" %} <br>
<kbd>Cmd</kbd> + <kbd>Enter</kbd>
</td>
<td>{% trans "Submit current form; this works the same as pressing Save and continue while editing translation."%}</td>
<td>{% trans "Submit current form; this works the same as pressing Save and continue while editing translation." %}</td>
</tr>
<tr>
<td>
<kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Enter</kbd> {% translate "or" context "between keyboard shortcuts" %} <br>
<kbd>Cmd</kbd> + <kbd>Shift</kbd> +<kbd>Enter</kbd>
</td>
<td>{% trans "Unmark translation as Needing edit and submit it."%}</td>
<td>{% trans "Unmark translation as Needing edit and submit it." %}</td>
</tr>
<tr>
<td>
<kbd>Alt</kbd> + <kbd>Enter</kbd> {% translate "or" context "between keyboard shortcuts" %} <br>
<kbd>Option</kbd> + <kbd>Enter</kbd>
</td>
<td>{% trans "Submit the string as a suggestion; this works the same as pressing Suggest while editing translation."%}</td>
<td>{% trans "Submit the string as a suggestion; this works the same as pressing Suggest while editing translation." %}</td>
</tr>
<tr>
<td>
<kbd>Ctrl</kbd> + <kbd>E</kbd> {% translate "or" context "between keyboard shortcuts" %} <br>
<kbd>Cmd</kbd> + <kbd>E</kbd>
</td>
<td>{% trans "Focus on translation editor."%}</td>
<td>{% trans "Focus on translation editor." %}</td>
</tr>
<tr>
<td>
<kbd>Ctrl</kbd> + <kbd>U</kbd> {% translate "or" context "between keyboard shortcuts" %} <br>
<kbd>Cmd</kbd> + <kbd>U</kbd>
</td>
<td>{% trans "Focus on comment editor."%}</td>
<td>{% trans "Focus on comment editor." %}</td>
</tr>
<tr>
<td>
<kbd>Ctrl</kbd> + <kbd>M</kbd> {% translate "or" context "between keyboard shortcuts" %} <br>
<kbd>Cmd</kbd> + <kbd>M</kbd>
</td>
<td>{% trans "Shows Automatic suggestions tab."%}</td>
<td>{% trans "Shows Automatic suggestions tab." %}</td>
</tr>
<tr>
<td>
Expand All @@ -99,7 +99,7 @@ <h4 id="shortcutsModal" class="panel-title">{% trans "Available Shortcuts" %}</h
<kbd>Cmd</kbd> + <kbd>1</kbd> {% translate "to" context "between keyboard shortcuts" %}
<kbd>Cmd</kbd> + <kbd>9</kbd>
</td>
<td>{% trans "Copies placeable of a given number from source string."%}</td>
<td>{% trans "Copies placeable of a given number from source string." %}</td>
</tr>
<tr>
<td>
Expand All @@ -109,7 +109,7 @@ <h4 id="shortcutsModal" class="panel-title">{% trans "Available Shortcuts" %}</h
<kbd>1</kbd> {% translate "to" context "between keyboard shortcuts" %}
<kbd>9</kbd>
</td>
<td>{% trans "Copy the machine translation of a given number to current translation."%}</td>
<td>{% trans "Copy the machine translation of a given number to current translation." %}</td>
</tr>
<tr>
<td>
Expand All @@ -120,34 +120,34 @@ <h4 id="shortcutsModal" class="panel-title">{% trans "Available Shortcuts" %}</h
<kbd>1</kbd> {% translate "to" context "between keyboard shortcuts" %}
<kbd>9</kbd>
</td>
<td>{% trans "Ignore one item in the list of failing checks."%}</td>
<td>{% trans "Ignore one item in the list of failing checks." %}</td>
</tr>
<tr>
<td>
<kbd>Ctrl</kbd> + <kbd>J</kbd> {% translate "or" context "between keyboard shortcuts" %}
<br> <kbd>Cmd</kbd> + <kbd>J</kbd>
</td>
<td>{% trans "Shows the Nearby strings tab."%}</td>
<td>{% trans "Shows the Nearby strings tab." %}</td>
</tr>
<tr>
<td>
<kbd>Ctrl</kbd> + <kbd>S</kbd> {% translate "or" context "between keyboard shortcuts" %}
<br> <kbd>Cmd</kbd> + <kbd>S</kbd>
</td>
<td>{% trans "Focus on search field."%}</td>
<td>{% trans "Focus on search field." %}</td>
</tr>
<tr>
<td>
<kbd>Ctrl</kbd> + <kbd>O</kbd> {% translate "or" context "between keyboard shortcuts" %} <br>
<kbd>Cmd</kbd> + <kbd>O</kbd>
</td>
<td>{% trans "Copy the source string."%}</td>
<td>{% trans "Copy the source string." %}</td>
</tr>
<tr>
<td><kbd>Ctrl</kbd> + <kbd>Y</kbd> {% translate "or" context "between keyboard shortcuts" %}
<br> <kbd>Cmd</kbd> + <kbd>Y</kbd>
</td>
<td>{% trans "Toggle the Needs editing checkbox."%}</td>
<td>{% trans "Toggle the Needs editing checkbox." %}</td>
</tr>
<tr>
<td>
Expand All @@ -162,7 +162,7 @@ <h4 id="shortcutsModal" class="panel-title">{% trans "Available Shortcuts" %}</h
<kbd></kbd>
</td>
<td>
{% trans "Browse the previous translation string."%}
{% trans "Browse the previous translation string." %}
</td>
</tr>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion weblate/templates/last-changes-content.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
{% if change.can_revert %}
{% perm 'unit.edit' change.unit as user_can_translate %}
{% if user_can_translate %}
<a class="btn btn-link" href="{{ change.translation.get_translate_url}}?{% if search_url %}{{ search_url }}&amp;offset={{ offset }}&amp;{% endif %}checksum={{ change.unit.checksum }}&amp;revert={{ change.id }}" title="{% trans "Revert" %}">{% icon "undo.svg" %}</a>
<a class="btn btn-link" href="{{ change.translation.get_translate_url }}?{% if search_url %}{{ search_url }}&amp;offset={{ offset }}&amp;{% endif %}checksum={{ change.unit.checksum }}&amp;revert={{ change.id }}" title="{% trans "Revert" %}">{% icon "undo.svg" %}</a>
{% endif %}
{% endif %}
{% if change.user and not change.user.is_anonymous and change.project %}
Expand Down
2 changes: 1 addition & 1 deletion weblate/templates/manage/billing.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
{% include "billing/list.html" with objects=free %}
</div>
<div class="tab-pane" id="removal">
{% include "billing/list.html" with objects=removal show_removal=1%}
{% include "billing/list.html" with objects=removal show_removal=1 %}
</div>
<div class="tab-pane" id="terminated">
{% include "billing/list.html" with objects=terminated %}
Expand Down
2 changes: 1 addition & 1 deletion weblate/templates/manage/teams.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ <h4 class="panel-title">
{% endif %}
<form action="{{ group.get_absolute_url }}" method="post" class="inlineform">
{% csrf_token %}
<input type="hidden" name="next" value="{{request.get_full_path}}" />
<input type="hidden" name="next" value="{{ request.get_full_path }}" />
<div class="modal fade" tabindex="-1" role="dialog" aria-labelledby="delete_group_title_{{ group.id }}" aria-describedby="delete_group_body_{{ group.id }}" id="delete_group_{{ group.id }}">
<div class="modal-dialog" role="document">
<div class="modal-content">
Expand Down
2 changes: 1 addition & 1 deletion weblate/templates/project-labels.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
{% for label in labels %}
<tr>
<td>{{ label.name }}</td>
<td><span class="label label-{{label.color }}">{{ label.get_color_display }}</span></td>
<td><span class="label label-{{ label.color }}">{{ label.get_color_display }}</span></td>
<td>{{ label.description }}</td>
<td class="number">
<a href="{% url 'search' path=object.get_url_path %}?q={{ label.filter_name }}">
Expand Down
Loading

0 comments on commit b181056

Please sign in to comment.