From 49b376e9c8bb5295efdd31378aa22192c60fac46 Mon Sep 17 00:00:00 2001 From: FuzzyTree Date: Thu, 22 Sep 2016 18:10:25 -0700 Subject: [PATCH 01/16] Add fixed layout option by width for images --- src/Pass/ImgTagTransformPass.php | 15 ++++++++++++++- .../fragment-html/img-test-fragment.html | 2 +- .../img-test-fragment.html.options.json | 3 +++ .../fragment-html/img-test-fragment.html.out | 6 +++--- 4 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 tests/test-data/fragment-html/img-test-fragment.html.options.json diff --git a/src/Pass/ImgTagTransformPass.php b/src/Pass/ImgTagTransformPass.php index 89757773..50b0cfcf 100644 --- a/src/Pass/ImgTagTransformPass.php +++ b/src/Pass/ImgTagTransformPass.php @@ -121,11 +121,24 @@ protected function convertAmpImg($el, $lineno, $context_string) $dom_el = $el->get(0); $new_dom_el = $this->cloneAndRenameDomElement($dom_el, 'amp-img'); $new_el = $el->prev(); - $this->setLayoutIfNoLayout($new_el, 'responsive'); + $this->setLayoutIfNoLayout($new_el, $this->getLayout($el)); $this->addActionTaken(new ActionTakenLine('img', ActionTakenType::IMG_CONVERTED, $lineno, $context_string)); return $new_dom_el; } + /** + * Given an image DOMQuery + * Returns whether the image should have 'fixed' or 'responsive' layout + * + * @param DOMQuery $el + * @return string + */ + protected function getLayout($el) { + return (isset($this->options['img_max_fixed_layout_width']) + && $this->options['img_max_fixed_layout_width'] >= $el->attr('width')) + ? 'fixed' : 'responsive'; + } + /** * Given an image src attribute, try to get its dimensions * Returns false on failure diff --git a/tests/test-data/fragment-html/img-test-fragment.html b/tests/test-data/fragment-html/img-test-fragment.html index 504490de..348842c8 100644 --- a/tests/test-data/fragment-html/img-test-fragment.html +++ b/tests/test-data/fragment-html/img-test-fragment.html @@ -3,7 +3,7 @@ - + diff --git a/tests/test-data/fragment-html/img-test-fragment.html.options.json b/tests/test-data/fragment-html/img-test-fragment.html.options.json new file mode 100644 index 00000000..161df05d --- /dev/null +++ b/tests/test-data/fragment-html/img-test-fragment.html.options.json @@ -0,0 +1,3 @@ +{ + "img_max_fixed_layout_width" : 200 +} \ No newline at end of file diff --git a/tests/test-data/fragment-html/img-test-fragment.html.out b/tests/test-data/fragment-html/img-test-fragment.html.out index 6309a45c..e52f7f55 100644 --- a/tests/test-data/fragment-html/img-test-fragment.html.out +++ b/tests/test-data/fragment-html/img-test-fragment.html.out @@ -3,8 +3,8 @@ - - + + @@ -31,7 +31,7 @@ Line 2: Line 3: Line 4: Line 5: -Line 6: +Line 6: Line 7: Line 8: Line 9: From 0f71259f4359bd947f9b99a4071409c620d437e6 Mon Sep 17 00:00:00 2001 From: FuzzyTree Date: Fri, 23 Sep 2016 22:19:35 -0700 Subject: [PATCH 02/16] Add amp-ad support. Regenerated validator-generated.php file with custom script tags from: https://github.com/ampproject/amphtml/blob/master/extensions/amp-ad/0.1/validator-amp-ad.protoascii Regenerating the validator was necessary to avoid flagging the script tag for in as an error --- src/Pass/StandardFixPass.php | 5 + src/Spec/validator-generated.php | 4344 +++++++++-------- src/Validate/Context.php | 1 + .../full-html/mandatory_dimensions.html.out | 1 + .../full-html/several_errors.html.out | 1 + .../test-data/full-html/spec_example.html.out | 3 +- tests/test-data/full-html/urls.html.out | 1 + .../full-html/validator-amp-sidebar.html.out | 1 + 8 files changed, 2200 insertions(+), 2157 deletions(-) diff --git a/src/Pass/StandardFixPass.php b/src/Pass/StandardFixPass.php index c5771d8d..fc52c4a4 100644 --- a/src/Pass/StandardFixPass.php +++ b/src/Pass/StandardFixPass.php @@ -58,6 +58,11 @@ class StandardFixPass extends BasePass public function pass() { + $all_ampad = $this->q->top()->find('amp-ad'); + if ($all_ampad->length > 0) { + $this->addComponentJsToHead('amp-ad'); + } + /** @var SValidationError $error */ foreach ($this->validation_result->errors as $error) { // If the error was resolved, continue diff --git a/src/Spec/validator-generated.php b/src/Spec/validator-generated.php index 082bb58a..6523ef92 100644 --- a/src/Spec/validator-generated.php +++ b/src/Spec/validator-generated.php @@ -2358,33 +2358,39 @@ public static function createValidationRules() { $o_564->tag_name = 'o:p'; $o_0->tags[] = $o_564; $o_565 = new TagSpec(); - $o_565->tag_name = 'amp-ad'; + $o_565->tag_name = 'script'; + $o_565->spec_name = 'amp-ad extension .js script'; + $o_565->mandatory_parent = 'head'; $o_566 = new AttrSpec(); - $o_566->name = 'alt'; + $o_566->name = 'async'; + $o_566->mandatory = true; + $o_566->value = ''; $o_565->attrs[] = $o_566; $o_567 = new AttrSpec(); - $o_567->name = 'json'; + $o_567->name = 'custom-element'; + $o_567->mandatory = true; + $o_567->value = 'amp-ad'; + $o_567->dispatch_key = true; $o_565->attrs[] = $o_567; $o_568 = new AttrSpec(); $o_568->name = 'src'; - $o_569 = new UrlSpec(); - $o_569->allowed_protocol = ['https']; - $o_569->allow_relative = true; - $o_568->value_url = $o_569; + $o_568->mandatory = true; + $o_568->value_regex = 'https://cdn\\.ampproject\\.org/v0/amp-ad-(latest|0\\.1).js'; $o_565->attrs[] = $o_568; - $o_570 = new AttrSpec(); - $o_570->name = 'type'; - $o_570->mandatory = true; - $o_565->attrs[] = $o_570; - $o_565->attr_lists = ['extended-amp-global']; - $o_565->spec_url = 'https://www.ampproject.org/docs/reference/amp-ad.html'; - $o_571 = new AmpLayout(); - $o_571->supported_layouts = [AmpLayoutLayout::FILL, AmpLayoutLayout::FIXED, AmpLayoutLayout::FIXED_HEIGHT, AmpLayoutLayout::FLEX_ITEM, AmpLayoutLayout::NODISPLAY, AmpLayoutLayout::RESPONSIVE]; - $o_565->amp_layout = $o_571; - $o_565->disallowed_ancestor = ['amp-sidebar']; + $o_569 = new AttrSpec(); + $o_569->name = 'type'; + $o_569->value = 'text/javascript'; + $o_565->attrs[] = $o_569; + $o_565->spec_url = 'https://www.ampproject.org/docs/reference/extended/amp-ad.html'; + $o_570 = new CdataSpec(); + $o_571 = new BlackListedCDataRegex(); + $o_571->regex = '.'; + $o_571->error_message = 'contents'; + $o_570->blacklisted_cdata_regex[] = $o_571; + $o_565->cdata = $o_570; $o_0->tags[] = $o_565; $o_572 = new TagSpec(); - $o_572->tag_name = 'amp-embed'; + $o_572->tag_name = 'amp-ad'; $o_573 = new AttrSpec(); $o_573->name = 'alt'; $o_572->attrs[] = $o_573; @@ -2403,723 +2409,717 @@ public static function createValidationRules() { $o_577->mandatory = true; $o_572->attrs[] = $o_577; $o_572->attr_lists = ['extended-amp-global']; - $o_572->spec_url = 'https://www.ampproject.org/docs/reference/amp-embed.html'; + $o_572->spec_url = 'https://www.ampproject.org/docs/reference/amp-ad.html'; $o_578 = new AmpLayout(); $o_578->supported_layouts = [AmpLayoutLayout::FILL, AmpLayoutLayout::FIXED, AmpLayoutLayout::FIXED_HEIGHT, AmpLayoutLayout::FLEX_ITEM, AmpLayoutLayout::NODISPLAY, AmpLayoutLayout::RESPONSIVE]; $o_572->amp_layout = $o_578; $o_572->disallowed_ancestor = ['amp-sidebar']; $o_0->tags[] = $o_572; $o_579 = new TagSpec(); - $o_579->tag_name = 'amp-img'; + $o_579->tag_name = 'amp-embed'; $o_580 = new AttrSpec(); $o_580->name = 'alt'; $o_579->attrs[] = $o_580; $o_581 = new AttrSpec(); - $o_581->name = 'attribution'; + $o_581->name = 'json'; $o_579->attrs[] = $o_581; $o_582 = new AttrSpec(); - $o_582->name = 'placeholder'; + $o_582->name = 'src'; + $o_583 = new UrlSpec(); + $o_583->allowed_protocol = ['https']; + $o_583->allow_relative = true; + $o_582->value_url = $o_583; $o_579->attrs[] = $o_582; - $o_579->attr_lists = ['extended-amp-global', 'mandatory-src-or-srcset']; - $o_579->spec_url = 'https://www.ampproject.org/docs/reference/amp-img.html'; - $o_583 = new AmpLayout(); - $o_583->supported_layouts = [AmpLayoutLayout::FILL, AmpLayoutLayout::FIXED, AmpLayoutLayout::FIXED_HEIGHT, AmpLayoutLayout::FLEX_ITEM, AmpLayoutLayout::NODISPLAY, AmpLayoutLayout::RESPONSIVE]; - $o_579->amp_layout = $o_583; + $o_584 = new AttrSpec(); + $o_584->name = 'type'; + $o_584->mandatory = true; + $o_579->attrs[] = $o_584; + $o_579->attr_lists = ['extended-amp-global']; + $o_579->spec_url = 'https://www.ampproject.org/docs/reference/amp-embed.html'; + $o_585 = new AmpLayout(); + $o_585->supported_layouts = [AmpLayoutLayout::FILL, AmpLayoutLayout::FIXED, AmpLayoutLayout::FIXED_HEIGHT, AmpLayoutLayout::FLEX_ITEM, AmpLayoutLayout::NODISPLAY, AmpLayoutLayout::RESPONSIVE]; + $o_579->amp_layout = $o_585; + $o_579->disallowed_ancestor = ['amp-sidebar']; $o_0->tags[] = $o_579; - $o_584 = new TagSpec(); - $o_584->tag_name = 'amp-pixel'; - $o_585 = new AttrSpec(); - $o_585->name = 'src'; - $o_585->mandatory = true; - $o_586 = new UrlSpec(); - $o_586->allowed_protocol = ['https']; - $o_586->allow_relative = true; - $o_585->value_url = $o_586; - $o_584->attrs[] = $o_585; - $o_584->attr_lists = ['extended-amp-global']; - $o_584->spec_url = 'https://www.ampproject.org/docs/reference/amp-pixel.html'; - $o_587 = new AmpLayout(); - $o_587->supported_layouts = [AmpLayoutLayout::FIXED, AmpLayoutLayout::NODISPLAY]; - $o_587->defines_default_width = true; - $o_587->defines_default_height = true; - $o_584->amp_layout = $o_587; - $o_584->disallowed_ancestor = ['amp-sidebar']; - $o_0->tags[] = $o_584; - $o_588 = new TagSpec(); - $o_588->tag_name = 'amp-video'; + $o_586 = new TagSpec(); + $o_586->tag_name = 'amp-img'; + $o_587 = new AttrSpec(); + $o_587->name = 'alt'; + $o_586->attrs[] = $o_587; + $o_588 = new AttrSpec(); + $o_588->name = 'attribution'; + $o_586->attrs[] = $o_588; $o_589 = new AttrSpec(); - $o_589->name = 'alt'; - $o_588->attrs[] = $o_589; - $o_590 = new AttrSpec(); - $o_590->name = 'attribution'; - $o_588->attrs[] = $o_590; - $o_591 = new AttrSpec(); - $o_591->name = 'autoplay'; - $o_591->value = ''; - $o_588->attrs[] = $o_591; + $o_589->name = 'placeholder'; + $o_586->attrs[] = $o_589; + $o_586->attr_lists = ['extended-amp-global', 'mandatory-src-or-srcset']; + $o_586->spec_url = 'https://www.ampproject.org/docs/reference/amp-img.html'; + $o_590 = new AmpLayout(); + $o_590->supported_layouts = [AmpLayoutLayout::FILL, AmpLayoutLayout::FIXED, AmpLayoutLayout::FIXED_HEIGHT, AmpLayoutLayout::FLEX_ITEM, AmpLayoutLayout::NODISPLAY, AmpLayoutLayout::RESPONSIVE]; + $o_586->amp_layout = $o_590; + $o_0->tags[] = $o_586; + $o_591 = new TagSpec(); + $o_591->tag_name = 'amp-pixel'; $o_592 = new AttrSpec(); - $o_592->name = 'controls'; - $o_592->value = ''; - $o_588->attrs[] = $o_592; - $o_593 = new AttrSpec(); - $o_593->name = 'loop'; - $o_593->value = ''; - $o_588->attrs[] = $o_593; - $o_594 = new AttrSpec(); - $o_594->name = 'muted'; - $o_594->value = ''; - $o_588->attrs[] = $o_594; - $o_595 = new AttrSpec(); - $o_595->name = 'placeholder'; - $o_588->attrs[] = $o_595; + $o_592->name = 'src'; + $o_592->mandatory = true; + $o_593 = new UrlSpec(); + $o_593->allowed_protocol = ['https']; + $o_593->allow_relative = true; + $o_592->value_url = $o_593; + $o_591->attrs[] = $o_592; + $o_591->attr_lists = ['extended-amp-global']; + $o_591->spec_url = 'https://www.ampproject.org/docs/reference/amp-pixel.html'; + $o_594 = new AmpLayout(); + $o_594->supported_layouts = [AmpLayoutLayout::FIXED, AmpLayoutLayout::NODISPLAY]; + $o_594->defines_default_width = true; + $o_594->defines_default_height = true; + $o_591->amp_layout = $o_594; + $o_591->disallowed_ancestor = ['amp-sidebar']; + $o_0->tags[] = $o_591; + $o_595 = new TagSpec(); + $o_595->tag_name = 'amp-video'; $o_596 = new AttrSpec(); - $o_596->name = 'poster'; - $o_588->attrs[] = $o_596; + $o_596->name = 'alt'; + $o_595->attrs[] = $o_596; $o_597 = new AttrSpec(); - $o_597->name = 'preload'; - $o_597->value_regex = '(none|metadata|auto|)'; - $o_588->attrs[] = $o_597; + $o_597->name = 'attribution'; + $o_595->attrs[] = $o_597; $o_598 = new AttrSpec(); - $o_598->name = 'src'; - $o_599 = new UrlSpec(); - $o_599->allowed_protocol = ['https']; - $o_599->allow_relative = true; - $o_598->value_url = $o_599; - $o_588->attrs[] = $o_598; - $o_588->attr_lists = ['extended-amp-global']; - $o_588->spec_url = 'https://www.ampproject.org/docs/reference/amp-video.html'; - $o_600 = new AmpLayout(); - $o_600->supported_layouts = [AmpLayoutLayout::FILL, AmpLayoutLayout::FIXED, AmpLayoutLayout::FIXED_HEIGHT, AmpLayoutLayout::FLEX_ITEM, AmpLayoutLayout::NODISPLAY, AmpLayoutLayout::RESPONSIVE]; - $o_588->amp_layout = $o_600; - $o_588->disallowed_ancestor = ['amp-sidebar']; - $o_0->tags[] = $o_588; - $o_601 = new TagSpec(); - $o_601->tag_name = 'script'; - $o_601->spec_name = 'amp-access extension .js script'; - $o_601->mandatory_parent = 'head'; + $o_598->name = 'autoplay'; + $o_598->value = ''; + $o_595->attrs[] = $o_598; + $o_599 = new AttrSpec(); + $o_599->name = 'controls'; + $o_599->value = ''; + $o_595->attrs[] = $o_599; + $o_600 = new AttrSpec(); + $o_600->name = 'loop'; + $o_600->value = ''; + $o_595->attrs[] = $o_600; + $o_601 = new AttrSpec(); + $o_601->name = 'muted'; + $o_601->value = ''; + $o_595->attrs[] = $o_601; $o_602 = new AttrSpec(); - $o_602->name = 'async'; - $o_602->mandatory = true; - $o_602->value = ''; - $o_601->attrs[] = $o_602; + $o_602->name = 'placeholder'; + $o_595->attrs[] = $o_602; $o_603 = new AttrSpec(); - $o_603->name = 'custom-element'; - $o_603->mandatory = true; - $o_603->value = 'amp-access'; - $o_603->dispatch_key = true; - $o_601->attrs[] = $o_603; + $o_603->name = 'poster'; + $o_595->attrs[] = $o_603; $o_604 = new AttrSpec(); - $o_604->name = 'src'; - $o_604->mandatory = true; - $o_604->value_regex = 'https://cdn\\.ampproject\\.org/v0/amp-access-(latest|0\\.1).js'; - $o_601->attrs[] = $o_604; + $o_604->name = 'preload'; + $o_604->value_regex = '(none|metadata|auto|)'; + $o_595->attrs[] = $o_604; $o_605 = new AttrSpec(); - $o_605->name = 'type'; - $o_605->value = 'text/javascript'; - $o_601->attrs[] = $o_605; - $o_601->spec_url = 'https://www.ampproject.org/docs/reference/extended/amp-access.html'; - $o_606 = new CdataSpec(); - $o_607 = new BlackListedCDataRegex(); - $o_607->regex = '.'; - $o_607->error_message = 'contents'; - $o_606->blacklisted_cdata_regex[] = $o_607; - $o_601->cdata = $o_606; - $o_0->tags[] = $o_601; + $o_605->name = 'src'; + $o_606 = new UrlSpec(); + $o_606->allowed_protocol = ['https']; + $o_606->allow_relative = true; + $o_605->value_url = $o_606; + $o_595->attrs[] = $o_605; + $o_595->attr_lists = ['extended-amp-global']; + $o_595->spec_url = 'https://www.ampproject.org/docs/reference/amp-video.html'; + $o_607 = new AmpLayout(); + $o_607->supported_layouts = [AmpLayoutLayout::FILL, AmpLayoutLayout::FIXED, AmpLayoutLayout::FIXED_HEIGHT, AmpLayoutLayout::FLEX_ITEM, AmpLayoutLayout::NODISPLAY, AmpLayoutLayout::RESPONSIVE]; + $o_595->amp_layout = $o_607; + $o_595->disallowed_ancestor = ['amp-sidebar']; + $o_0->tags[] = $o_595; $o_608 = new TagSpec(); $o_608->tag_name = 'script'; - $o_608->spec_name = 'amp-access extension .json script'; + $o_608->spec_name = 'amp-access extension .js script'; $o_608->mandatory_parent = 'head'; $o_609 = new AttrSpec(); - $o_609->name = 'id'; + $o_609->name = 'async'; $o_609->mandatory = true; - $o_609->value = 'amp-access'; - $o_609->dispatch_key = true; + $o_609->value = ''; $o_608->attrs[] = $o_609; $o_610 = new AttrSpec(); - $o_610->name = 'type'; + $o_610->name = 'custom-element'; $o_610->mandatory = true; - $o_610->value = 'application/json'; + $o_610->value = 'amp-access'; + $o_610->dispatch_key = true; $o_608->attrs[] = $o_610; - $o_608->spec_url = 'https://www.ampproject.org/docs/reference/extended/amp-access-spec.html'; - $o_611 = new CdataSpec(); - $o_612 = new BlackListedCDataRegex(); - $o_612->regex = ' From ab6eea9ef4e0dbd506d942c97cb8549167e95514 Mon Sep 17 00:00:00 2001 From: FuzzyTree Date: Sun, 25 Sep 2016 01:27:35 -0700 Subject: [PATCH 03/16] Add support for additional Facebook embed url schemas --- src/Pass/BaseFacebookPass.php | 49 +++++++++++++++++++ src/Pass/FacebookNonIframeTransformPass.php | 9 ++-- src/Pass/IframeFacebookTagTransformPass.php | 9 ++-- .../facebook-iframe-fragment.html | 4 ++ .../facebook-iframe-fragment.html.out | 11 ++++- .../facebook-non-iframe-fragment.html | 18 +++++++ .../facebook-non-iframe-fragment.html.out | 42 +++++++++++++--- 7 files changed, 124 insertions(+), 18 deletions(-) create mode 100644 src/Pass/BaseFacebookPass.php diff --git a/src/Pass/BaseFacebookPass.php b/src/Pass/BaseFacebookPass.php new file mode 100644 index 00000000..0947d95f --- /dev/null +++ b/src/Pass/BaseFacebookPass.php @@ -0,0 +1,49 @@ +isValidVideoUrl($src)) { // A facebook video can be embedded as a post. Doing that enables the video "card" to display if ($el->attr('data-show-text') !== "false") { $embed_as = 'post'; @@ -118,8 +117,8 @@ protected function getFacebookEmbedAttrs(DOMQuery $el) } else { $embed_as = 'video'; } - } // e.g. https://www.facebook.com/20531316728/posts/10154009990506729/ - else if (preg_match('&(*UTF8)facebook\.com/.*/posts/\d+/?&i', $src)) { + } + elseif ($this->isValidPostUrl($src)) { $embed_as = 'post'; } else { return false; diff --git a/src/Pass/IframeFacebookTagTransformPass.php b/src/Pass/IframeFacebookTagTransformPass.php index 281aa377..f3883247 100644 --- a/src/Pass/IframeFacebookTagTransformPass.php +++ b/src/Pass/IframeFacebookTagTransformPass.php @@ -54,7 +54,7 @@ * @see https://github.com/ampproject/amphtml/blob/master/extensions/amp-facebook/amp-facebook.md * @see https://github.com/ampproject/amphtml/blob/master/extensions/amp-facebook/0.1/validator-amp-facebook.protoascii */ -class IframeFacebookTagTransformPass extends BasePass +class IframeFacebookTagTransformPass extends BaseFacebookPass { const DEFAULT_ASPECT_RATIO = 1.7778; const DEFAULT_WIDTH = 500; @@ -108,16 +108,15 @@ protected function setStandardFacebookParameters(DOMQuery $el) return false; } - // e.g https://www.facebook.com/facebook/videos/10153231379946729/ - if (preg_match('&(*UTF8)facebook\.com/facebook/videos/\d+/?&i', $query_arr['href'])) { + if ($this->isValidVideoUrl($query_arr['href'])) { // A facebook video can be embedded as a post. Doing that enables the video "card" to display if (isset($query_arr['show_text']) && $query_arr['show_text'] !== "false") { $embed_as = 'post'; } else { $embed_as = 'video'; } - } // e.g. https://www.facebook.com/20531316728/posts/10154009990506729/ - else if (preg_match('&(*UTF8)facebook\.com/.*/posts/\d+/?&i', $query_arr['href'])) { + } + elseif ($this->isValidPostUrl($query_arr['href'])) { $embed_as = 'post'; } else { return false; diff --git a/tests/test-data/fragment-html/facebook-iframe-fragment.html b/tests/test-data/fragment-html/facebook-iframe-fragment.html index b791dd49..0278e42b 100644 --- a/tests/test-data/fragment-html/facebook-iframe-fragment.html +++ b/tests/test-data/fragment-html/facebook-iframe-fragment.html @@ -13,3 +13,7 @@ width="500" height="290" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true"> + + diff --git a/tests/test-data/fragment-html/facebook-iframe-fragment.html.out b/tests/test-data/fragment-html/facebook-iframe-fragment.html.out index 0806b80e..c896abd2 100644 --- a/tests/test-data/fragment-html/facebook-iframe-fragment.html.out +++ b/tests/test-data/fragment-html/facebook-iframe-fragment.html.out @@ -7,6 +7,8 @@ + + ORIGINAL HTML @@ -26,7 +28,11 @@ Line 12: Line 15: -Line 16: +Line 16: +Line 17: +Line 20: Transformations made from HTML tags to AMP custom tags @@ -41,6 +47,9 @@ Transformations made from HTML tags to AMP custom tags \ No newline at end of file diff --git a/tests/test-data/fragment-html/youtube-02-fragment.html.out b/tests/test-data/fragment-html/youtube-02-fragment.html.out new file mode 100644 index 00000000..3a7c33ac --- /dev/null +++ b/tests/test-data/fragment-html/youtube-02-fragment.html.out @@ -0,0 +1,25 @@ + + +ORIGINAL HTML +--------------- +Line 1: + + +Transformations made from HTML tags to AMP custom tags +------------------------------------------------------- + + diff --git a/tests/test-data/fragment-html/youtube-bad-fragment.html.out b/tests/test-data/fragment-html/youtube-bad-fragment.html.out new file mode 100644 index 00000000..4bd97cc4 --- /dev/null +++ b/tests/test-data/fragment-html/youtube-bad-fragment.html.out @@ -0,0 +1,27 @@ + + + +ORIGINAL HTML +--------------- +Line 1: +Line 5: + + +Transformations made from HTML tags to AMP custom tags +------------------------------------------------------- + + \ No newline at end of file + + + + + + + + + + + + + diff --git a/tests/test-data/fragment-html/youtube-fragment.html.out b/tests/test-data/fragment-html/youtube-fragment.html.out index d711b65a..21365f43 100644 --- a/tests/test-data/fragment-html/youtube-fragment.html.out +++ b/tests/test-data/fragment-html/youtube-fragment.html.out @@ -1,11 +1,55 @@ + + + + + + + + + + + + + ORIGINAL HTML --------------- -Line 1: +Line 1: +Line 5: +Line 6: +Line 10: +Line 11: +Line 15: +Line 16: +Line 20: +Line 21: +Line 25: +Line 26: +Line 30: +Line 31: +Line 35: Transformations made from HTML tags to AMP custom tags @@ -14,6 +58,24 @@ Transformations made from HTML tags to AMP custom tags