Skip to content
This repository has been archived by the owner on Nov 10, 2017. It is now read-only.

Commit

Permalink
fix bug 1198907 - Drop <br> in feature names
Browse files Browse the repository at this point in the history
Continue dropping <br> tags from feature names, but don't add a
tag_dropped issue.
  • Loading branch information
jwhitlock committed Sep 3, 2015
1 parent 8728e8a commit 2656b9c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
5 changes: 3 additions & 2 deletions mdn/compatibility.py
Expand Up @@ -447,7 +447,7 @@ class CompatFeatureVisitor(CompatBaseVisitor):
This is the first column of the compatibility table.
"""
scope = 'compatibility feature'
_allowed_tags = ['code', 'td']
_allowed_tags = ['code', 'td', 'br']

def __init__(self, parent_feature, **kwargs):
"""Initialize a CompatFeatureVisitor.
Expand All @@ -458,7 +458,6 @@ def __init__(self, parent_feature, **kwargs):
super(CompatFeatureVisitor, self).__init__(**kwargs)
self.parent_feature = parent_feature
self.name = None
self.name_bits = []
self.feature_id = None
self.canonical = False
self.experimental = False
Expand All @@ -479,6 +478,8 @@ def process(self, cls, node, **kwargs):
'tag_dropped', self.outer_td.open_tag, tag='td',
scope=self.scope)
self.outer_td = processed
elif tag == 'br':
processed.drop_tag = True # Silently drop <br> tags
elif isinstance(processed, Footnote):
self.add_issue('footnote_feature', processed)
elif isinstance(processed, DeprecatedInline):
Expand Down
11 changes: 4 additions & 7 deletions mdn/tests/test_compatibility.py
Expand Up @@ -307,9 +307,7 @@ def test_remove_whitespace(self):
feature_id = '_support for contain and cover'
name = 'Support for <code>contain</code> and <code>cover</code>'
slug = 'web-css-background-size_support_for_contain_and_co'
issue = ('tag_dropped', 16, 20,
{'scope': 'compatibility feature', 'tag': 'br'})
self.assert_feature(cell, feature_id, name, slug, issues=[issue])
self.assert_feature(cell, feature_id, name, slug)

def test_code_sequence(self):
# https://developer.mozilla.org/en-US/docs/Web/CSS/display
Expand Down Expand Up @@ -427,10 +425,9 @@ def test_link(self):
feature_id = '_cross-origin resource sharing'
name = 'Cross-Origin Resource Sharing'
slug = 'web-css-background-size_cross-origin_resource_shar'
issues = [
('tag_dropped', 4, 38, {'tag': 'a', 'scope': self.scope}),
('tag_dropped', 71, 75, {'tag': 'br', 'scope': self.scope})]
self.assert_feature(cell, feature_id, name, slug, issues=issues)
issue = (
'tag_dropped', 4, 38, {'tag': 'a', 'scope': self.scope})
self.assert_feature(cell, feature_id, name, slug, issues=[issue])

def test_p(self):
# https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const
Expand Down

0 comments on commit 2656b9c

Please sign in to comment.