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