Skip to content
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

Migrating multiple fixes upstream #164

Merged
merged 6 commits into from
Feb 13, 2017

Conversation

SGudbrandsson
Copy link
Contributor

@SGudbrandsson SGudbrandsson commented Feb 9, 2017

  • Safe HTML escaping for youtube IDs
  • Fix <amp-img> when image height is missing
  • Fix youtube start time hashes in the youtube IDs
  • Added optional amp-anim for animated images (gif and png).
    • Very expensive to run, so make sure to cache the output AMP.
  • Fixed the out files to pass the build phase.
  • Modified .travis.yml to allow PHP:nightly to fail

Sigurdur Gudbrandsson and others added 3 commits February 9, 2017 13:11
The DOM parser throws away invalid HTML.

When you have http://youtube.com/embed/_FlV6pgwlrk&list=123 then
the `IframeYouTubeTagTransformPass::getYouTubeCode()` will match the
ID as `_FlV6pgwlrk&list=123` but since the ampersand isn't in a
proper HTML format (`&amp;`), then DOM will throw this whole
element away.

I wrote a test to make sure noone breaks this in the future.
@@ -174,6 +174,17 @@ public function loadHtml($html, $options = [])
$options['use_html5_parser'] = true;
}

// By default the convertion of img into amp-anim is disabled (because of ressource cost)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by resource costs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the amp-anim is enabled, all gif and png images are downloaded by the server and processed bytewise to detect if they are animated or not.
If they are animated, the amp-anim tag is added.
If they are not animated, a normal amp-img tag is added.

This can consume a lot of resources if you don't cache the AMP output in your system.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might make sense to document this somewhere (we probably should add the config options to the readme).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright .. I created a new issue with a checklist of what needs to be done here: #168

/**
* Identifies APNGs
* Written by Coda, functionified by Foone/Popcorn Mariachi#!9i78bPeIxI
* This code is in the public domain
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a link to the existing code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well spotted.

I've added the links to the existing code.

@sebastianbenz sebastianbenz merged commit a9bb7fe into Lullabot:master Feb 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants