Giter VIP home page Giter VIP logo

Comments (1)

sidkshatriya avatar sidkshatriya commented on August 23, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.