2012-04-20 03:10:25 +00:00
|
|
|
var String = function() {
|
|
|
|
var properEscape = function(str) {
|
|
|
|
str.replace('"', """);
|
|
|
|
str.replace("&", "&");
|
|
|
|
str.replace("'", "'");
|
|
|
|
str.replace("<", "<");
|
|
|
|
str.replace(">", ">");
|
|
|
|
return str;
|
|
|
|
};
|
|
|
|
|
|
|
|
var toText = function(elmList) {
|
2012-05-22 22:07:21 +00:00
|
|
|
if (typeof elmList === "string") return elmList;
|
2012-04-20 03:10:25 +00:00
|
|
|
var a = [];
|
|
|
|
while (elmList[0] === "Cons") {
|
|
|
|
a.push(elmList[1]);
|
|
|
|
elmList = elmList[2];
|
|
|
|
}
|
|
|
|
return String.properEscape(a.join(''));
|
|
|
|
};
|
|
|
|
|
|
|
|
return {toText : toText,
|
|
|
|
properEscape : properEscape };
|
|
|
|
}();
|