Permalink
Switch branches/tags
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
247 lines (242 sloc) 8.06 KB
#
# Copyright 2016 The AMP HTML Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the license.
# AMP-AD is full of special cases for validation rules that are partly
# implemented in code, so be very careful when editing this file.
# Historically, amp-ad/amp-embed javascript were embedded into the main
# runtime (v0.js), so there are many pages that do not include the amp-ad
# extension. We want to warn for these.
# AMP-EMBED requires the amp-ad extension, not amp-embed.
# Including the amp-ad extension, but not an AMP-AD/AMP-EMBED tag should only
# produce a warning.
#
# To implement this, we mark the tags as requires_extension amp-ad, but the
# main validator also considers the amp-ad extension to always be present
# We then use also_requires_tag_warning to give a warning if the extension
# is missing.
tags: { # amp-ad
html_format: AMP # Ads are not allowed inside ads
tag_name: "SCRIPT"
# Typically the extension_spec takes care of this, but we have
# a unique situation where we need to refer to this earlier in
# the rules processing for the also_requires_tag_warning below.
spec_name: "amp-ad extension .js script"
extension_spec: {
name: "amp-ad"
version: "0.1"
version: "latest"
requires_usage: GRANDFATHERED
deprecated_allow_duplicates: true
}
attr_lists: "common-extension-attrs"
}
tags: { # <amp-ad>
html_format: AMP # Ads are not allowed inside ads
tag_name: "AMP-AD"
requires_extension: "amp-ad" # See note at top of file
also_requires_tag_warning: "amp-ad extension .js script"
# If modifying disallowed_ancestors, then please also edit
# extensions/amp-auto-ads/*/placement.js
disallowed_ancestor: "AMP-APP-BANNER"
attrs: { name: "alt" }
attrs: { name: "json" }
attrs: { name: "rtc-config" }
attrs: {
name: "src"
value_url: {
protocol: "https"
allow_relative: true # Will be set to false at a future date.
}
blacklisted_value_regex: "__amp_source_origin"
}
attrs: { name: "template" }
attrs: { name: "type" mandatory: true }
attr_lists: "extended-amp-global"
spec_url: "https://www.ampproject.org/docs/reference/components/amp-ad"
amp_layout: {
supported_layouts: FILL
supported_layouts: FIXED
supported_layouts: FIXED_HEIGHT
supported_layouts: FLEX_ITEM
supported_layouts: FLUID
supported_layouts: INTRINSIC
supported_layouts: NODISPLAY
supported_layouts: RESPONSIVE
}
}
tags: { # <amp-ad data-multi-size>
html_format: AMP # Ads are not allowed inside ads
tag_name: "AMP-AD"
spec_name: "amp-ad with data-multi-size attribute"
requires_extension: "amp-ad" # See note at top of file
also_requires_tag_warning: "amp-ad extension .js script"
# If modifying disallowed_ancestors, then please also edit
# extensions/amp-auto-ads/*/placement.js
disallowed_ancestor: "AMP-APP-BANNER"
# amp-ad elements cannot be both children of an amp ad container and have
# data-multi-size attribute.
disallowed_ancestor: "AMP-CAROUSEL"
disallowed_ancestor: "AMP-FX-FLYING-CARPET"
disallowed_ancestor: "AMP-LIGHTBOX"
disallowed_ancestor: "AMP-STICKY-AD"
attrs: { name: "alt" }
attrs: {
name: "data-multi-size"
mandatory: true
value: ""
dispatch_key: NAME_VALUE_DISPATCH
}
attrs: { name: "json" }
attrs: { name: "rtc-config" }
attrs: {
name: "src"
value_url: {
protocol: "https"
allow_relative: true # Will be set to false at a future date.
}
blacklisted_value_regex: "__amp_source_origin"
}
attrs: { name: "type" mandatory: true }
attr_lists: "extended-amp-global"
spec_url: "https://www.ampproject.org/docs/reference/components/amp-ad"
amp_layout: {
supported_layouts: FILL
supported_layouts: FIXED
supported_layouts: FIXED_HEIGHT
supported_layouts: FLEX_ITEM
supported_layouts: FLUID
supported_layouts: INTRINSIC
supported_layouts: NODISPLAY
supported_layouts: RESPONSIVE
}
}
tags: { # <amp-ad data-enable-refresh>
html_format: AMP # Ads are not allowed inside ads
tag_name: "AMP-AD"
spec_name: "amp-ad with data-enable-refresh attribute"
requires_extension: "amp-ad" # See note at top of file
also_requires_tag_warning: "amp-ad extension .js script"
# If modifying disallowed_ancestors, then please also edit
# extensions/amp-auto-ads/*/placement.js
disallowed_ancestor: "AMP-APP-BANNER"
# amp-ad elements cannot be both children of these amp ad containers and have
# data-enable-refresh attribute.
disallowed_ancestor: "AMP-FX-FLYING-CARPET"
disallowed_ancestor: "AMP-LIGHTBOX"
attrs: { name: "alt" }
attrs: {
name: "data-enable-refresh"
mandatory: true
value: ""
dispatch_key: NAME_VALUE_DISPATCH
}
attrs: { name: "json" }
attrs: {
name: "src"
value_url: {
protocol: "https"
allow_relative: true # Will be set to false at a future date.
}
blacklisted_value_regex: "__amp_source_origin"
}
attrs: { name: "type" mandatory: true }
attr_lists: "extended-amp-global"
spec_url: "https://www.ampproject.org/docs/reference/components/amp-ad"
amp_layout: {
supported_layouts: FILL
supported_layouts: FIXED
supported_layouts: FIXED_HEIGHT
supported_layouts: FLEX_ITEM
supported_layouts: FLUID
supported_layouts: INTRINSIC
supported_layouts: NODISPLAY
supported_layouts: RESPONSIVE
}
}
tags: { # <amp-embed>
html_format: AMP
tag_name: "AMP-EMBED"
requires_extension: "amp-ad" # See note at top of file
also_requires_tag_warning: "amp-ad extension .js script"
disallowed_ancestor: "AMP-APP-BANNER"
attrs: { name: "alt" }
attrs: { name: "json" }
attrs: { name: "rtc-config" }
attrs: {
name: "src"
value_url: {
protocol: "https"
allow_relative: true # Will be set to false at a future date.
}
blacklisted_value_regex: "__amp_source_origin"
}
attrs: { name: "template" }
attrs: { name: "type" mandatory: true }
attr_lists: "extended-amp-global"
spec_url: "https://www.ampproject.org/docs/reference/components/amp-ad"
amp_layout: {
supported_layouts: FILL
supported_layouts: FIXED
supported_layouts: FIXED_HEIGHT
supported_layouts: FLEX_ITEM
supported_layouts: FLUID
supported_layouts: INTRINSIC
supported_layouts: NODISPLAY
supported_layouts: RESPONSIVE
}
}
tags: { # <amp-embed data-multi-size>
html_format: AMP
tag_name: "AMP-EMBED"
spec_name: "amp-embed with data-multi-size attribute"
requires_extension: "amp-ad" # See note at top of file
also_requires_tag_warning: "amp-ad extension .js script"
disallowed_ancestor: "AMP-APP-BANNER"
# amp-embed elements cannot be both children of an amp ad container and have
# data-multi-size attribute.
disallowed_ancestor: "AMP-CAROUSEL"
disallowed_ancestor: "AMP-FX-FLYING-CARPET"
disallowed_ancestor: "AMP-LIGHTBOX"
disallowed_ancestor: "AMP-STICKY-AD"
attrs: { name: "alt" }
attrs: {
name: "data-multi-size"
mandatory: true
value: ""
dispatch_key: NAME_VALUE_DISPATCH
}
attrs: { name: "json" }
attrs: { name: "rtc-config" }
attrs: {
name: "src"
value_url: {
protocol: "https"
allow_relative: true # Will be set to false at a future date.
}
blacklisted_value_regex: "__amp_source_origin"
}
attrs: { name: "type" mandatory: true }
attr_lists: "extended-amp-global"
spec_url: "https://www.ampproject.org/docs/reference/components/amp-ad"
amp_layout: {
supported_layouts: FILL
supported_layouts: FIXED
supported_layouts: FIXED_HEIGHT
supported_layouts: FLEX_ITEM
supported_layouts: FLUID
supported_layouts: INTRINSIC
supported_layouts: NODISPLAY
supported_layouts: RESPONSIVE
}
}