diff options
author | Technosophos <[email protected]> | 2013-04-10 15:42:49 -0500 |
---|---|---|
committer | Technosophos <[email protected]> | 2013-04-10 15:42:49 -0500 |
commit | ab9d8dbaf0469a1ab419f283e1e1e21fec1c1b74 (patch) | |
tree | c3a6c7d9e0b4eaed6c67c862323b20d256da4f13 /bin/entities.php | |
parent | a9dc2ac5aafbab2025f5aef6a1427f813e20fbac (diff) |
Entity reference generator.
Diffstat (limited to 'bin/entities.php')
-rw-r--r-- | bin/entities.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/bin/entities.php b/bin/entities.php new file mode 100644 index 0000000..ee8b7b6 --- /dev/null +++ b/bin/entities.php @@ -0,0 +1,22 @@ +<?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 +$entities = '; +var_export($table); +print ';'; +//print serialize($table); |