From 448a38f2d7e3ddfb5ad4435d1007c5c68d68e205 Mon Sep 17 00:00:00 2001 From: Edi Amin Date: Wed, 13 Oct 2021 17:28:25 +0600 Subject: [PATCH] Regenerate validator specs and update SpecGenerator and Dumper classes --- bin/generate-validator-spec.php | 2 +- bin/src/Validator/SpecGenerator.php | 2 +- bin/src/Validator/SpecGenerator/Dumper.php | 10 ++ .../Validator/SpecGenerator/SpecPrinter.php | 13 ++- src/Attribute.php | 4 + ...pStoryPageAttachmentAllowedDescendants.php | 14 +++ src/Validator/Spec/Section/Tags.php | 20 +++- .../Spec/Tag/AmpAdWithTypeCustom.php | 2 +- .../Spec/Tag/AmpStoryPanningMedia.php | 25 +++++ .../Spec/Tag/ScriptAmpEmbedlyCard.php | 2 +- src/Validator/Spec/Tag/ScriptAmpIframe.php | 23 +++-- src/Validator/Spec/Tag/ScriptAmpIframe2.php | 95 +++++++++++++++++++ src/Validator/Spec/Tag/ScriptAmpMathml.php | 19 +++- src/Validator/Spec/Tag/ScriptAmpMathml2.php | 93 ++++++++++++++++++ src/Validator/Spec/Tag/ScriptAmpSidebar.php | 21 ++-- src/Validator/Spec/Tag/ScriptAmpSidebar2.php | 95 +++++++++++++++++++ .../Spec/Tag/ScriptAmpSoundcloud.php | 2 +- 17 files changed, 411 insertions(+), 31 deletions(-) create mode 100644 src/Validator/Spec/Tag/ScriptAmpIframe2.php create mode 100644 src/Validator/Spec/Tag/ScriptAmpMathml2.php create mode 100644 src/Validator/Spec/Tag/ScriptAmpSidebar2.php diff --git a/bin/generate-validator-spec.php b/bin/generate-validator-spec.php index 3ebb5e1c1..529d7fd13 100755 --- a/bin/generate-validator-spec.php +++ b/bin/generate-validator-spec.php @@ -8,7 +8,7 @@ if (! class_exists('Nette\PhpGenerator\ClassType')) { echo "ERROR: The optional package nette/php-generator is needed for code generation.\n"; echo "Install the package via the following Composer command:\n"; - echo "composer require --dev nette/php-generator:^3.5\n"; + echo "composer require --dev nette/php-generator:3.6.1\n"; exit -1; } diff --git a/bin/src/Validator/SpecGenerator.php b/bin/src/Validator/SpecGenerator.php index 45df7ba88..bcc127e72 100644 --- a/bin/src/Validator/SpecGenerator.php +++ b/bin/src/Validator/SpecGenerator.php @@ -298,7 +298,7 @@ private function gatherExtensionsMeta($bundlesConfig) if (!isset($extensions[$bundleConfig['name']])) { $extensions[$bundleConfig['name']] = [ 'versions' => [], - 'latestVersion' => null, + 'latestVersion' => '', ]; } diff --git a/bin/src/Validator/SpecGenerator/Dumper.php b/bin/src/Validator/SpecGenerator/Dumper.php index 02d6fc677..e1c74849f 100644 --- a/bin/src/Validator/SpecGenerator/Dumper.php +++ b/bin/src/Validator/SpecGenerator/Dumper.php @@ -195,6 +195,16 @@ public function dumpWithKey($key, $value, $level, $parentKeys = []) return "{$this->getValueString($key)} => {$this->dump($value, $level, $parentKeys)}"; } + /** + * Get the NetteDumper instance. + * + * @return NetteDumper + */ + public function getDumper() + { + return $this->dumper; + } + /** * Get the string representation of a value. * diff --git a/bin/src/Validator/SpecGenerator/SpecPrinter.php b/bin/src/Validator/SpecGenerator/SpecPrinter.php index e0a0a1920..c4dd8c035 100644 --- a/bin/src/Validator/SpecGenerator/SpecPrinter.php +++ b/bin/src/Validator/SpecGenerator/SpecPrinter.php @@ -3,7 +3,6 @@ namespace AmpProject\Tooling\Validator\SpecGenerator; use Nette\PhpGenerator\ClassType; -use Nette\PhpGenerator\GlobalFunction; use Nette\PhpGenerator\Helpers; use Nette\PhpGenerator\Method; use Nette\PhpGenerator\PhpNamespace; @@ -64,7 +63,7 @@ public function printClass(ClassType $class, PhpNamespace $namespace = null): st $consts = []; foreach ($class->getConstants() as $const) { $consts[] = Helpers::formatDocComment((string) $const->getComment()) - . self::printAttributes($const->getAttributes(), $namespace) + . $this->printAttributes($const->getAttributes(), $namespace) . "const {$const->getName()} = " . $this->dumper->dump($const->getValue(), 0) . ";\n"; } @@ -77,7 +76,7 @@ public function printClass(ClassType $class, PhpNamespace $namespace = null): st . '$' . $property->getName()); $properties[] = Helpers::formatDocComment((string) $property->getComment()) - . self::printAttributes($property->getAttributes(), $namespace) + . $this->printAttributes($property->getAttributes(), $namespace) . $def . ($property->getValue() === null && !$property->isInitialized() ? '' @@ -102,7 +101,7 @@ public function printClass(ClassType $class, PhpNamespace $namespace = null): st return Strings::normalize( Helpers::formatDocComment($class->getComment() . "\n") - . self::printAttributes($class->getAttributes(), $namespace) + . $this->printAttributes($class->getAttributes(), $namespace) . ($class->isAbstract() ? 'abstract ' : '') . ($class->isFinal() ? 'final ' : '') . ($class->getName() ? $class->getType() . ' ' . $class->getName() . ' ' : '') @@ -131,7 +130,7 @@ private function printResolvedMethod(Method $method, callable $resolver, PhpName . $method->getName(); return Helpers::formatDocComment($method->getComment() . "\n") - . self::printAttributes($method->getAttributes(), $namespace) + . $this->printAttributes($method->getAttributes(), $namespace) . $line . ($params = $this->printParameters($method, $namespace, strlen($line) + strlen($this->indentation) + 2)) . ($method->isAbstract() || $method->getBody() === null @@ -162,8 +161,8 @@ private function printAttributes(array $attrs, ?PhpNamespace $namespace, bool $i } $items = []; foreach ($attrs as $attr) { - $args = (new Dumper())->format('...?:', $attr->getArguments()); - $items[] = $this->printType($attr->getName(), false, $namespace) . ($args ? "($args)" : ''); + $args = $this->dumper->getDumper()->format('...?:', $attr->getArguments()); + $items[] = "\\" . $this->printType($attr->getName(), false, $namespace) . ($args ? "($args)" : ''); } return $inline ? '#[' . implode(', ', $items) . '] ' diff --git a/src/Attribute.php b/src/Attribute.php index 44f9fbb24..479f7d9ca 100644 --- a/src/Attribute.php +++ b/src/Attribute.php @@ -532,6 +532,7 @@ interface Attribute const LOAD_MORE_FAILED = 'load-more-failed'; const LOAD_MORE_LOADING = 'load-more-loading'; const LOCALE = 'locale'; + const LOCK_BOUNDS = 'lock-bounds'; const LONGDESC = 'longdesc'; const LOOP = 'loop'; const LOW = 'low'; @@ -1134,6 +1135,9 @@ interface Attribute const DATA_WEBCARE_ID = 'data-webcare-id'; const DATA_WIDGET_ID = 'data-widget-id'; const DATA_WIDGET_TYPE = 'data-widget-type'; + const DATA_X = 'data-x'; + const DATA_Y = 'data-y'; + const DATA_ZOOM = 'data-zoom'; const CROSSORIGIN_ANONYMOUS = 'anonymous'; const CROSSORIGIN_USE_CREDENTIALS = 'use-credentials'; diff --git a/src/Validator/Spec/DescendantTagList/AmpStoryPageAttachmentAllowedDescendants.php b/src/Validator/Spec/DescendantTagList/AmpStoryPageAttachmentAllowedDescendants.php index e08027489..1d6e265cd 100644 --- a/src/Validator/Spec/DescendantTagList/AmpStoryPageAttachmentAllowedDescendants.php +++ b/src/Validator/Spec/DescendantTagList/AmpStoryPageAttachmentAllowedDescendants.php @@ -87,6 +87,7 @@ final class AmpStoryPageAttachmentAllowedDescendants extends DescendantTagList i Extension::RENDER, Extension::RIDDLE_QUIZ, Extension::SOUNDCLOUD, + Extension::SELECTOR, Extension::SPRINGBOARD_PLAYER, Extension::TIMEAGO, Extension::TWITTER, @@ -115,6 +116,7 @@ final class AmpStoryPageAttachmentAllowedDescendants extends DescendantTagList i Element::COL, Element::COLGROUP, Element::DATA, + Element::DATALIST, Element::DD, Element::DEFS, Element::DEL, @@ -134,8 +136,10 @@ final class AmpStoryPageAttachmentAllowedDescendants extends DescendantTagList i Element::FEMERGENODE, Element::FEOFFSET, Element::FIGCAPTION, + Element::FIELDSET, Element::FIGURE, Element::FILTER, + Element::FORM, Element::FOOTER, Element::G, Element::GLYPH, @@ -153,9 +157,12 @@ final class AmpStoryPageAttachmentAllowedDescendants extends DescendantTagList i Element::I, Element::IMAGE, Element::IMG, + Element::INPUT, Internal::SIZER, Element::INS, Element::KBD, + Element::LABEL, + Element::LEGEND, Element::LI, Element::LINE, Element::LINEARGRADIENT, @@ -164,14 +171,19 @@ final class AmpStoryPageAttachmentAllowedDescendants extends DescendantTagList i Element::MARKER, Element::MASK, Element::METADATA, + Element::METER, Element::NAV, Element::OL, + Element::OPTGROUP, + Element::OPTION, + Element::OUTPUT, Element::P, Element::PATH, Element::PATTERN, Element::POLYGON, Element::POLYLINE, Element::PRE, + Element::PROGRESS, Element::Q, Element::RADIALGRADIENT, Element::RECT, @@ -182,6 +194,7 @@ final class AmpStoryPageAttachmentAllowedDescendants extends DescendantTagList i Element::S, Element::SAMP, Element::SECTION, + Element::SELECT, Element::SMALL, Element::SOLIDCOLOR, Element::SOURCE, @@ -198,6 +211,7 @@ final class AmpStoryPageAttachmentAllowedDescendants extends DescendantTagList i Element::TD, Element::TEMPLATE, Element::TEXT, + Element::TEXTAREA, Element::TEXTPATH, Element::TFOOT, Element::TH, diff --git a/src/Validator/Spec/Section/Tags.php b/src/Validator/Spec/Section/Tags.php index 70aa953ad..908b53ee2 100644 --- a/src/Validator/Spec/Section/Tags.php +++ b/src/Validator/Spec/Section/Tags.php @@ -480,6 +480,7 @@ final class Tags implements IterableSection Tag\ScriptAmpHulu::ID => Tag\ScriptAmpHulu::class, Tag\AmpHulu::ID => Tag\AmpHulu::class, Tag\ScriptAmpIframe::ID => Tag\ScriptAmpIframe::class, + Tag\ScriptAmpIframe2::ID => Tag\ScriptAmpIframe2::class, Tag\AmpIframe::ID => Tag\AmpIframe::class, Tag\ScriptAmpIframely::ID => Tag\ScriptAmpIframely::class, Tag\AmpIframely::ID => Tag\AmpIframely::class, @@ -542,6 +543,7 @@ final class Tags implements IterableSection Tag\AmpLiveListPagination::ID => Tag\AmpLiveListPagination::class, Tag\AmpLiveListItemsItem::ID => Tag\AmpLiveListItemsItem::class, Tag\ScriptAmpMathml::ID => Tag\ScriptAmpMathml::class, + Tag\ScriptAmpMathml2::ID => Tag\ScriptAmpMathml2::class, Tag\AmpMathml::ID => Tag\AmpMathml::class, Tag\ScriptAmpMegaMenu::ID => Tag\ScriptAmpMegaMenu::class, Tag\AmpMegaMenu::ID => Tag\AmpMegaMenu::class, @@ -628,6 +630,7 @@ final class Tags implements IterableSection Tag\AmpSelectorOption::ID => Tag\AmpSelectorOption::class, Tag\AmpSelectorChild::ID => Tag\AmpSelectorChild::class, Tag\ScriptAmpSidebar::ID => Tag\ScriptAmpSidebar::class, + Tag\ScriptAmpSidebar2::ID => Tag\ScriptAmpSidebar2::class, Tag\ScriptCustomElementAmpSidebarAmp4email::ID => Tag\ScriptCustomElementAmpSidebarAmp4email::class, Tag\AmpSidebar::ID => Tag\AmpSidebar::class, Tag\AmpSidebarAmp4email::ID => Tag\AmpSidebarAmp4email::class, @@ -866,6 +869,7 @@ final class Tags implements IterableSection Tag\ScriptAmpHulu::ID, Tag\ScriptAmpIframely::ID, Tag\ScriptAmpIframe::ID, + Tag\ScriptAmpIframe2::ID, Tag\ScriptAmpImaVideo::ID, Tag\ScriptAmpImageLightbox::ID, Tag\ScriptAmpImageSlider::ID, @@ -885,6 +889,7 @@ final class Tags implements IterableSection Tag\ScriptAmpList::ID, Tag\ScriptAmpLiveList::ID, Tag\ScriptAmpMathml::ID, + Tag\ScriptAmpMathml2::ID, Tag\ScriptAmpMegaMenu::ID, Tag\ScriptAmpMegaphone::ID, Tag\ScriptAmpMinuteMediaPlayer::ID, @@ -913,6 +918,7 @@ final class Tags implements IterableSection Tag\ScriptAmpSelector::ID, Tag\ScriptAmpSelector2::ID, Tag\ScriptAmpSidebar::ID, + Tag\ScriptAmpSidebar2::ID, Tag\ScriptAmpSkimlinks::ID, Tag\ScriptAmpSlides::ID, Tag\ScriptAmpSmartlinks::ID, @@ -2335,6 +2341,7 @@ final class Tags implements IterableSection Tag\ScriptAmpHulu::ID, Tag\ScriptAmpIframely::ID, Tag\ScriptAmpIframe::ID, + Tag\ScriptAmpIframe2::ID, Tag\ScriptAmpImaVideo::ID, Tag\ScriptAmpImageLightbox::ID, Tag\ScriptAmpImageSlider::ID, @@ -2354,6 +2361,7 @@ final class Tags implements IterableSection Tag\ScriptAmpList::ID, Tag\ScriptAmpLiveList::ID, Tag\ScriptAmpMathml::ID, + Tag\ScriptAmpMathml2::ID, Tag\ScriptAmpMegaMenu::ID, Tag\ScriptAmpMegaphone::ID, Tag\ScriptAmpMinuteMediaPlayer::ID, @@ -2381,6 +2389,7 @@ final class Tags implements IterableSection Tag\ScriptAmpSelector::ID, Tag\ScriptAmpSelector2::ID, Tag\ScriptAmpSidebar::ID, + Tag\ScriptAmpSidebar2::ID, Tag\ScriptAmpSkimlinks::ID, Tag\ScriptAmpSlides::ID, Tag\ScriptAmpSmartlinks::ID, @@ -2973,7 +2982,10 @@ final class Tags implements IterableSection Extension::GWD_ANIMATION => Tag\ScriptAmpGwdAnimation::ID, Extension::HULU => Tag\ScriptAmpHulu::ID, Extension::IFRAMELY => Tag\ScriptAmpIframely::ID, - Extension::IFRAME => Tag\ScriptAmpIframe::ID, + Extension::IFRAME => [ + Tag\ScriptAmpIframe::ID, + Tag\ScriptAmpIframe2::ID, + ], Extension::IMA_VIDEO => Tag\ScriptAmpImaVideo::ID, Extension::IMAGE_LIGHTBOX => [ Tag\ScriptAmpImageLightbox::ID, @@ -3004,7 +3016,10 @@ final class Tags implements IterableSection Tag\ScriptCustomElementAmpListAmp4email::ID, ], Extension::LIVE_LIST => Tag\ScriptAmpLiveList::ID, - Extension::MATHML => Tag\ScriptAmpMathml::ID, + Extension::MATHML => [ + Tag\ScriptAmpMathml::ID, + Tag\ScriptAmpMathml2::ID, + ], Extension::MEGA_MENU => Tag\ScriptAmpMegaMenu::ID, Extension::MEGAPHONE => Tag\ScriptAmpMegaphone::ID, Extension::MINUTE_MEDIA_PLAYER => Tag\ScriptAmpMinuteMediaPlayer::ID, @@ -3041,6 +3056,7 @@ final class Tags implements IterableSection ], Extension::SIDEBAR => [ Tag\ScriptAmpSidebar::ID, + Tag\ScriptAmpSidebar2::ID, Tag\ScriptCustomElementAmpSidebarAmp4email::ID, ], Extension::SKIMLINKS => Tag\ScriptAmpSkimlinks::ID, diff --git a/src/Validator/Spec/Tag/AmpAdWithTypeCustom.php b/src/Validator/Spec/Tag/AmpAdWithTypeCustom.php index f570ae8c5..8367ec33c 100644 --- a/src/Validator/Spec/Tag/AmpAdWithTypeCustom.php +++ b/src/Validator/Spec/Tag/AmpAdWithTypeCustom.php @@ -71,7 +71,7 @@ final class AmpAdWithTypeCustom extends Tag implements Identifiable SpecRule::ATTR_LISTS => [ AttributeList\ExtendedAmpGlobal::ID, ], - SpecRule::SPEC_URL => 'https://github.com/ampproject/amphtml/blob/main/ads/custom.md', + SpecRule::SPEC_URL => 'https://github.com/ampproject/amphtml/blob/main/ads/vendors/custom.md', SpecRule::AMP_LAYOUT => [ SpecRule::SUPPORTED_LAYOUTS => [ Layout::FILL, diff --git a/src/Validator/Spec/Tag/AmpStoryPanningMedia.php b/src/Validator/Spec/Tag/AmpStoryPanningMedia.php index a842b9078..7625914e5 100644 --- a/src/Validator/Spec/Tag/AmpStoryPanningMedia.php +++ b/src/Validator/Spec/Tag/AmpStoryPanningMedia.php @@ -7,6 +7,7 @@ namespace AmpProject\Validator\Spec\Tag; +use AmpProject\Attribute; use AmpProject\Extension; use AmpProject\Format; use AmpProject\Layout; @@ -20,9 +21,11 @@ * @package ampproject/amp-toolbox. * * @property-read string $tagName + * @property-read array $attrs * @property-read string $specUrl * @property-read array> $ampLayout * @property-read string $mandatoryAncestor + * @property-read array $childTags * @property-read array $htmlFormat * @property-read array $requiresExtension */ @@ -42,6 +45,22 @@ final class AmpStoryPanningMedia extends Tag implements Identifiable */ const SPEC = [ SpecRule::TAG_NAME => Extension::STORY_PANNING_MEDIA, + SpecRule::ATTRS => [ + Attribute::DATA_X => [ + SpecRule::VALUE_REGEX => '-?(0|[0-9]?\d\.?\d*%|100%)', + ], + Attribute::DATA_Y => [ + SpecRule::VALUE_REGEX => '-?(0|[0-9]?\d\.?\d*%|100%)', + ], + Attribute::DATA_ZOOM => [ + SpecRule::VALUE_REGEX => '\d+\.?\d*', + ], + Attribute::LOCK_BOUNDS => [ + SpecRule::VALUE => [ + '', + ], + ], + ], SpecRule::SPEC_URL => 'https://amp.dev/documentation/components/amp-story-panning-media', SpecRule::AMP_LAYOUT => [ SpecRule::SUPPORTED_LAYOUTS => [ @@ -49,6 +68,12 @@ final class AmpStoryPanningMedia extends Tag implements Identifiable ], ], SpecRule::MANDATORY_ANCESTOR => Extension::STORY_GRID_LAYER, + SpecRule::CHILD_TAGS => [ + SpecRule::MANDATORY_NUM_CHILD_TAGS => 1, + SpecRule::CHILD_TAG_NAME_ONEOF => [ + 'AMP-IMG', + ], + ], SpecRule::HTML_FORMAT => [ Format::AMP, ], diff --git a/src/Validator/Spec/Tag/ScriptAmpEmbedlyCard.php b/src/Validator/Spec/Tag/ScriptAmpEmbedlyCard.php index e3cfb5be5..d0054232c 100644 --- a/src/Validator/Spec/Tag/ScriptAmpEmbedlyCard.php +++ b/src/Validator/Spec/Tag/ScriptAmpEmbedlyCard.php @@ -69,7 +69,7 @@ final class ScriptAmpEmbedlyCard extends TagWithExtensionSpec implements Identif 'hasBento' => false, ], '1.0' => [ - 'hasCss' => false, + 'hasCss' => true, 'hasBento' => true, ], ]; diff --git a/src/Validator/Spec/Tag/ScriptAmpIframe.php b/src/Validator/Spec/Tag/ScriptAmpIframe.php index 149b6ed65..86ee8c9a9 100644 --- a/src/Validator/Spec/Tag/ScriptAmpIframe.php +++ b/src/Validator/Spec/Tag/ScriptAmpIframe.php @@ -23,7 +23,9 @@ * @property-read string $tagName * @property-read array $attrLists * @property-read array $htmlFormat + * @property-read array $satisfies * @property-read string $extensionSpec + * @property-read array $excludes */ final class ScriptAmpIframe extends TagWithExtensionSpec implements Identifiable { @@ -42,11 +44,12 @@ final class ScriptAmpIframe extends TagWithExtensionSpec implements Identifiable const EXTENSION_SPEC = [ SpecRule::NAME => 'amp-iframe', SpecRule::VERSION => [ - '0.1', - 'latest', + '1.0', + ], + SpecRule::VERSION_NAME => 'v1.0', + SpecRule::BENTO_SUPPORTED_VERSION => [ + '1.0', ], - SpecRule::DEPRECATED_ALLOW_DUPLICATES => true, - SpecRule::REQUIRES_USAGE => 'EXEMPTED', ]; /** @@ -62,9 +65,9 @@ final class ScriptAmpIframe extends TagWithExtensionSpec implements Identifiable * @var array */ const VERSIONS_META = [ - '0.1' => [ - 'hasCss' => false, - 'hasBento' => false, + '1.0' => [ + 'hasCss' => true, + 'hasBento' => true, ], ]; @@ -81,6 +84,12 @@ final class ScriptAmpIframe extends TagWithExtensionSpec implements Identifiable SpecRule::HTML_FORMAT => [ Format::AMP, ], + SpecRule::SATISFIES => [ + 'amp-iframe 1.0', + ], SpecRule::EXTENSION_SPEC => self::EXTENSION_SPEC, + SpecRule::EXCLUDES => [ + 'amp-iframe 0.1', + ], ]; } diff --git a/src/Validator/Spec/Tag/ScriptAmpIframe2.php b/src/Validator/Spec/Tag/ScriptAmpIframe2.php new file mode 100644 index 000000000..03eb55cc1 --- /dev/null +++ b/src/Validator/Spec/Tag/ScriptAmpIframe2.php @@ -0,0 +1,95 @@ + $attrLists + * @property-read array $htmlFormat + * @property-read array $satisfies + * @property-read string $extensionSpec + * @property-read array $excludes + */ +final class ScriptAmpIframe2 extends TagWithExtensionSpec implements Identifiable +{ + /** + * ID of the tag. + * + * @var string + */ + const ID = 'SCRIPT [amp-iframe] (2)'; + + /** + * Array of extension spec rules. + * + * @var array + */ + const EXTENSION_SPEC = [ + SpecRule::NAME => 'amp-iframe', + SpecRule::VERSION => [ + '0.1', + 'latest', + ], + SpecRule::DEPRECATED_ALLOW_DUPLICATES => true, + SpecRule::REQUIRES_USAGE => 'EXEMPTED', + SpecRule::VERSION_NAME => 'v0.1', + ]; + + /** + * Latest version of the extension. + * + * @var string + */ + const LATEST_VERSION = '0.1'; + + /** + * Meta data about the specific versions. + * + * @var array + */ + const VERSIONS_META = [ + '0.1' => [ + 'hasCss' => false, + 'hasBento' => false, + ], + ]; + + /** + * Array of spec rules. + * + * @var array + */ + const SPEC = [ + SpecRule::TAG_NAME => Element::SCRIPT, + SpecRule::ATTR_LISTS => [ + AttributeList\CommonExtensionAttrs::ID, + ], + SpecRule::HTML_FORMAT => [ + Format::AMP, + ], + SpecRule::SATISFIES => [ + 'amp-iframe 0.1', + ], + SpecRule::EXTENSION_SPEC => self::EXTENSION_SPEC, + SpecRule::EXCLUDES => [ + 'amp-iframe 1.0', + ], + ]; +} diff --git a/src/Validator/Spec/Tag/ScriptAmpMathml.php b/src/Validator/Spec/Tag/ScriptAmpMathml.php index 3c7f870fe..a5b07999f 100644 --- a/src/Validator/Spec/Tag/ScriptAmpMathml.php +++ b/src/Validator/Spec/Tag/ScriptAmpMathml.php @@ -23,7 +23,9 @@ * @property-read string $tagName * @property-read array $attrLists * @property-read array $htmlFormat + * @property-read array $satisfies * @property-read string $extensionSpec + * @property-read array $excludes */ final class ScriptAmpMathml extends TagWithExtensionSpec implements Identifiable { @@ -42,8 +44,11 @@ final class ScriptAmpMathml extends TagWithExtensionSpec implements Identifiable const EXTENSION_SPEC = [ SpecRule::NAME => 'amp-mathml', SpecRule::VERSION => [ - '0.1', - 'latest', + '1.0', + ], + SpecRule::VERSION_NAME => 'v1.0', + SpecRule::BENTO_SUPPORTED_VERSION => [ + '1.0', ], ]; @@ -60,9 +65,9 @@ final class ScriptAmpMathml extends TagWithExtensionSpec implements Identifiable * @var array */ const VERSIONS_META = [ - '0.1' => [ + '1.0' => [ 'hasCss' => true, - 'hasBento' => false, + 'hasBento' => true, ], ]; @@ -79,6 +84,12 @@ final class ScriptAmpMathml extends TagWithExtensionSpec implements Identifiable SpecRule::HTML_FORMAT => [ Format::AMP, ], + SpecRule::SATISFIES => [ + 'amp-mathml 1.0', + ], SpecRule::EXTENSION_SPEC => self::EXTENSION_SPEC, + SpecRule::EXCLUDES => [ + 'amp-mathml 0.1', + ], ]; } diff --git a/src/Validator/Spec/Tag/ScriptAmpMathml2.php b/src/Validator/Spec/Tag/ScriptAmpMathml2.php new file mode 100644 index 000000000..3b9b59516 --- /dev/null +++ b/src/Validator/Spec/Tag/ScriptAmpMathml2.php @@ -0,0 +1,93 @@ + $attrLists + * @property-read array $htmlFormat + * @property-read array $satisfies + * @property-read string $extensionSpec + * @property-read array $excludes + */ +final class ScriptAmpMathml2 extends TagWithExtensionSpec implements Identifiable +{ + /** + * ID of the tag. + * + * @var string + */ + const ID = 'SCRIPT [amp-mathml] (2)'; + + /** + * Array of extension spec rules. + * + * @var array + */ + const EXTENSION_SPEC = [ + SpecRule::NAME => 'amp-mathml', + SpecRule::VERSION => [ + '0.1', + 'latest', + ], + SpecRule::VERSION_NAME => 'v0.1', + ]; + + /** + * Latest version of the extension. + * + * @var string + */ + const LATEST_VERSION = '0.1'; + + /** + * Meta data about the specific versions. + * + * @var array + */ + const VERSIONS_META = [ + '0.1' => [ + 'hasCss' => true, + 'hasBento' => false, + ], + ]; + + /** + * Array of spec rules. + * + * @var array + */ + const SPEC = [ + SpecRule::TAG_NAME => Element::SCRIPT, + SpecRule::ATTR_LISTS => [ + AttributeList\CommonExtensionAttrs::ID, + ], + SpecRule::HTML_FORMAT => [ + Format::AMP, + ], + SpecRule::SATISFIES => [ + 'amp-mathml 0.1', + ], + SpecRule::EXTENSION_SPEC => self::EXTENSION_SPEC, + SpecRule::EXCLUDES => [ + 'amp-mathml 1.0', + ], + ]; +} diff --git a/src/Validator/Spec/Tag/ScriptAmpSidebar.php b/src/Validator/Spec/Tag/ScriptAmpSidebar.php index bb68789d0..c00ce85b7 100644 --- a/src/Validator/Spec/Tag/ScriptAmpSidebar.php +++ b/src/Validator/Spec/Tag/ScriptAmpSidebar.php @@ -23,7 +23,9 @@ * @property-read string $tagName * @property-read array $attrLists * @property-read array $htmlFormat + * @property-read array $satisfies * @property-read string $extensionSpec + * @property-read array $excludes */ final class ScriptAmpSidebar extends TagWithExtensionSpec implements Identifiable { @@ -42,11 +44,12 @@ final class ScriptAmpSidebar extends TagWithExtensionSpec implements Identifiabl const EXTENSION_SPEC = [ SpecRule::NAME => 'amp-sidebar', SpecRule::VERSION => [ - '0.1', - 'latest', + '1.0', + ], + SpecRule::VERSION_NAME => 'v1.0', + SpecRule::BENTO_SUPPORTED_VERSION => [ + '1.0', ], - SpecRule::DEPRECATED_ALLOW_DUPLICATES => true, - SpecRule::REQUIRES_USAGE => 'EXEMPTED', ]; /** @@ -62,9 +65,9 @@ final class ScriptAmpSidebar extends TagWithExtensionSpec implements Identifiabl * @var array */ const VERSIONS_META = [ - '0.1' => [ + '1.0' => [ 'hasCss' => true, - 'hasBento' => false, + 'hasBento' => true, ], ]; @@ -81,6 +84,12 @@ final class ScriptAmpSidebar extends TagWithExtensionSpec implements Identifiabl SpecRule::HTML_FORMAT => [ Format::AMP, ], + SpecRule::SATISFIES => [ + 'amp-sidebar 1.0', + ], SpecRule::EXTENSION_SPEC => self::EXTENSION_SPEC, + SpecRule::EXCLUDES => [ + 'amp-sidebar 0.1', + ], ]; } diff --git a/src/Validator/Spec/Tag/ScriptAmpSidebar2.php b/src/Validator/Spec/Tag/ScriptAmpSidebar2.php new file mode 100644 index 000000000..f496eeab9 --- /dev/null +++ b/src/Validator/Spec/Tag/ScriptAmpSidebar2.php @@ -0,0 +1,95 @@ + $attrLists + * @property-read array $htmlFormat + * @property-read array $satisfies + * @property-read string $extensionSpec + * @property-read array $excludes + */ +final class ScriptAmpSidebar2 extends TagWithExtensionSpec implements Identifiable +{ + /** + * ID of the tag. + * + * @var string + */ + const ID = 'SCRIPT [amp-sidebar] (2)'; + + /** + * Array of extension spec rules. + * + * @var array + */ + const EXTENSION_SPEC = [ + SpecRule::NAME => 'amp-sidebar', + SpecRule::VERSION => [ + '0.1', + 'latest', + ], + SpecRule::DEPRECATED_ALLOW_DUPLICATES => true, + SpecRule::REQUIRES_USAGE => 'EXEMPTED', + SpecRule::VERSION_NAME => 'v0.1', + ]; + + /** + * Latest version of the extension. + * + * @var string + */ + const LATEST_VERSION = '0.1'; + + /** + * Meta data about the specific versions. + * + * @var array + */ + const VERSIONS_META = [ + '0.1' => [ + 'hasCss' => true, + 'hasBento' => false, + ], + ]; + + /** + * Array of spec rules. + * + * @var array + */ + const SPEC = [ + SpecRule::TAG_NAME => Element::SCRIPT, + SpecRule::ATTR_LISTS => [ + AttributeList\CommonExtensionAttrs::ID, + ], + SpecRule::HTML_FORMAT => [ + Format::AMP, + ], + SpecRule::SATISFIES => [ + 'amp-sidebar 0.1', + ], + SpecRule::EXTENSION_SPEC => self::EXTENSION_SPEC, + SpecRule::EXCLUDES => [ + 'amp-sidebar 1.0', + ], + ]; +} diff --git a/src/Validator/Spec/Tag/ScriptAmpSoundcloud.php b/src/Validator/Spec/Tag/ScriptAmpSoundcloud.php index 4a1b916bc..c3fd8b299 100644 --- a/src/Validator/Spec/Tag/ScriptAmpSoundcloud.php +++ b/src/Validator/Spec/Tag/ScriptAmpSoundcloud.php @@ -66,7 +66,7 @@ final class ScriptAmpSoundcloud extends TagWithExtensionSpec implements Identifi */ const VERSIONS_META = [ '1.0' => [ - 'hasCss' => false, + 'hasCss' => true, 'hasBento' => true, ], ];