From 599181c0d11376c41d3ac7fc812bee08b896f4b3 Mon Sep 17 00:00:00 2001 From: Marcelo Vani Date: Thu, 29 Nov 2018 14:46:06 +0000 Subject: [PATCH 1/4] Fixing scripts --- bin/amphtml-update.sh | 6 +++--- bin/create-gutenberg-test-post.sh | 2 +- bin/install-wp-tests.sh | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/bin/amphtml-update.sh b/bin/amphtml-update.sh index 653ceed52ba..89f6a96c09a 100644 --- a/bin/amphtml-update.sh +++ b/bin/amphtml-update.sh @@ -17,14 +17,14 @@ fi sudo apt-get install git python protobuf-compiler python-protobuf # Create and go to vendor. -if [[ ! -e $VENDOR_PATH ]]; then +if [ ! -e $VENDOR_PATH ]; then mkdir $VENDOR_PATH fi cd $VENDOR_PATH # Clone amphtml repo. -if [[ ! -e $VENDOR_PATH/amphtml ]]; then - git clone https://github.com/ampproject/amphtml amphtml +if [ ! -e $VENDOR_PATH/amphtml ]; then + git clone --depth=1 https://github.com/ampproject/amphtml amphtml else cd $VENDOR_PATH/amphtml/validator git fetch --tags diff --git a/bin/create-gutenberg-test-post.sh b/bin/create-gutenberg-test-post.sh index 1c719dac00c..a2513887110 100644 --- a/bin/create-gutenberg-test-post.sh +++ b/bin/create-gutenberg-test-post.sh @@ -13,7 +13,7 @@ if [[ ! -e $GUTENBERG_PATH ]]; then echo "This needs to clone the Gutenberg plugin into your plugins directory, as it looks like it's not there." read -p "Is that alright? y/n " -r if [[ $REPLY =~ [Yy] ]]; then - git clone https://github.com/WordPress/gutenberg.git + git clone --depth=1 https://github.com/WordPress/gutenberg.git wp plugin activate gutenberg echo "The Gutenberg plugin is cloned. Please follow the build steps:" echo "https://github.com/WordPress/gutenberg/blob/master/CONTRIBUTING.md" diff --git a/bin/install-wp-tests.sh b/bin/install-wp-tests.sh index 9f009876bfb..1a6c88a5a0a 100755 --- a/bin/install-wp-tests.sh +++ b/bin/install-wp-tests.sh @@ -104,7 +104,8 @@ install_db() { fi # create database - mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA + mysql --user="$DB_USER" --password="$DB_PASS"$EXTRA -e"DROP DATABASE IF EXISTS $DB_NAME" + mysql --user="$DB_USER" --password="$DB_PASS"$EXTRA -e"create DATABASE $DB_NAME" } install_wp From 807b48fe3619af0357965c110c5fe711f24a9bd2 Mon Sep 17 00:00:00 2001 From: Marcelo Vani Date: Thu, 29 Nov 2018 14:57:35 +0000 Subject: [PATCH 2/4] Speeding up script --- bin/amphtml-update.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/amphtml-update.sh b/bin/amphtml-update.sh index 89f6a96c09a..c83ad4e05ad 100644 --- a/bin/amphtml-update.sh +++ b/bin/amphtml-update.sh @@ -26,8 +26,8 @@ cd $VENDOR_PATH if [ ! -e $VENDOR_PATH/amphtml ]; then git clone --depth=1 https://github.com/ampproject/amphtml amphtml else - cd $VENDOR_PATH/amphtml/validator - git fetch --tags + cd $VENDOR_PATH/amphtml + git pull fi # Check out the latest tag. From 60615fff192ca0495ab93b7ebfd7a261c09f5458 Mon Sep 17 00:00:00 2001 From: Marcelo Vani Date: Thu, 29 Nov 2018 14:57:44 +0000 Subject: [PATCH 3/4] Run update --- .../class-amp-allowed-tags-generated.php | 428 ++++++++++++++---- 1 file changed, 346 insertions(+), 82 deletions(-) diff --git a/includes/sanitizers/class-amp-allowed-tags-generated.php b/includes/sanitizers/class-amp-allowed-tags-generated.php index 7d85042a281..f25c2ac88a0 100644 --- a/includes/sanitizers/class-amp-allowed-tags-generated.php +++ b/includes/sanitizers/class-amp-allowed-tags-generated.php @@ -13,7 +13,7 @@ */ class AMP_Allowed_Tags_Generated { - private static $spec_file_revision = 757; + private static $spec_file_revision = 772; private static $minimum_validator_revision_required = 348; private static $allowed_tags = array( @@ -1680,6 +1680,36 @@ class AMP_Allowed_Tags_Generated { ), ), ), + 'amp-delight-player' => array( + array( + 'attr_spec_list' => array( + 'data-content-id' => array( + 'mandatory' => true, + ), + 'media' => array(), + 'noloading' => array( + 'value' => array( + '', + ), + ), + ), + 'tag_spec' => array( + 'amp_layout' => array( + 'supported_layouts' => array( + 6, + 2, + 3, + 7, + 1, + 4, + ), + ), + 'requires_extension' => array( + 'amp-delight-player', + ), + ), + ), + ), 'amp-embed' => array( array( 'attr_spec_list' => array( @@ -2936,6 +2966,36 @@ class AMP_Allowed_Tags_Generated { 'unique' => true, ), ), + array( + 'attr_spec_list' => array( + 'data-client' => array( + 'mandatory' => true, + ), + 'data-slot' => array( + 'mandatory' => true, + ), + 'type' => array( + 'mandatory' => true, + 'value' => array( + 'adsense', + ), + ), + ), + 'tag_spec' => array( + 'reference_points' => array( + 'AMP-NEXT-PAGE > [separator]' => array( + 'mandatory' => false, + 'unique' => true, + ), + ), + 'requires_extension' => array( + 'amp-next-page', + ), + 'spec_name' => 'amp-next-page [type=adsense]', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-next-page', + 'unique' => true, + ), + ), ), 'amp-nexxtv-player' => array( array( @@ -3438,47 +3498,6 @@ class AMP_Allowed_Tags_Generated { ), ), ), - 'amp-script' => array( - array( - 'attr_spec_list' => array( - 'media' => array(), - 'noloading' => array( - 'value' => array( - '', - ), - ), - 'src' => array( - 'blacklisted_value_regex' => '__amp_source_origin', - 'mandatory' => true, - 'value_url' => array( - 'allow_relative' => false, - 'protocol' => array( - 'https', - ), - ), - ), - ), - 'tag_spec' => array( - 'amp_layout' => array( - 'supported_layouts' => array( - 5, - 6, - 2, - 3, - 7, - 1, - 4, - ), - ), - 'disallowed_ancestor' => array( - 'amp-script', - ), - 'requires_extension' => array( - 'amp-script', - ), - ), - ), - ), 'amp-selector' => array( array( 'attr_spec_list' => array( @@ -4376,6 +4395,151 @@ class AMP_Allowed_Tags_Generated { ), ), ), + 'amp-video-iframe' => array( + array( + 'attr_spec_list' => array( + 'album' => array(), + 'alt' => array(), + 'artist' => array(), + 'artwork' => array(), + 'attribution' => array(), + 'autoplay' => array( + 'value' => array( + '', + ), + ), + 'implements-media-session' => array( + 'value' => array( + '', + ), + ), + 'implements-rotate-to-fullscreen' => array( + 'value' => array( + '', + ), + ), + 'lightbox' => array(), + 'lightbox-thumbnail-id' => array( + 'value_regex_casei' => '^[a-z][a-z\\d_-]*', + ), + 'media' => array(), + 'noloading' => array( + 'value' => array( + '', + ), + ), + 'poster' => array( + 'mandatory' => true, + ), + 'referrerpolicy' => array(), + 'rotate-to-fullscreen' => array( + 'value' => array( + '', + ), + ), + 'src' => array( + 'blacklisted_value_regex' => '__amp_source_origin', + 'mandatory' => true, + 'value_url' => array( + 'protocol' => array( + 'https', + ), + ), + ), + ), + 'tag_spec' => array( + 'amp_layout' => array( + 'supported_layouts' => array( + 6, + 2, + 3, + 7, + 9, + 1, + 4, + ), + ), + 'requires_extension' => array( + 'amp-video-iframe', + ), + 'spec_name' => 'AMP-VIDEO-IFRAME[poster]', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-video-iframe', + ), + ), + array( + 'attr_spec_list' => array( + 'album' => array(), + 'alt' => array(), + 'artist' => array(), + 'artwork' => array(), + 'attribution' => array(), + 'autoplay' => array( + 'value' => array( + '', + ), + ), + 'implements-media-session' => array( + 'value' => array( + '', + ), + ), + 'implements-rotate-to-fullscreen' => array( + 'value' => array( + '', + ), + ), + 'lightbox' => array(), + 'lightbox-thumbnail-id' => array( + 'value_regex_casei' => '^[a-z][a-z\\d_-]*', + ), + 'media' => array(), + 'noloading' => array( + 'value' => array( + '', + ), + ), + 'referrerpolicy' => array(), + 'rotate-to-fullscreen' => array( + 'value' => array( + '', + ), + ), + 'src' => array( + 'blacklisted_value_regex' => '__amp_source_origin', + 'mandatory' => true, + 'value_url' => array( + 'protocol' => array( + 'https', + ), + ), + ), + ), + 'tag_spec' => array( + 'amp_layout' => array( + 'supported_layouts' => array( + 6, + 2, + 3, + 7, + 9, + 1, + 4, + ), + ), + 'reference_points' => array( + 'AMP-VIDEO-IFRAME > [placeholder]' => array( + 'mandatory' => true, + 'unique' => true, + ), + ), + 'requires_extension' => array( + 'amp-video-iframe', + ), + 'spec_name' => 'AMP-VIDEO-IFRAME with [placeholder]', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-video-iframe', + ), + ), + ), 'amp-vimeo' => array( array( 'attr_spec_list' => array( @@ -6807,6 +6971,7 @@ class AMP_Allowed_Tags_Generated { array( 'attr_spec_list' => array( 'alt' => array(), + 'attribution' => array(), 'border' => array(), 'decoding' => array( 'value' => array( @@ -6826,6 +6991,7 @@ class AMP_Allowed_Tags_Generated { ), ), ), + 'sizes' => array(), 'src' => array( 'alternative_names' => array( 'srcset', @@ -10025,6 +10191,31 @@ class AMP_Allowed_Tags_Generated { ), ), ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => array( + '', + ), + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => array( + 'text/javascript', + ), + ), + ), + 'tag_spec' => array( + 'extension_spec' => array( + 'name' => 'amp-delight-player', + 'version' => array( + '0.1', + 'latest', + ), + ), + ), + ), array( 'attr_spec_list' => array( 'async' => array( @@ -11346,31 +11537,6 @@ class AMP_Allowed_Tags_Generated { ), ), ), - array( - 'attr_spec_list' => array( - 'async' => array( - 'mandatory' => true, - 'value' => array( - '', - ), - ), - 'nonce' => array(), - 'type' => array( - 'value_casei' => array( - 'text/javascript', - ), - ), - ), - 'tag_spec' => array( - 'extension_spec' => array( - 'name' => 'amp-script', - 'version' => array( - '0.1', - 'latest', - ), - ), - ), - ), array( 'attr_spec_list' => array( 'async' => array( @@ -11637,6 +11803,25 @@ class AMP_Allowed_Tags_Generated { ), ), ), + array( + 'attr_spec_list' => array( + 'type' => array( + 'dispatch_key' => 3, + 'mandatory' => true, + 'value_casei' => array( + 'application/json', + ), + ), + ), + 'tag_spec' => array( + 'mandatory_parent' => 'amp-story-bookend', + 'requires_extension' => array( + 'amp-story', + ), + 'spec_name' => 'amp-story-bookend extension .json script', + 'unique' => true, + ), + ), array( 'attr_spec_list' => array( 'nonce' => array(), @@ -11830,6 +12015,61 @@ class AMP_Allowed_Tags_Generated { ), ), ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => array( + '', + ), + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => array( + 'text/javascript', + ), + ), + ), + 'tag_spec' => array( + 'extension_spec' => array( + 'name' => 'amp-video-docking', + 'requires_usage' => 3, + 'version' => array( + '0.1', + 'latest', + ), + ), + 'requires_extension' => array( + 'amp-video', + ), + 'spec_name' => 'amp-video-docking for amp-video', + ), + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => array( + '', + ), + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => array( + 'text/javascript', + ), + ), + ), + 'tag_spec' => array( + 'extension_spec' => array( + 'name' => 'amp-video-iframe', + 'version' => array( + '0.1', + 'latest', + ), + ), + ), + ), array( 'attr_spec_list' => array( 'async' => array( @@ -12463,21 +12703,6 @@ class AMP_Allowed_Tags_Generated { 'unique' => true, ), ), - array( - 'attr_spec_list' => array( - 'nonce' => array(), - ), - 'cdata' => array( - 'cdata_regex' => 'body ?{opacity: ?0}', - ), - 'tag_spec' => array( - 'mandatory_alternatives' => 'head > style[amp-boilerplate]', - 'mandatory_parent' => 'head', - 'spec_name' => 'head > style[amp-boilerplate] - old variant', - 'spec_url' => 'https://github.com/ampproject/amphtml/blob/master/spec/amp-boilerplate.md', - 'unique' => true, - ), - ), array( 'attr_spec_list' => array( 'amp-boilerplate' => array( @@ -14384,6 +14609,20 @@ class AMP_Allowed_Tags_Generated { 'animate-in-after' => array(), 'animate-in-delay' => array(), 'animate-in-duration' => array(), + 'data-tooltip-icon' => array( + 'value_url' => array( + 'protocol' => array( + 'http', + 'https', + 'data', + ), + ), + ), + 'target' => array( + 'value' => array( + '_blank', + ), + ), ), 'tag_spec' => array( 'reference_points' => array( @@ -14450,6 +14689,15 @@ class AMP_Allowed_Tags_Generated { 'animate-in-after' => array(), 'animate-in-delay' => array(), 'animate-in-duration' => array(), + 'data-tooltip-icon' => array( + 'value_url' => array( + 'protocol' => array( + 'http', + 'https', + 'data', + ), + ), + ), 'grid-area' => array(), 'justify-content' => array( 'value' => array( @@ -14478,6 +14726,11 @@ class AMP_Allowed_Tags_Generated { 'stretch', ), ), + 'target' => array( + 'value' => array( + '_blank', + ), + ), ), 'tag_spec' => array( 'reference_points' => array( @@ -14490,6 +14743,17 @@ class AMP_Allowed_Tags_Generated { 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-story', ), ), + 'AMP-VIDEO-IFRAME > [placeholder]' => array( + 'attr_spec_list' => array( + 'placeholder' => array( + 'mandatory' => true, + ), + ), + 'tag_spec' => array( + 'spec_name' => 'AMP-VIDEO-IFRAME > [placeholder]', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-video-iframe', + ), + ), ); From 958b82dcf04cebbe1226a23cdd4690342f39a5d8 Mon Sep 17 00:00:00 2001 From: Marcelo Vani Date: Thu, 29 Nov 2018 18:17:00 +0000 Subject: [PATCH 4/4] Reinstated file --- bin/amphtml-update.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/amphtml-update.sh b/bin/amphtml-update.sh index c83ad4e05ad..653ceed52ba 100644 --- a/bin/amphtml-update.sh +++ b/bin/amphtml-update.sh @@ -17,17 +17,17 @@ fi sudo apt-get install git python protobuf-compiler python-protobuf # Create and go to vendor. -if [ ! -e $VENDOR_PATH ]; then +if [[ ! -e $VENDOR_PATH ]]; then mkdir $VENDOR_PATH fi cd $VENDOR_PATH # Clone amphtml repo. -if [ ! -e $VENDOR_PATH/amphtml ]; then - git clone --depth=1 https://github.com/ampproject/amphtml amphtml +if [[ ! -e $VENDOR_PATH/amphtml ]]; then + git clone https://github.com/ampproject/amphtml amphtml else - cd $VENDOR_PATH/amphtml - git pull + cd $VENDOR_PATH/amphtml/validator + git fetch --tags fi # Check out the latest tag.