diff vendor/masterminds/html5/bin/entities.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children 129ea1e6d783
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/masterminds/html5/bin/entities.php	Wed Nov 29 16:09:58 2017 +0000
@@ -0,0 +1,26 @@
+<?php
+/**
+ * Fetch the entities.json file and convert to PHP datastructure.
+ */
+
+// The URL to the official entities JSON file.
+$ENTITIES_URL = 'http://www.w3.org/TR/2012/CR-html5-20121217/entities.json';
+
+$payload = file_get_contents($ENTITIES_URL);
+$json = json_decode($payload);
+
+$table = array();
+foreach ($json as $name => $obj) {
+  $sname = substr($name, 1, -1);
+  $table[$sname] = $obj->characters;
+}
+
+print '<?php
+namespace Masterminds\\HTML5;
+/** Entity lookup tables. This class is automatically generated. */
+class Entities {
+  public static $byName = ';
+var_export($table);
+print ';
+}' . PHP_EOL;
+//print serialize($table);