Skip to content

Commit

Permalink
Merge pull request #1075 from Automattic/fix/layout-validation
Browse files Browse the repository at this point in the history
Ensure layout attributes are only allowed on supporting elements
  • Loading branch information
westonruter authored Apr 15, 2018
2 parents 6861830 + b5eb0ac commit 0870f00
Show file tree
Hide file tree
Showing 6 changed files with 772 additions and 13 deletions.
9 changes: 9 additions & 0 deletions bin/amphtml-update.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,15 @@ def GetTagRules(tag_spec):
if tag_spec.HasField('unique_warning'):
tag_rules['unique_warning'] = tag_spec.unique_warning

if tag_spec.HasField('amp_layout'):
amp_layout = {}
for field in tag_spec.amp_layout.ListFields():
if 'supported_layouts' == field[0].name:
amp_layout['supported_layouts'] = [ val for val in field[1] ]
else:
amp_layout[ field[0].name ] = field[1]
tag_rules['amp_layout'] = amp_layout

logging.info('... done')
return tag_rules

Expand Down
Loading

0 comments on commit 0870f00

Please sign in to comment.