summaryrefslogtreecommitdiff
path: root/plugins/af_readability/vendor/masterminds/html5/example.php
blob: e4e1f22f99d13418872d8b62dd5571be4b496252 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php

require 'vendor/autoload.php';
use Masterminds\HTML5;

$html = <<< 'HERE'
  <html>
  <head>
  <title>TEST</title>
  <script language="javascript">
  if (2 > 1) { alert("Math wins."); }
  </script>
  </head>
  <body id='foo'>
  <!-- This space intentionally left blank. -->
  <section class="section-a pretty" id="bar1">
  <h1>Hello World</h1><p>This is a test of the HTML5 parser.</p>
  <hr>
  &amp; Nobody nowhere.
  </section>
  <test xmlns:foo="http://example.com/foo">TEST</test>
  <![CDATA[Because we can.]]>
  &copy;
  </body></html>
HERE;

$html5 = new HTML5();
$dom = $html5->loadHTML($html);

echo "Converting to HTML 5\n";

$html5->save($dom, fopen('php://stdin', 'w'));