Mercurial > hg > isophonics-drupal-site
annotate vendor/masterminds/html5/example.php @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | 129ea1e6d783 |
children |
rev | line source |
---|---|
Chris@0 | 1 <?php |
Chris@0 | 2 |
Chris@17 | 3 require 'vendor/autoload.php'; |
Chris@0 | 4 use Masterminds\HTML5; |
Chris@0 | 5 |
Chris@0 | 6 $html = <<< 'HERE' |
Chris@0 | 7 <html> |
Chris@0 | 8 <head> |
Chris@0 | 9 <title>TEST</title> |
Chris@0 | 10 <script language="javascript"> |
Chris@0 | 11 if (2 > 1) { alert("Math wins."); } |
Chris@0 | 12 </script> |
Chris@0 | 13 </head> |
Chris@0 | 14 <body id='foo'> |
Chris@0 | 15 <!-- This space intentionally left blank. --> |
Chris@0 | 16 <section class="section-a pretty" id="bar1"> |
Chris@0 | 17 <h1>Hello World</h1><p>This is a test of the HTML5 parser.</p> |
Chris@0 | 18 <hr> |
Chris@0 | 19 & Nobody nowhere. |
Chris@0 | 20 </section> |
Chris@0 | 21 <test xmlns:foo="http://example.com/foo">TEST</test> |
Chris@0 | 22 <![CDATA[Because we can.]]> |
Chris@0 | 23 © |
Chris@0 | 24 </body></html> |
Chris@0 | 25 HERE; |
Chris@0 | 26 |
Chris@0 | 27 $html5 = new HTML5(); |
Chris@0 | 28 $dom = $html5->loadHTML($html); |
Chris@0 | 29 |
Chris@17 | 30 echo "Converting to HTML 5\n"; |
Chris@0 | 31 |
Chris@17 | 32 $html5->save($dom, fopen('php://stdin', 'w')); |