template_parser: Add parsing support for self closing tags as per HTML5.

In this commit we add support for some tags which are also called
void-elements according to
http://w3c.github.io/html/syntax.html#void-elements to be parsed by
our template parser and get tagged as singleton_html_tags.

Fixes: #8387.
This commit is contained in:
Aditya Bansal
2018-02-16 02:46:40 +05:30
committed by showell
parent 271cfd4d7a
commit 6fce1d7834
9 changed files with 46 additions and 18 deletions

View File

@@ -515,7 +515,7 @@ def build_custom_checkers(by_lang):
'exclude_line': [('templates/zerver/register.html', 'placeholder="acme"'),
('templates/zerver/register.html', 'placeholder="Acme or Aκμή"'),
('static/templates/settings/realm-domains-modal.handlebars',
'<td><input type="text" class="new-realm-domain" placeholder="acme.com"></input></td>'),
'<td><input type="text" class="new-realm-domain" placeholder="acme.com"></td>'),
("static/templates/user-groups-admin.handlebars",
'<input type="text" name="name" id="user_group_name" placeholder="hamletcharacters" />')],
'exclude': set(["static/templates/settings/emoji-settings-admin.handlebars",
@@ -523,11 +523,11 @@ def build_custom_checkers(by_lang):
"static/templates/settings/bot-settings.handlebars",
"templates/zerver/email_log.html"]),
'good_lines': ['<input class="stream-list-filter" type="text" placeholder="{{ _(\'Search streams\') }}" />'],
'bad_lines': ['<input placeholder="foo"></input>']},
'bad_lines': ['<input placeholder="foo">']},
{'pattern': "placeholder='[^{]",
'description': "`placeholder` value should be translatable.",
'good_lines': ['<input class="stream-list-filter" type="text" placeholder="{{ _(\'Search streams\') }}" />'],
'bad_lines': ["<input placeholder='foo'></input>"]},
'bad_lines': ["<input placeholder='foo'>"]},
{'pattern': "aria-label='[^{]",
'description': "`aria-label` value should be translatable.",
'good_lines': ['<button type="button" class="close close-alert-word-status" aria-label="{{t \'Close\' }}">'],