1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-30 14:55:45 +01:00

More stuff.

This commit is contained in:
Kris Maglione
2011-07-26 21:25:37 -04:00
parent cff57155e6
commit 969cdfc5dc
4 changed files with 11 additions and 11 deletions

View File

@@ -1080,9 +1080,11 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
* @returns {string} The DTD fragment containing entity declaration
* for *obj*.
*/
makeDTD: function makeDTD(obj) iter(obj)
.map(function ([k, v]) ["<!ENTITY ", k, " '", String.replace(v == null ? "null" : v, /['%]/g,
function (m) ({ "'": "&apos;", "%": "&#x25;" })[m]),
makeDTD: let (map = { "'": "&apos;", '"': "&quot;", "%": "&#x25;", "&": "&amp;", "<": "&lt;", ">": "&gt;" })
function makeDTD(obj) iter(obj)
.map(function ([k, v]) ["<!ENTITY ", k, " '", String.replace(v == null ? "null" : typeof v == "xml" ? v.toXMLString() : v,
typeof v == "xml" ? /['%]/g : /['"%&<>]/g,
function (m) map[m]),
"'>"].join(""))
.join("\n"),