diff --git a/content/options.js b/content/options.js
index 5fda9478..149bb93a 100644
--- a/content/options.js
+++ b/content/options.js
@@ -289,16 +289,13 @@ liberator.Options = function () //{{{
{
if (!args)
{
+ XML.prettyPrinting = false;
var str = <>>;
for (let [i, value] in Iterator(liberator.globalVariables))
{
- if (typeof value == "number")
- var prefix = "#";
- else if (typeof value == "function")
- var prefix = "*";
- else
- var prefix = "";
-
+ let prefix = typeof value == "number" ? "#" :
+ typeof value == "function" ? "*" :
+ " ";
str +=
{i} {prefix}{value} ;
}
if (str.length())
@@ -362,12 +359,9 @@ liberator.Options = function () //{{{
}
var value = reference[0][reference[1]];
- if (typeof value == "number")
- var prefix = "#";
- else if (typeof value == "function")
- var prefix = "*";
- else
- var prefix = "";
+ let prefix = typeof value == "number" ? "#" :
+ typeof value == "function" ? "*" :
+ " ";
liberator.echo(reference[1] + "\t\t" + prefix + value);
}
});
diff --git a/content/tabs.js b/content/tabs.js
index 0e1fab7e..52b4ec06 100644
--- a/content/tabs.js
+++ b/content/tabs.js
@@ -710,11 +710,10 @@ liberator.Tabs = function () //{{{
list: function ()
{
// TODO: move this to liberator.tabs.get()
- var items = liberator.completion.buffer("")[1];
- var number, indicator, title, url;
- var list = ":" + (liberator.util.escapeHTML(liberator.commandline.getCommand()) || "buffers") + " " + "";
- for (let i = 0; i < items.length; i++)
+ XML.prettyPrinting = false;
+ let items = <>>;
+ for (let [i, item] in Iterator(liberator.completion.buffer("")[1]))
{
if (i == liberator.tabs.index())
indicator = " % ";
@@ -723,17 +722,17 @@ liberator.Tabs = function () //{{{
else
indicator = " ";
- [number, title] = items[i][0].split(/:\s+/, 2);
- url = items[i][1];
- url = liberator.util.escapeHTML(url);
- title = liberator.util.escapeHTML(title);
-
- list += " " + number + " " + indicator +
- " " + title +
- " " + url + " ";
+ let [number, title] = items[i][0].split(/:\s+/, 2);
+ items +=
+
+ {number}
+ {indicator}
+ {title}
+ {item[1]}
+ ;
}
- list += "
";
+ let list = liberator.buffer.template.generic();
liberator.commandline.echo(list, liberator.commandline.HL_NORMAL, liberator.commandline.FORCE_MULTILINE);
},
diff --git a/content/ui.js b/content/ui.js
index 5d381021..ba9d254e 100644
--- a/content/ui.js
+++ b/content/ui.js
@@ -1256,7 +1256,11 @@ liberator.ItemList = function (id) //{{{
var row = doc.createElement("tr");
row.setAttribute("class", "liberator-compitem");
var icon = doc.createElement("td");
- icon.innerHTML = '' + b + ' ' + c + ' ';
+ XML.prettyPrinting = false;
+ icon.innerHTML = <>
+
+ {b}{c} ;
+ >;
row.appendChild(icon);
return row;
diff --git a/content/util.js b/content/util.js
index 2ed7f54a..c26d7f73 100644
--- a/content/util.js
+++ b/content/util.js
@@ -67,13 +67,13 @@ liberator.util = { //{{{
// for java packages value.toString() would crash so badly
// that we cannot even try/catch it
if (/^\[JavaPackage.*\]$/.test(arg))
- return "[JavaPackage]";
+ return <>[JavaPackage]>;
var str = arg.toString();
if (typeof str == "string") // can be "undefined"
return <>{str}>;
else
- return "undefined";
+ return <>undefined>;
}
}
catch (e)
@@ -201,6 +201,13 @@ liberator.util = { //{{{
// if color = true it uses HTML markup to color certain items
objectToString: function (object, color)
{
+ /* Use E4X literals so html is automatically quoted
+ * only when it's asked for. Noone wants to see <
+ * on their console or :map :foo in their buffer
+ * when they expect :map :foo.
+ */
+ XML.prettyPrinting = false;
+
if (object === null)
return "null";
@@ -215,13 +222,12 @@ liberator.util = { //{{{
}
catch (e)
{
- obj = "<Object>";
+ obj = "";
}
if (color)
- string += "" + obj + " ::\n";
- else
- string += obj + "::\n";
+ obj = {obj} .toXMLString();
+ string += obj + "::\n";
try // window.content often does not want to be queried with "var i in object"
{
@@ -234,16 +240,14 @@ liberator.util = { //{{{
}
catch (e)
{
- value = "<no value>";
+ value = "";
}
- if (color)
- {
- value = this.colorize(value, true);
- string += "" + i + " : " + value + "\n";
+ if (color) {
+ value = this.colorize(value, true).toXMLString();
+ i = {i} .toXMLString();
}
- else
- string += i + ": " + value + "\n";
+ string += i + ": " + value + "\n";
}
}
catch (e) {}