Comments (1)
The code refactoring has been done and issues with diff output have been fixed.
Here is an example of diff output before.
$ ./amp-console amp:convert sample-html/several_errors.html --full-document --diff --no-orig-and-warn
--- Original
+++ New
@@ @@
This example has several problems - see the .out file.
---><html><head><meta charset="pick-a-key"><link rel="canonical" href="./regular-html-version.html"><style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript><script type="javascript">
- // Let's go crazy. Uhm, no, hahaha.
- </script></head><body>
- <table><tr><td>Tables are allowed</td></tr></table><amp-img src="dimensions_are_missing.jpg" layout="fixed"></amp-img><!-- We don't allow percent as a size unit either. --><amp-ad width="100%" height="300"><!-- <script>document.write(�)</script> --></amp-ad><amp-ad width="42" height="42" made_up_attribute="oh hi"></amp-ad></body></html>
+--><html amp><head>
+ <meta>
+ <link rel="canonical" href="./regular-html-version.html">
+ <style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
+
+</head>
+<body>
+ <table><tr><td>Tables are allowed</td></tr></table>
+ <amp-img src="dimensions_are_missing.jpg" layout="fixed"></amp-img>
+ <!-- We don't allow percent as a size unit either. -->
+ <amp-ad width="100%" height="300">
+ <!-- <script>document.write(…)</script> -->
+ </amp-ad>
+ <amp-ad width="42" height="42"></amp-ad>
+</body>
+
+</html>
This is the diff output now. Notice how streamlined and useful it is. The previous output was quite useless due to formatting issues (which increased the diff shown when the "actual" diff was much less)
$ ./amp-console amp:convert sample-html/several_errors.html --full-document --diff --no-orig-and-warn
--- Original
+++ New
@@ @@
This example has several problems - see the .out file.
---><html><head>
- <meta charset="pick-a-key">
+--><html amp><head>
+ <meta>
<link rel="canonical" href="./regular-html-version.html">
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
- <script type="javascript">
- // Let's go crazy. Uhm, no, hahaha.
- </script>
+
@@ @@
</amp-ad>
- <amp-ad width="42" height="42" made_up_attribute="oh hi"></amp-ad>
+ <amp-ad width="42" height="42"></amp-ad>
</body>
</html>
Code was merged to master. Closing.
from amp-library.
Related Issues (20)
- TwitterTransformPass | Invalid HTML cause fatal error HOT 2
- is this repo dead? HOT 2
- inline style removed from div block HOT 3
- Not Work Tag <picture> HOT 1
- Error "The script tag for amp-user-notification is likely included twice in the page". Circular dependency in validator-generated.php
- Support for new masterminds/html5 v2.7.0
- Inline css for table is removed
- support of PHP 7.4
- Convert from Instagram TV post HOT 1
- DISALLOWED_TAG on amp-google-document-embed HOT 2
- Signed exchange issues
- Laravel 8 support
- Set data-locale for FacebookNonIframeTransformPass
- Local image URL detection loses query arguments
- <amp-accordion> should allow expand-single-section attribute.
- After converting to amp html, amp-script component is discarded from the template
- Not working with php8.1.5 HOT 2
- Rename `master` branch to `main`
- Deprecated: Using ${var} in strings is deprecated, use {$var} instead with PHP 8.2
- Update querypath library
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amp-library.