Skip to content

Commit

Permalink
Update to latest spec - 2021-03-29
Browse files Browse the repository at this point in the history
  • Loading branch information
schlessera committed Mar 29, 2021
1 parent 4d9c7ae commit b284a31
Show file tree
Hide file tree
Showing 8 changed files with 158 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ interface Extension
const STORY_PAGE_ATTACHMENT = 'amp-story-page-attachment';
const STORY_PANNING_MEDIA = 'amp-story-panning-media';
const STORY_PLAYER = 'amp-story-player';
const STORY_SOCIAL_SHARE = 'amp-story-social-share';
const SUBSCRIPTIONS = 'amp-subscriptions';
const SUBSCRIPTIONS_GOOGLE = 'amp-subscriptions-google';
const TIMEAGO = 'amp-timeago';
Expand Down
2 changes: 1 addition & 1 deletion src/Validator/Spec.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ final class Spec
private $minValidatorRevisionRequired = 475;

/** @var int */
private $specFileRevision = 1160;
private $specFileRevision = 1162;

/** @var string */
private $templateSpecUrl = 'https://amp.dev/documentation/components/amp-mustache';
Expand Down
4 changes: 4 additions & 0 deletions src/Validator/Spec/Section/DescendantTagList.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ final class DescendantTagList
Element::SCRIPT,
];

const AMP_STORY_SOCIAL_SHARE_ALLOWED_DESCENDANTS = [
Element::SCRIPT,
];

const AMP_STORY_CTA_LAYER_ALLOWED_DESCENDANTS = [
Element::A,
Element::ABBR,
Expand Down
1 change: 1 addition & 0 deletions src/Validator/Spec/Tag/AmpStory.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ final class AmpStory extends Tag
'AMP-STORY-AUTO-ANALYTICS',
'AMP-STORY-BOOKEND',
'AMP-STORY-PAGE',
'AMP-STORY-SOCIAL-SHARE',
],
SpecRule::MANDATORY_MIN_NUM_CHILD_TAGS => 1,
],
Expand Down
47 changes: 47 additions & 0 deletions src/Validator/Spec/Tag/AmpStorySocialShare.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

/**
* DO NOT EDIT!
* This file was automatically generated via bin/generate-validator-spec.php.
*/

namespace AmpProject\Validator\Spec\Tag;

use AmpProject\Attribute;
use AmpProject\Extension;
use AmpProject\Format;
use AmpProject\Protocol;
use AmpProject\Validator\Spec\Section\DescendantTagList;
use AmpProject\Validator\Spec\SpecRule;
use AmpProject\Validator\Spec\Tag;

final class AmpStorySocialShare extends Tag
{
const SPEC = [
SpecRule::TAG_NAME => Extension::STORY_SOCIAL_SHARE,
SpecRule::ATTRS => [
[
SpecRule::NAME => Attribute::LAYOUT,
SpecRule::MANDATORY => true,
SpecRule::VALUE => [
'nodisplay',
],
],
[
SpecRule::NAME => Attribute::SRC,
SpecRule::VALUE_URL => [
SpecRule::PROTOCOL => [
Protocol::HTTP,
Protocol::HTTPS,
],
],
],
],
SpecRule::MANDATORY_ANCESTOR => Extension::STORY,
SpecRule::HTML_FORMAT => [
Format::AMP,
],
SpecRule::DESCENDANT_TAG_LIST => DescendantTagList::AMP_STORY_SOCIAL_SHARE_ALLOWED_DESCENDANTS,
SpecRule::MANDATORY_LAST_CHILD => true,
];
}
46 changes: 46 additions & 0 deletions src/Validator/Spec/Tag/AmpStorySocialShareExtensionJsonScript.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

/**
* DO NOT EDIT!
* This file was automatically generated via bin/generate-validator-spec.php.
*/

namespace AmpProject\Validator\Spec\Tag;

use AmpProject\Attribute;
use AmpProject\Extension;
use AmpProject\Format;
use AmpProject\Tag as Element;
use AmpProject\Validator\Spec\SpecRule;
use AmpProject\Validator\Spec\Tag;

final class AmpStorySocialShareExtensionJsonScript extends Tag
{
const SPEC = [
SpecRule::TAG_NAME => Element::SCRIPT,
SpecRule::SPEC_NAME => 'amp-story-social-share extension .json script',
SpecRule::UNIQUE => true,
SpecRule::MANDATORY_PARENT => Extension::STORY_SOCIAL_SHARE,
SpecRule::ATTRS => [
[
SpecRule::NAME => Attribute::TYPE,
SpecRule::MANDATORY => true,
SpecRule::DISPATCH_KEY => 'NAME_VALUE_PARENT_DISPATCH',
SpecRule::VALUE_CASEI => [
'application/json',
],
],
],
SpecRule::ATTR_LISTS => [
'nonce-attr',
],
SpecRule::HTML_FORMAT => [
Format::AMP,
],
SpecRule::REQUIRES_EXTENSION => [
Extension::STORY,
],
SpecRule::SIBLINGS_DISALLOWED => true,
SpecRule::MANDATORY_LAST_CHILD => true,
];
}
2 changes: 1 addition & 1 deletion src/Validator/Spec/Tag/LinkRel.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class LinkRel extends Tag
[
SpecRule::NAME => Attribute::REL,
SpecRule::MANDATORY => true,
SpecRule::DISALLOWED_VALUE_REGEX => '(^|\s)(canonical|components|import|manifest|preload|serviceworker|stylesheet|subresource)(\s|$)',
SpecRule::DISALLOWED_VALUE_REGEX => '(^|\s)(canonical|components|import|manifest|modulepreload|preload|serviceworker|stylesheet|subresource)(\s|$)',
],
],
SpecRule::ATTR_LISTS => [
Expand Down
57 changes: 57 additions & 0 deletions src/Validator/Spec/Tag/LinkRelModulepreload.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?php

/**
* DO NOT EDIT!
* This file was automatically generated via bin/generate-validator-spec.php.
*/

namespace AmpProject\Validator\Spec\Tag;

use AmpProject\Attribute;
use AmpProject\Format;
use AmpProject\Tag as Element;
use AmpProject\Validator\Spec\SpecRule;
use AmpProject\Validator\Spec\Tag;

final class LinkRelModulepreload extends Tag
{
const SPEC = [
SpecRule::TAG_NAME => Element::LINK,
SpecRule::SPEC_NAME => 'link rel=modulepreload',
SpecRule::MANDATORY_PARENT => Element::HEAD,
SpecRule::ATTRS => [
[
SpecRule::NAME => Attribute::AS_,
SpecRule::MANDATORY => true,
SpecRule::VALUE => [
'script',
],
],
[
SpecRule::NAME => Attribute::CROSSORIGIN,
SpecRule::MANDATORY => true,
SpecRule::VALUE => [
'anonymous',
],
],
[
SpecRule::NAME => Attribute::HREF,
SpecRule::MANDATORY => true,
SpecRule::VALUE_REGEX => '.*\.mjs$',
],
[
SpecRule::NAME => Attribute::REL,
SpecRule::MANDATORY => true,
SpecRule::DISPATCH_KEY => 'NAME_VALUE_DISPATCH',
SpecRule::VALUE_CASEI => [
'modulepreload',
],
],
],
SpecRule::SPEC_URL => 'https://amp.dev/documentation/guides-and-tutorials/learn/spec/amphtml/#html-tags',
SpecRule::HTML_FORMAT => [
Format::AMP,
],
SpecRule::DESCRIPTIVE_NAME => 'link rel=modulepreload',
];
}

0 comments on commit b284a31

Please sign in to comment.