-
Notifications
You must be signed in to change notification settings - Fork 800
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate the vimeo shortcode AMP logic to Jetpack from the AMP plugin #13921
Conversation
Most of the functionality is the same, though there are some changes. Also, add 2 parameters to the filter 'video_embed_html'. This might be questionable, but it prevents adding another filter, or adding AMP logic directly in the Vimeo shortcode file.
Thank you for the great PR description! When this PR is ready for review, please apply the Scheduled Jetpack release: December 3, 2019. |
These functions were 2 and 1 lines long, respectively.
In response to Code Climate report, with the cognitive complexity too high.
In response to a Code Climate report of the class being too long.
Also, add it to the phpcs whitelist to be linted.
Instead of onthe, change this to on the. Also, front-end instead of frontend.
With the commits above, this should be ready for review. But no pressure, this is a busy week 😄 |
Does this work with just |
This will then use 12345 as the data-videoid. For compatibility with how the non-AMP shortcode works, though this didn't work in AMP before.
Hi @chvillanuevap, it does now 😄 |
In case there are more shortcode handlers. The Code Climate limit of around 200 LOC per class won't allow for more than 1 more shortcode handler in this class.
This is only called by build_tag(), so it shouldnt' be needed.
There were apparently 5 too many LOC, so this reduces the lines.
The name of $string is misleading, as it's actually an array().
This file name changed, so change it in the whitelist also.
This is in a class with Vimeo in the name, so it's probably not necessary to have Vimeo in the function name.
This should have been almost at the top before, so move it one place up.
It looks like array() is by far the most common syntax in Jetpack.
Uses jetpack_shortcode_get_vimeo_dimensions() for both the non-AMP and AMP shortcodes.
The means of getting dimension changed, so update the tests.
The function name is no jetpack_amp_vimeo_shortcode in Automattic/jetpack#13921
There were still a few places where the new name of jetpack_amp_vimeo_shortcode() did not appear.
That has its own tests, so it's not very helpful to mark that as @covered.
There was only 1 failure: rbenv: version 7.2 not installed
Hi Jeremy, All of the testing shortcodes in step 13 here look good with AMP. They don't all look exactly the same as the non-AMP shortcodes, as the That was also the case in the AMP plugin. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. It should be good to merge.
After thinking about this some more, I committed 1bfc3e6 to simplify things a bit more. Now that we moved dimensions into their own function, I think that makes things a bit simpler and easier to follow. It should also be a bit better performance-wise.
kienstra, Your synced wpcom patch D35016-code has been updated. |
The AMP plugin is not up to date on WordPress.com yet, we can't test everything there yet.
* 8.0 Release: running changelog * Changelog: add #13921 * Changelog: add #13980 * Changelog: add #13905 * Changelog: add #13971 * Changelog: add #13984 * Changelog: add #14009 * Changelog: add #13620 * Remove things that will ship in 7.9.1 * Changelog: add 7.9.1 release (#14044) * Changelog: add base for 7.9.1 release * Update release date and post link * Changelog: add #14066 * Update changelog for 7.9.1 * Changelog: add #13405 * Changelog: add #13841 * Changelog: add #13924 * Changelog: add #13986 * Changelog: add #14010, #14028, #14053, #14055. * Changelog: add #14054 * Changelog: add #14031 * Changelog: add #14039 * Changelog: add #14050 * Changelog: add #14070 * Changelog: add #14082 * Changelog: add #14084 * Changelog: add #14111 * Changelog: add #13961 * Changelog: add #14047 * Changelog: add #14091 * Changelog: add #14108 * Changelog: add #14121
Summary
Proposes migrating the AMP conversion of the Jetpack
[vimeo]
shortcode from the AMP plugin to Jetpack.Fixes ampproject/amp-wp#3309
Changes proposed in this Pull Request:
Would you be open to migrating the AMP plugin's conversion of Jetpack's
[vimeo]
shortcode into Jetpack?This should give you more control over how your shortcode works.
As Weston mentioned in ampproject/amp-wp#3309 (comment), there's been ongoing work to move Jetpack functionality from the AMP plugin into Jetpack.
Is this a new feature or does it add/remove features to an existing part of Jetpack?
This is a new feature to Jetpack, but mainly a migration of the AMP plugin's logic into Jetpack.
Testing instructions:
wp-config.php
hasdefine( 'JETPACK_DEV_DEBUG', true);
/wp-admin
, in the Jetpack 'Settings' page, and in the 'Writing' tab, ensure this is toggled on:[vimeo]
shortcode callback: Remove handling of Jetpack shortcodes ampproject/amp-wp#3678$ npm install && composer install
&
or?amp
to the URL, and look at how the Vimeo shortcode lookscheckout
themaster
branch of Jetpack, not this PR's branchmaster
branchBefore
After
Proposed changelog entry for your changes:
Migrate AMP-conversion of Vimeo shortcode from the AMP plugin to Jetpack.