summaryrefslogtreecommitdiff
path: root/vendor/masterminds/html5/bin/entities.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2022-12-13 20:00:46 +0300
committerAndrew Dolgov <[email protected]>2022-12-13 20:00:46 +0300
commit0226e0ca0dc70f9a0310b3eef045ee1c1e0ca3ac (patch)
tree254c0e880693c2636107308b5931951cfa501311 /vendor/masterminds/html5/bin/entities.php
split into a separate repo
Diffstat (limited to 'vendor/masterminds/html5/bin/entities.php')
-rw-r--r--vendor/masterminds/html5/bin/entities.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/vendor/masterminds/html5/bin/entities.php b/vendor/masterminds/html5/bin/entities.php
new file mode 100644
index 0000000..56323a3
--- /dev/null
+++ b/vendor/masterminds/html5/bin/entities.php
@@ -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;
+}
+
+echo '<?php
+namespace Masterminds\\HTML5;
+/** Entity lookup tables. This class is automatically generated. */
+class Entities {
+ public static $byName = ';
+var_export($table);
+echo ';
+}' . PHP_EOL;
+//print serialize($table);