Skip to content

Commit

Permalink
Validator Changes (#3676)
Browse files Browse the repository at this point in the history
* Support `<link rel=manifest href=...>` in validator.

* Add test containing both warnings and errors.

* Use upper case tag names in validation.
  • Loading branch information
Gregable committed Jun 21, 2016
1 parent 53c3cfa commit 9943702
Show file tree
Hide file tree
Showing 45 changed files with 723 additions and 661 deletions.
8 changes: 4 additions & 4 deletions extensions/amp-access/0.1/validator-amp-access.protoascii
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
# limitations under the license.
#
tags: { # amp-access
tag_name: "script"
tag_name: "SCRIPT"
spec_name: "amp-access extension .js script"
mandatory_parent: "head"
mandatory_parent: "HEAD"
attrs: {
name: "async"
mandatory: true
Expand Down Expand Up @@ -46,9 +46,9 @@ tags: { # amp-access
spec_url: "https://www.ampproject.org/docs/reference/extended/amp-access.html"
}
tags: { # amp-access (json)
tag_name: "script"
tag_name: "SCRIPT"
spec_name: "amp-access extension .json script"
mandatory_parent: "head"
mandatory_parent: "HEAD"
also_requires_tag: "amp-access extension .js script"
also_requires_tag: "amp-analytics extension .js script"
attrs: {
Expand Down
28 changes: 13 additions & 15 deletions extensions/amp-accordion/0.1/validator-amp-accordion.protoascii
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
# limitations under the license.
#
tags: { # amp-accordion
tag_name: "script"
tag_name: "SCRIPT"
spec_name: "amp-accordion extension .js script"
mandatory_parent: "head"
mandatory_parent: "HEAD"
attrs: {
name: "async"
mandatory: true
Expand Down Expand Up @@ -46,32 +46,30 @@ tags: { # amp-accordion
spec_url: "https://www.ampproject.org/docs/reference/extended/amp-accordion.html"
}
tags: { # <amp-accordion>
tag_name: "amp-accordion"
disallowed_ancestor: "head"
tag_name: "AMP-ACCORDION"
also_requires_tag: "amp-accordion extension .js script"
attrs: { name: "animate" value: "" }
child_tags: {
child_tag_name_oneof: "section"
child_tag_name_oneof: "SECTION"
}
spec_url: "https://www.ampproject.org/docs/reference/extended/amp-accordion.html"
amp_layout: {
supported_layouts: CONTAINER
}
}
tags: { # <amp-accordion> > <section>
tag_name: "section"
tag_name: "SECTION"
spec_name: "amp-accordion > section"
mandatory_parent: "amp-accordion"
disallowed_ancestor: "head"
mandatory_parent: "AMP-ACCORDION"
attrs: { name: "expanded" value: "" }
child_tags: {
mandatory_num_child_tags: 2
first_child_tag_name_oneof: "h1"
first_child_tag_name_oneof: "h2"
first_child_tag_name_oneof: "h3"
first_child_tag_name_oneof: "h4"
first_child_tag_name_oneof: "h5"
first_child_tag_name_oneof: "h6"
first_child_tag_name_oneof: "header"
first_child_tag_name_oneof: "H1"
first_child_tag_name_oneof: "H2"
first_child_tag_name_oneof: "H3"
first_child_tag_name_oneof: "H4"
first_child_tag_name_oneof: "H5"
first_child_tag_name_oneof: "H6"
first_child_tag_name_oneof: "HEADER"
}
}
17 changes: 8 additions & 9 deletions extensions/amp-analytics/0.1/validator-amp-analytics.protoascii
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

# Specific script tags for custom elements and runtime imports.
tags: { # amp-analytics
tag_name: "script"
tag_name: "SCRIPT"
spec_name: "amp-analytics extension .js script"
mandatory_parent: "head"
mandatory_parent: "HEAD"
attrs: {
name: "async"
mandatory: true
Expand Down Expand Up @@ -48,9 +48,9 @@ tags: { # amp-analytics
spec_url: "https://www.ampproject.org/docs/reference/extended/amp-analytics.html"
}
tags: { # amp-analytics (json)
tag_name: "script"
tag_name: "SCRIPT"
spec_name: "amp-analytics extension .json script"
mandatory_parent: "amp-analytics"
mandatory_parent: "AMP-ANALYTICS"
attrs: {
name: "type"
mandatory: true
Expand All @@ -68,9 +68,9 @@ tags: { # amp-analytics (json)
# This tag isn't intended to be used by publishers directly, but may be
# emitted by the AMP cache.
tags: { # amp-ad-metadata (json)
tag_name: "script"
tag_name: "SCRIPT"
spec_name: "amp-ad-metadata .json script"
mandatory_parent: "body"
mandatory_parent: "BODY"
attrs: {
name: "type"
mandatory: true
Expand All @@ -91,9 +91,8 @@ tags: { # amp-ad-metadata (json)
spec_url: "https://www.ampproject.org/docs/reference/extended/amp-analytics.html"
}
tags: { # <amp-analytics>
tag_name: "amp-analytics"
disallowed_ancestor: "head"
disallowed_ancestor: "amp-sidebar"
tag_name: "AMP-ANALYTICS"
disallowed_ancestor: "AMP-SIDEBAR"
also_requires_tag: "amp-analytics extension .js script"
attrs: { name: "type" }
attrs: {
Expand Down
9 changes: 4 additions & 5 deletions extensions/amp-anim/0.1/validator-amp-anim.protoascii
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
#

tags: { # amp-anim
tag_name: "script"
tag_name: "SCRIPT"
spec_name: "amp-anim extension .js script"
mandatory_parent: "head"
mandatory_parent: "HEAD"
attrs: {
name: "async"
mandatory: true
Expand Down Expand Up @@ -47,9 +47,8 @@ tags: { # amp-anim
spec_url: "https://www.ampproject.org/docs/reference/extended/amp-anim.html"
}
tags: { # <amp-anim>
tag_name: "amp-anim"
disallowed_ancestor: "head"
disallowed_ancestor: "amp-sidebar"
tag_name: "AMP-ANIM"
disallowed_ancestor: "AMP-SIDEBAR"
also_requires_tag: "amp-anim extension .js script"
attrs: { name: "alt" }
attrs: { name: "attribution" }
Expand Down
9 changes: 4 additions & 5 deletions extensions/amp-audio/0.1/validator-amp-audio.protoascii
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
# limitations under the license.
#
tags: { # amp-audio
tag_name: "script"
tag_name: "SCRIPT"
spec_name: "amp-audio extension .js script"
mandatory_parent: "head"
mandatory_parent: "HEAD"
attrs: {
name: "async"
mandatory: true
Expand Down Expand Up @@ -46,9 +46,8 @@ tags: { # amp-audio
spec_url: "https://www.ampproject.org/docs/reference/extended/amp-audio.html"
}
tags: { # <amp-audio>
tag_name: "amp-audio"
disallowed_ancestor: "head"
disallowed_ancestor: "amp-sidebar"
tag_name: "AMP-AUDIO"
disallowed_ancestor: "AMP-SIDEBAR"
also_requires_tag: "amp-audio extension .js script"
attrs: {
name: "autoplay"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
#

tags: { # amp-brid-player
tag_name: "script"
tag_name: "SCRIPT"
spec_name: "amp-brid-player extension .js script"
mandatory_parent: "head"
mandatory_parent: "HEAD"
attrs: {
name: "async"
mandatory: true
Expand Down Expand Up @@ -48,9 +48,8 @@ tags: { # amp-brid-player
spec_url: "https://github.com/ampproject/amphtml/blob/master/extensions/amp-brid-player/amp-brid-player.md"
}
tags: { # <amp-brid-player>
tag_name: "amp-brid-player"
disallowed_ancestor: "head"
disallowed_ancestor: "amp-sidebar"
tag_name: "AMP-BRID-PLAYER"
disallowed_ancestor: "AMP-SIDEBAR"
also_requires_tag: "amp-brid-player extension .js script"
attrs: {
name: "data-partner"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
#

tags: { # amp-brightcove
tag_name: "script"
tag_name: "SCRIPT"
spec_name: "amp-brightcove extension .js script"
mandatory_parent: "head"
mandatory_parent: "HEAD"
attrs: {
name: "async"
mandatory: true
Expand Down Expand Up @@ -47,9 +47,8 @@ tags: { # amp-brightcove
spec_url: "https://www.ampproject.org/docs/reference/extended/amp-brightcove.html"
}
tags: { # <amp-brightcove>
tag_name: "amp-brightcove"
disallowed_ancestor: "head"
disallowed_ancestor: "amp-sidebar"
tag_name: "AMP-BRIGHTCOVE"
disallowed_ancestor: "AMP-SIDEBAR"
also_requires_tag: "amp-brightcove extension .js script"
attrs: { name: "data-account" mandatory: true }
# If data-embed is missing, the default value is "default".
Expand Down
9 changes: 4 additions & 5 deletions extensions/amp-carousel/0.1/validator-amp-carousel.protoascii
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
#

tags: { # amp-carousel
tag_name: "script"
tag_name: "SCRIPT"
spec_name: "amp-carousel extension .js script"
mandatory_parent: "head"
mandatory_parent: "HEAD"
attrs: {
name: "async"
mandatory: true
Expand Down Expand Up @@ -47,9 +47,8 @@ tags: { # amp-carousel
spec_url: "https://www.ampproject.org/docs/reference/extended/amp-carousel.html"
}
tags: { # <amp-carousel>
tag_name: "amp-carousel"
disallowed_ancestor: "head"
disallowed_ancestor: "amp-sidebar"
tag_name: "AMP-CAROUSEL"
disallowed_ancestor: "AMP-SIDEBAR"
also_requires_tag: "amp-carousel extension .js script"
attrs: { name: "arrows" value: "" }
attrs: { name: "autoplay" value: "" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
# limitations under the license.
#
tags: { # amp-dailymotion
tag_name: "script"
tag_name: "SCRIPT"
spec_name: "amp-dailymotion extension .js script"
mandatory_parent: "head"
mandatory_parent: "HEAD"
attrs: {
name: "async"
mandatory: true
Expand Down Expand Up @@ -46,9 +46,8 @@ tags: { # amp-dailymotion
spec_url: "https://www.ampproject.org/docs/reference/extended/amp-dailymotion.html"
}
tags: { # <amp-dailymotion>
tag_name: "amp-dailymotion"
disallowed_ancestor: "head"
disallowed_ancestor: "amp-sidebar"
tag_name: "AMP-DAILYMOTION"
disallowed_ancestor: "AMP-SIDEBAR"
also_requires_tag: "amp-dailymotion extension .js script"
attrs: { name: "data-endscreen-enable" value_regex: "true|false" }
attrs: { name: "data-info" value_regex: "true|false" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
#

tags: { # amp-dynamic-css-classes
tag_name: "script"
tag_name: "SCRIPT"
spec_name: "amp-dynamic-css-classes extension .js script"
mandatory_parent: "head"
mandatory_parent: "HEAD"
attrs: {
name: "async"
mandatory: true
Expand Down
9 changes: 4 additions & 5 deletions extensions/amp-facebook/0.1/validator-amp-facebook.protoascii
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
#

tags: { # amp-facebook
tag_name: "script"
tag_name: "SCRIPT"
spec_name: "amp-facebook extension .js script"
mandatory_parent: "head"
mandatory_parent: "HEAD"
attrs: {
name: "async"
mandatory: true
Expand Down Expand Up @@ -47,9 +47,8 @@ tags: { # amp-facebook
spec_url: "https://www.ampproject.org/docs/reference/extended/amp-facebook.html"
}
tags: { # <amp-facebook>
tag_name: "amp-facebook"
disallowed_ancestor: "head"
disallowed_ancestor: "amp-sidebar"
tag_name: "AMP-FACEBOOK"
disallowed_ancestor: "AMP-SIDEBAR"
also_requires_tag: "amp-facebook extension .js script"
# data-* is generally allowed, but it's not generally mandatory.
attrs: { name: "data-href" mandatory: true }
Expand Down
9 changes: 4 additions & 5 deletions extensions/amp-fit-text/0.1/validator-amp-fit-text.protoascii
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
#

tags: { # amp-fit-text
tag_name: "script"
tag_name: "SCRIPT"
spec_name: "amp-fit-text extension .js script"
mandatory_parent: "head"
mandatory_parent: "HEAD"
attrs: {
name: "async"
mandatory: true
Expand Down Expand Up @@ -49,10 +49,9 @@ tags: { # amp-fit-text
# TODO(greggrothaus): amp-fit-text's attribute spec need flushing
# out now that the spec is available.
tags: { # <amp-fit-text>
tag_name: "amp-fit-text"
disallowed_ancestor: "head"
tag_name: "AMP-FIT-TEXT"
# <amp-fit-text> is whitelisted for <amp-sidebar>, otherwise:
# disallowed_ancestor: "amp-sidebar"
# disallowed_ancestor: "AMP-SIDEBAR"
also_requires_tag: "amp-fit-text extension .js script"
attrs: { name: "max-font-size" }
attrs: { name: "min-font-size" }
Expand Down
9 changes: 4 additions & 5 deletions extensions/amp-font/0.1/validator-amp-font.protoascii
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
#

tags: { # amp-font
tag_name: "script"
tag_name: "SCRIPT"
spec_name: "amp-font extension .js script"
mandatory_parent: "head"
mandatory_parent: "HEAD"
attrs: {
name: "async"
mandatory: true
Expand Down Expand Up @@ -47,9 +47,8 @@ tags: { # amp-font
spec_url: "https://www.ampproject.org/docs/reference/extended/amp-font.html"
}
tags: { # <amp-font>
tag_name: "amp-font"
disallowed_ancestor: "head"
disallowed_ancestor: "amp-sidebar"
tag_name: "AMP-FONT"
disallowed_ancestor: "AMP-SIDEBAR"
also_requires_tag: "amp-font extension .js script"
attrs: {
name: "font-family"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
# limitations under the license.
#
tags: { # <script custom-element="amp-fx-flying-carpet">
tag_name: "script"
tag_name: "SCRIPT"
spec_name: "amp-fx-flying-carpet extension .js script"
mandatory_parent: "head"
mandatory_parent: "HEAD"
attrs: {
name: "async"
mandatory: true
Expand Down Expand Up @@ -46,8 +46,8 @@ tags: { # <script custom-element="amp-fx-flying-carpet">
spec_url: "https://www.ampproject.org/docs/reference/extended/amp-fx-flying-carpet.html"
}
tags: { # <amp-fx-flying-carpet>
tag_name: "amp-fx-flying-carpet"
disallowed_ancestor: "amp-sidebar"
tag_name: "AMP-FX-FLYING-CARPET"
disallowed_ancestor: "AMP-SIDEBAR"
also_requires_tag: "amp-fx-flying-carpet extension .js script"
attr_lists: "extended-amp-global"
attrs: {
Expand Down

0 comments on commit 9943702

Please sign in to comment.