" ].join(""), d = void 0, p = void 0, f = void 0, h = void 0, g = void 0, m = void 0, v = void 0, b = function() {
- var n = t.chain(s).sortBy(g).reduce(function(e, n) {
+ var u = [ '
' ].join(""), b = !1, y = void 0, w = void 0, x = [], k = [], C = void 0, S = void 0, T = void 0, E = void 0, _ = void 0, I = void 0, P = function() {
+ var h = [ '', '', '', '', '
Shows notification messages in the bottom-right corner of the\n screen.
\n
\n
\n \n
\n ms\n
\n
\n
';
}), define("extensions/notifications", [ "jquery", "underscore", "utils", "classes/Extension", "jgrowl", "text!html/notificationsSettingsBlock.html" ], function(e, t, n, i, o, r) {
- function s() {
+ function a() {
c === !1 && (o.defaults.life = l.config.timeout, o.defaults.closer = !1, o.defaults.closeTemplate = "",
o.defaults.position = "bottom-right", c = !0);
}
- function a(e, n, i) {
- if (logger.info(e), s(), e) {
+ function s(e, n, i) {
+ if (logger.info(e), a(), e) {
var r = e.indexOf("|");
(-1 === r || (e = e.substring(0, r))) && (i = i || {}, n = n || "icon-info-circled",
o(" " + t.escape(e), i));
@@ -5775,31 +5847,31 @@ define("config", function() {}), define("settings", [ "underscore", "config" ],
};
var c = !1;
return l.onMessage = function(e) {
- a(e);
+ s(e);
}, l.onError = function(e) {
- logger.error(e), t.isString(e) ? a(e, "icon-attention") : t.isObject(e) && a(e.message, "icon-attention");
+ logger.error(e), t.isString(e) ? s(e, "icon-attention") : t.isObject(e) && s(e.message, "icon-attention");
}, l.onOfflineChanged = function(t) {
- t === !0 ? a("You are offline.", "icon-attention-circled msg-offline", {
+ t === !0 ? s("You are offline.", "icon-attention-circled msg-offline", {
sticky: !0,
close: function() {
- a("You are back online!", "icon-signal");
+ s("You are back online!", "icon-signal");
}
}) : e(".msg-offline").parents(".jGrowl-notification").trigger("jGrowl.beforeClose");
}, l.onSyncImportSuccess = function(e, n) {
var i = t.map(e, function(e) {
return e.title;
}).join(", ");
- a(i + " imported successfully from " + n.providerName + ".");
+ s(i + " imported successfully from " + n.providerName + ".");
}, l.onSyncExportSuccess = function(e, t) {
- a('"' + e.title + '" will now be synchronized on ' + t.provider.providerName + ".");
+ s('"' + e.title + '" will now be synchronized on ' + t.provider.providerName + ".");
}, l.onSyncRemoved = function(e, t) {
- a(t.provider.providerName + " synchronized location has been removed.");
+ s(t.provider.providerName + " synchronized location has been removed.");
}, l.onPublishSuccess = function(e) {
- a('"' + e.title + '" successfully published.');
+ s('"' + e.title + '" successfully published.');
}, l.onNewPublishSuccess = function(e, t) {
- a('"' + e.title + '" is now published on ' + t.provider.providerName + ".");
+ s('"' + e.title + '" is now published on ' + t.provider.providerName + ".");
}, l.onPublishRemoved = function(e, t) {
- a(t.provider.providerName + " publish location has been removed.");
+ s(t.provider.providerName + " publish location has been removed.");
}, l;
}), define("text!html/markdownExtraSettingsBlock.html", [], function() {
return '
Adds extra features to the original Markdown syntax.
\n
\n
\n \n
\n
\n \n
\n
\n
\n
\n \n
\n
\n \n
\n
\n
\n
\n \n
\n
\n \n
\n
\n
\n
\n \n
\n
\n \n
\n
\n
\n
\n \n
\n
\n \n
\n
\n
\n
\n \n
\n \n
\n
\n
\nMore info';
@@ -5846,7 +5918,7 @@ function() {
}, Markdown.Converter = function() {
function e(e) {
return e = e.replace(/^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*(\S+?)>?(?=\s|$)[ \t]*\n?[ \t]*((\n*)["(](.+?)[")][ \t]*)?(?:\n+)/gm, function(e, t, n, i, o, r) {
- return t = t.toLowerCase(), A.set(t, C(n)), o ? i : (r && M.set(t, r.replace(/"/g, """)),
+ return t = t.toLowerCase(), $.set(t, k(n)), o ? i : (r && z.set(t, r.replace(/"/g, """)),
"");
});
}
@@ -5858,25 +5930,25 @@ function() {
}
function o(e, t) {
var n = t;
- return n = n.replace(/^\n+/, ""), n = n.replace(/\n+$/g, ""), n = "\n\n~K" + (z.push(n) - 1) + "K\n\n";
+ return n = n.replace(/^\n+/, ""), n = n.replace(/\n+$/g, ""), n = "\n\n~K" + (R.push(n) - 1) + "K\n\n";
}
function r(e, n) {
- e = R.preBlockGamut(e, O), e = f(e);
+ e = L.preBlockGamut(e, D), e = f(e);
var i = "\n";
return e = e.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm, i), e = e.replace(/^[ ]{0,2}([ ]?-[ ]?){3,}[ \t]*$/gm, i),
- e = e.replace(/^[ ]{0,2}([ ]?_[ ]?){3,}[ \t]*$/gm, i), e = h(e), e = m(e), e = x(e),
- e = R.postBlockGamut(e, O), e = t(e), e = k(e, n);
- }
- function s(e) {
- return e = R.preSpanGamut(e), e = b(e), e = a(e), e = S(e), e = u(e), e = l(e),
- e = E(e), e = e.replace(/~P/g, "://"), e = C(e), e = w(e), e = e.replace(/ +\n/g, " \n"),
- e = R.postSpanGamut(e);
+ e = e.replace(/^[ ]{0,2}([ ]?_[ ]?){3,}[ \t]*$/gm, i), e = h(e), e = g(e), e = w(e),
+ e = L.postBlockGamut(e, D), e = t(e), e = C(e, n);
}
function a(e) {
+ return e = L.preSpanGamut(e), e = b(e), e = s(e), e = S(e), e = u(e), e = l(e),
+ e = T(e), e = e.replace(/~P/g, "://"), e = k(e), e = x(e), e = e.replace(/ +\n/g, " \n"),
+ e = L.postSpanGamut(e);
+ }
+ function s(e) {
var t = /(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|-]|-[^>])(?:[^-]|-[^-])*)--)>)/gi;
return e = e.replace(t, function(e) {
var t = e.replace(/(.)<\/?code>(?=.)/g, "$1`");
- return t = N(t, "!" == e.charAt(1) ? "\\`*_/" : "\\`*_");
+ return t = A(t, "!" == e.charAt(1) ? "\\`*_/" : "\\`*_");
});
}
function l(e) {
@@ -5884,17 +5956,17 @@ function() {
e = e.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()((?:\([^)]*\)|[^()\s])*?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g, c),
e = e.replace(/(\[([^\[\]]+)\])()()()()()/g, c);
}
- function c(e, t, n, i, o, r, s, a) {
- void 0 == a && (a = "");
- var l = t, c = n.replace(/:\/\//g, "~P"), u = i.toLowerCase(), p = o, f = a;
+ function c(e, t, n, i, o, r, a, s) {
+ void 0 == s && (s = "");
+ var l = t, c = n.replace(/:\/\//g, "~P"), u = i.toLowerCase(), p = o, f = s;
if ("" == p) if ("" == u && (u = c.toLowerCase().replace(/ ?\n/g, " ")), p = "#" + u,
- void 0 != A.get(u)) p = A.get(u), void 0 != M.get(u) && (f = M.get(u)); else {
+ void 0 != $.get(u)) p = $.get(u), void 0 != z.get(u) && (f = z.get(u)); else {
if (!(l.search(/\(\s*\)$/m) > -1)) return l;
p = "";
}
- p = $(p), p = N(p, "*_");
+ p = P(p), p = A(p, "*_");
var h = '" + c + "";
+ return "" != f && (f = d(f), f = A(f, "*_"), h += ' title="' + f + '"'), h += ">" + c + "";
}
function u(e) {
return e = e.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g, p), e = e.replace(/(!\[(.*?)\]\s?\([ \t]*()(\S+?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g, p);
@@ -5902,56 +5974,56 @@ function() {
function d(e) {
return e.replace(/>/g, ">").replace(/";
+ return f = d(f), f = A(f, "*_"), h += ' title="' + f + '"', h += " />";
}
function f(e) {
return e = e.replace(/^(.+)[ \t]*\n=+[ \t]*\n+/gm, function(e, t) {
- return '
\n\n";
}), e = e.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm, function(e, t, n) {
var i = t.length;
- return "' + s(n) + "\n\n";
+ return "' + a(n) + "\n\n";
});
}
function h(e, t) {
e += "~0";
var n = /^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;
- return D ? e = e.replace(n, function(e, n, i) {
- var o = n, r = i.search(/[*+-]/g) > -1 ? "ul" : "ol", s = g(o, r, t);
- return s = s.replace(/\s+$/, ""), s = "<" + r + ">" + s + "" + r + ">\n";
+ return j ? e = e.replace(n, function(e, n, i) {
+ var o = n, r = i.search(/[*+-]/g) > -1 ? "ul" : "ol", a = m(o, r, t);
+ return a = a.replace(/\s+$/, ""), a = "<" + r + ">" + a + "" + r + ">\n";
}) : (n = /(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/g,
e = e.replace(n, function(e, t, n, i) {
- var o = t, r = n, s = i.search(/[*+-]/g) > -1 ? "ul" : "ol", a = g(r, s);
- return a = o + "<" + s + ">\n" + a + "" + s + ">\n";
+ var o = t, r = n, a = i.search(/[*+-]/g) > -1 ? "ul" : "ol", s = m(r, a);
+ return s = o + "<" + a + ">\n" + s + "" + a + ">\n";
})), e = e.replace(/~0/, "");
}
- function g(e, t, n) {
- D++, e = e.replace(/\n{2,}$/, "\n"), e += "~0";
- var i = j[t], o = new RegExp("(^[ \\t]*)(" + i + ")[ \\t]+([^\\r]+?(\\n+))(?=(~0|\\1(" + i + ")[ \\t]+))", "gm"), a = !1;
+ function m(e, t, n) {
+ j++, e = e.replace(/\n{2,}$/, "\n"), e += "~0";
+ var i = O[t], o = new RegExp("(^[ \\t]*)(" + i + ")[ \\t]+([^\\r]+?(\\n+))(?=(~0|\\1(" + i + ")[ \\t]+))", "gm"), s = !1;
return e = e.replace(o, function(e, t, i, o) {
var l = o, c = /\n\n$/.test(l), u = c || l.search(/\n{2,}/) > -1;
- return u || a ? l = r(I(l), !0) : (l = h(I(l), !0), l = l.replace(/\n$/, ""), n || (l = s(l))),
- a = c, "
" + l + "
\n";
- }), e = e.replace(/~0/g, ""), D--, e;
+ return u || s ? l = r(N(l), !0) : (l = h(N(l), !0), l = l.replace(/\n$/, ""), n || (l = a(l))),
+ s = c, "
" + l + "
\n";
+ }), e = e.replace(/~0/g, ""), j--, e;
}
- function m(e) {
+ function g(e) {
return e += "~0", e = e.replace(/(?:\n\n|^\n?)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g, function(e, t, n) {
var i = t, o = n;
- return i = y(I(i)), i = P(i), i = i.replace(/^\n+/g, ""), i = i.replace(/\n+$/g, ""),
+ return i = y(N(i)), i = I(i), i = i.replace(/^\n+/g, ""), i = i.replace(/\n+$/g, ""),
i = "
" + i + "\n
", "\n\n" + i + "\n\n" + o;
}), e = e.replace(/~0/, "");
}
function v(e) {
- return e = e.replace(/(^\n+|\n+$)/g, ""), "\n\n~K" + (z.push(e) - 1) + "K\n\n";
+ return e = e.replace(/(^\n+|\n+$)/g, ""), "\n\n~K" + (R.push(e) - 1) + "K\n\n";
}
function b(e) {
return e = e.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm, function(e, t, n, i) {
@@ -5962,13 +6034,13 @@ function() {
}
function y(e) {
return e = e.replace(/&/g, "&"), e = e.replace(//g, ">"),
- e = N(e, "*_{}[]\\", !1);
+ e = A(e, "*_{}[]\\", !1);
}
- function w(e) {
+ function x(e) {
return e = e.replace(/([\W_]|^)(\*\*|__)(?=\S)([^\r]*?\S[\*_]*)\2([\W_]|$)/g, "$1$3$4"),
e = e.replace(/([\W_]|^)(\*|_)(?=\S)([^\r\*_]*?\S)\2([\W_]|$)/g, "$1$3$4");
}
- function x(e) {
+ function w(e) {
return e = e.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm, function(e, t) {
var n = t;
return n = n.replace(/^[ \t]*>[ \t]?/gm, "~0"), n = n.replace(/~0/g, ""), n = n.replace(/^[ \t]+$/gm, ""),
@@ -5978,107 +6050,103 @@ function() {
}), v("
\n" + n + "\n
");
});
}
- function k(e, t) {
+ function C(e, t) {
e = e.replace(/^\n+/g, ""), e = e.replace(/\n+$/g, "");
- for (var n = e.split(/\n{2,}/g), i = [], o = /~K(\d+)K/, r = n.length, a = 0; r > a; a++) {
- var l = n[a];
- o.test(l) ? i.push(l) : /\S/.test(l) && (l = s(l), l = l.replace(/^([ \t]*)/g, "
"),
+ for (var n = e.split(/\n{2,}/g), i = [], o = /~K(\d+)K/, r = n.length, s = 0; r > s; s++) {
+ var l = n[s];
+ o.test(l) ? i.push(l) : /\S/.test(l) && (l = a(l), l = l.replace(/^([ \t]*)/g, "
"),
l += "
", i.push(l));
}
if (!t) {
r = i.length;
- for (var a = 0; r > a; a++) for (var c = !0; c; ) c = !1, i[a] = i[a].replace(/~K(\d+)K/g, function(e, t) {
- return c = !0, z[t];
+ for (var s = 0; r > s; s++) for (var c = !0; c; ) c = !1, i[s] = i[s].replace(/~K(\d+)K/g, function(e, t) {
+ return c = !0, R[t];
});
}
return i.join("\n\n");
}
- function C(e) {
+ function k(e) {
return e = e.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g, "&"), e = e.replace(/<(?![a-z\/?!]|~D)/gi, "<");
}
function S(e) {
- return e = e.replace(/\\(\\)/g, L), e = e.replace(/\\([`*_{}\[\]()>#+-.!])/g, L);
+ return e = e.replace(/\\(\\)/g, M), e = e.replace(/\\([`*_{}\[\]()>#+-.!])/g, M);
}
- function T(e, t, n, i) {
+ function _(e, t, n, i) {
if (t) return e;
if (")" !== i.charAt(i.length - 1)) return "<" + n + i + ">";
- for (var o = i.match(/[()]/g), r = 0, s = 0; s < o.length; s++) "(" === o[s] ? 0 >= r ? r = 1 : r++ : r--;
- var a = "";
+ for (var o = i.match(/[()]/g), r = 0, a = 0; a < o.length; a++) "(" === o[a] ? 0 >= r ? r = 1 : r++ : r--;
+ var s = "";
if (0 > r) {
var l = new RegExp("\\){1," + -r + "}$");
i = i.replace(l, function(e) {
- return a = e, "";
+ return s = e, "";
});
}
- if (a) {
+ if (s) {
var c = i.charAt(i.length - 1);
- B.test(c) || (a = c + a, i = i.substr(0, i.length - 1));
+ H.test(c) || (s = c + s, i = i.substr(0, i.length - 1));
}
- return "<" + n + i + ">" + a;
+ return "<" + n + i + ">" + s;
}
- function E(e) {
- e = e.replace(q, T);
+ function T(e) {
+ e = e.replace(B, _);
var t = function(e, t) {
- return '' + R.plainLinkText(t) + "";
+ return '' + L.plainLinkText(t) + "";
};
return e = e.replace(/<((https?|ftp):[^'">\s]+)>/gi, t);
}
- function _(e) {
+ function E(e) {
return e = e.replace(/~E(\d+)E/g, function(e, t) {
var n = parseInt(t);
return String.fromCharCode(n);
});
}
- function I(e) {
+ function N(e) {
return e = e.replace(/^(\t|[ ]{1,4})/gm, "~0"), e = e.replace(/~0/g, "");
}
- function P(e) {
+ function I(e) {
if (!/\t/.test(e)) return e;
var t, n = [ " ", " ", " ", " " ], i = 0;
return e.replace(/[\n\t]/g, function(e, o) {
return "\n" === e ? (i = o + 1, e) : (t = (o - i) % 4, i = o + 1, n[t]);
});
}
- function $(e) {
- return e ? (e.length, e.replace(W, function(e) {
+ function P(e) {
+ return e ? (e.length, e.replace(U, function(e) {
return "~D" == e ? "%24" : ":" == e ? ":" : "%" + e.charCodeAt(0).toString(16);
})) : "";
}
- function N(e, t, n) {
+ function A(e, t, n) {
var i = "([" + t.replace(/([\[\]\\])/g, "\\$1") + "])";
n && (i = "\\\\" + i);
var o = new RegExp(i, "g");
- return e = e.replace(o, L);
+ return e = e.replace(o, M);
}
- function L(e, t) {
+ function M(e, t) {
var n = t.charCodeAt(0);
return "~E" + n + "E";
}
- var R = this.hooks = new n();
- R.addNoop("plainLinkText"), R.addNoop("preConversion"), R.addNoop("postNormalization"),
- R.addNoop("preBlockGamut"), R.addNoop("postBlockGamut"), R.addNoop("preSpanGamut"),
- R.addNoop("postSpanGamut"), R.addNoop("postConversion");
- var A, M, z, D;
+ var L = this.hooks = new n();
+ L.addNoop("plainLinkText"), L.addNoop("preConversion"), L.addNoop("postNormalization"),
+ L.addNoop("preBlockGamut"), L.addNoop("postBlockGamut"), L.addNoop("preSpanGamut"),
+ L.addNoop("postSpanGamut"), L.addNoop("postConversion");
+ var $, z, R, j;
this.makeHtml = function(n) {
- if (A) throw new Error("Recursive call to converter.makeHtml");
- return A = new i(), M = new i(), z = [], D = 0, n = R.preConversion(n), n = n.replace(/~/g, "~T"),
+ if ($) throw new Error("Recursive call to converter.makeHtml");
+ return $ = new i(), z = new i(), R = [], j = 0, n = L.preConversion(n), n = n.replace(/~/g, "~T"),
n = n.replace(/\$/g, "~D"), n = n.replace(/\r\n/g, "\n"), n = n.replace(/\r/g, "\n"),
- n = "\n\n" + n + "\n\n", n = P(n), n = n.replace(/^[ \t]+$/gm, ""), n = R.postNormalization(n),
- n = t(n), n = e(n), n = r(n), n = _(n), n = n.replace(/~D/g, "$$"), n = n.replace(/~T/g, "~"),
- n = R.postConversion(n), z = M = A = null, n;
+ n = "\n\n" + n + "\n\n", n = I(n), n = n.replace(/^[ \t]+$/gm, ""), n = L.postNormalization(n),
+ n = t(n), n = e(n), n = r(n), n = E(n), n = n.replace(/~D/g, "$$"), n = n.replace(/~T/g, "~"),
+ n = L.postConversion(n), R = z = $ = null, n;
};
- var O = function(e) {
+ var D = function(e) {
return r(e);
- }, j = {
+ }, O = {
ol: "\\d+[.]",
ul: "[*+-]"
- }, H = "[-A-Z0-9+&@#/%?=~_|[\\]()!:,.;]", F = "[-A-Z0-9+&@#/%=~_|[\\])]", q = new RegExp('(="|<)?\\b(https?|ftp)(://' + H + "*" + F + ")(?=$|\\W)", "gi"), B = new RegExp(F, "i"), W = /(?:["'*()[\]:]|~D)/g;
+ }, F = "[-A-Z0-9+&@#/%?=~_|[\\]()!:,.;]", q = "[-A-Z0-9+&@#/%=~_|[\\])]", B = new RegExp('(="|<)?\\b(https?|ftp)(://' + F + "*" + q + ")(?=$|\\W)", "gi"), H = new RegExp(q, "i"), U = /(?:["'*()[\]:]|~D)/g;
};
-}(), define("libs/Markdown.Converter", function() {});
-
-var IN_GLOBAL_SCOPE = !0;
-
-window.PR_SHOULD_USE_CONTINUATION = !0;
+}(), define("libs/Markdown.Converter", function() {}), window.PR_SHOULD_USE_CONTINUATION = !0;
var prettyPrintOne, prettyPrint;
@@ -6096,13 +6164,13 @@ var prettyPrintOne, prettyPrint;
return "\\" === t || "-" === t || "]" === t || "^" === t ? "\\" + t : t;
}
function i(e) {
- var i = e.substring(1, e.length - 1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]", "g")), o = [], r = "^" === i[0], s = [ "[" ];
- r && s.push("^");
- for (var a = r ? 1 : 0, l = i.length; l > a; ++a) {
- var c = i[a];
- if (/\\[bdsw]/i.test(c)) s.push(c); else {
+ var i = e.substring(1, e.length - 1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]", "g")), o = [], r = "^" === i[0], a = [ "[" ];
+ r && a.push("^");
+ for (var s = r ? 1 : 0, l = i.length; l > s; ++s) {
+ var c = i[s];
+ if (/\\[bdsw]/i.test(c)) a.push(c); else {
var u, d = t(c);
- l > a + 2 && "-" === i[a + 1] ? (u = t(i[a + 2]), a += 2) : u = d, o.push([ d, u ]),
+ l > s + 2 && "-" === i[s + 1] ? (u = t(i[s + 2]), s += 2) : u = d, o.push([ d, u ]),
65 > u || d > 122 || (65 > u || d > 90 || o.push([ 32 | Math.max(65, d), 32 | Math.min(u, 90) ]),
97 > u || d > 122 || o.push([ -33 & Math.max(97, d), -33 & Math.min(u, 122) ]));
}
@@ -6110,34 +6178,34 @@ var prettyPrintOne, prettyPrint;
o.sort(function(e, t) {
return e[0] - t[0] || t[1] - e[1];
});
- for (var p = [], f = [], a = 0; a < o.length; ++a) {
- var h = o[a];
+ for (var p = [], f = [], s = 0; s < o.length; ++s) {
+ var h = o[s];
h[0] <= f[1] + 1 ? f[1] = Math.max(f[1], h[1]) : p.push(f = h);
}
- for (var a = 0; a < p.length; ++a) {
- var h = p[a];
- s.push(n(h[0])), h[1] > h[0] && (h[1] + 1 > h[0] && s.push("-"), s.push(n(h[1])));
+ for (var s = 0; s < p.length; ++s) {
+ var h = p[s];
+ a.push(n(h[0])), h[1] > h[0] && (h[1] + 1 > h[0] && a.push("-"), a.push(n(h[1])));
}
- return s.push("]"), s.join("");
+ return a.push("]"), a.join("");
}
function o(e) {
- for (var t = e.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)", "g")), o = t.length, a = [], l = 0, c = 0; o > l; ++l) {
+ for (var t = e.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)", "g")), o = t.length, s = [], l = 0, c = 0; o > l; ++l) {
var u = t[l];
if ("(" === u) ++c; else if ("\\" === u.charAt(0)) {
var d = +u.substring(1);
- d && (c >= d ? a[d] = -1 : t[l] = n(d));
+ d && (c >= d ? s[d] = -1 : t[l] = n(d));
}
}
- for (var l = 1; l < a.length; ++l) -1 === a[l] && (a[l] = ++r);
+ for (var l = 1; l < s.length; ++l) -1 === s[l] && (s[l] = ++r);
for (var l = 0, c = 0; o > l; ++l) {
var u = t[l];
- if ("(" === u) ++c, a[c] || (t[l] = "(?:"); else if ("\\" === u.charAt(0)) {
+ if ("(" === u) ++c, s[c] || (t[l] = "(?:"); else if ("\\" === u.charAt(0)) {
var d = +u.substring(1);
- d && c >= d && (t[l] = "\\" + a[d]);
+ d && c >= d && (t[l] = "\\" + s[d]);
}
}
for (var l = 0; o > l; ++l) "^" === t[l] && "^" !== t[l + 1] && (t[l] = "");
- if (e.ignoreCase && s) for (var l = 0; o > l; ++l) {
+ if (e.ignoreCase && a) for (var l = 0; o > l; ++l) {
var u = t[l], p = u.charAt(0);
u.length >= 2 && "[" === p ? t[l] = i(u) : "\\" !== p && (t[l] = u.replace(/[a-zA-Z]/g, function(e) {
var t = e.charCodeAt(0);
@@ -6146,10 +6214,10 @@ var prettyPrintOne, prettyPrint;
}
return t.join("");
}
- for (var r = 0, s = !1, a = !1, l = 0, c = e.length; c > l; ++l) {
+ for (var r = 0, a = !1, s = !1, l = 0, c = e.length; c > l; ++l) {
var u = e[l];
- if (u.ignoreCase) a = !0; else if (/[a-z]/i.test(u.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi, ""))) {
- s = !0, a = !1;
+ if (u.ignoreCase) s = !0; else if (/[a-z]/i.test(u.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi, ""))) {
+ a = !0, s = !1;
break;
}
}
@@ -6165,26 +6233,29 @@ var prettyPrintOne, prettyPrint;
if (u.global || u.multiline) throw new Error("" + u);
p.push("(?:" + o(u) + ")");
}
- return new RegExp(p.join("|"), a ? "gi" : "g");
+ return new RegExp(p.join("|"), s ? "gi" : "g");
}
function t(e, t) {
function n(e) {
- var l = e.nodeType;
- if (1 == l) {
+ switch (e.nodeType) {
+ case 1:
if (i.test(e.className)) return;
- for (var c = e.firstChild; c; c = c.nextSibling) n(c);
- var u = e.nodeName.toLowerCase();
- ("br" === u || "li" === u) && (o[a] = "\n", s[a << 1] = r++, s[1 | a++ << 1] = e);
- } else if (3 == l || 4 == l) {
- var d = e.nodeValue;
- d.length && (d = t ? d.replace(/\r\n?/g, "\n") : d.replace(/[ \t\r\n]+/g, " "),
- o[a] = d, s[a << 1] = r, r += d.length, s[1 | a++ << 1] = e);
+ for (var l = e.firstChild; l; l = l.nextSibling) n(l);
+ var c = e.nodeName.toLowerCase();
+ ("br" === c || "li" === c) && (o[s] = "\n", a[s << 1] = r++, a[1 | s++ << 1] = e);
+ break;
+
+ case 3:
+ case 4:
+ var u = e.nodeValue;
+ u.length && (u = t ? u.replace(/\r\n?/g, "\n") : u.replace(/[ \t\r\n]+/g, " "),
+ o[s] = u, a[s << 1] = r, r += u.length, a[1 | s++ << 1] = e);
}
}
- var i = /(?:^|\s)nocode(?:\s|$)/, o = [], r = 0, s = [], a = 0;
+ var i = /(?:^|\s)nocode(?:\s|$)/, o = [], r = 0, a = [], s = 0;
return n(e), {
sourceCode: o.join("").replace(/\n$/, ""),
- spans: s
+ spans: a
};
}
function n(e, t, n, i) {
@@ -6206,89 +6277,94 @@ var prettyPrintOne, prettyPrint;
function o(t, i) {
var o, r = {};
(function() {
- for (var n = t.concat(i), s = [], a = {}, l = 0, c = n.length; c > l; ++l) {
+ for (var n = t.concat(i), a = [], s = {}, l = 0, c = n.length; c > l; ++l) {
var u = n[l], d = u[3];
if (d) for (var p = d.length; --p >= 0; ) r[d.charAt(p)] = u;
var f = u[1], h = "" + f;
- a.hasOwnProperty(h) || (s.push(f), a[h] = null);
+ s.hasOwnProperty(h) || (a.push(f), s[h] = null);
}
- s.push(/[\0-\uffff]/), o = e(s);
+ a.push(/[\0-\uffff]/), o = e(a);
})();
- var s = i.length, a = function(e) {
- for (var t = e.sourceCode, l = e.basePos, u = [ l, M ], d = 0, p = t.match(o) || [], f = {}, h = 0, g = p.length; g > h; ++h) {
- var m, v = p[h], b = f[v], y = void 0;
- if ("string" == typeof b) m = !1; else {
- var w = r[v.charAt(0)];
- if (w) y = v.match(w[1]), b = w[0]; else {
- for (var x = 0; s > x; ++x) if (w = i[x], y = v.match(w[1])) {
- b = w[0];
+ var a = i.length, s = function(e) {
+ for (var t = e.sourceCode, l = e.basePos, u = [ l, $ ], d = 0, p = t.match(o) || [], f = {}, h = 0, m = p.length; m > h; ++h) {
+ var g, v = p[h], b = f[v], y = void 0;
+ if ("string" == typeof b) g = !1; else {
+ var x = r[v.charAt(0)];
+ if (x) y = v.match(x[1]), b = x[0]; else {
+ for (var w = 0; a > w; ++w) if (x = i[w], y = v.match(x[1])) {
+ b = x[0];
break;
}
- y || (b = M);
+ y || (b = $);
}
- m = b.length >= 5 && "lang-" === b.substring(0, 5), !m || y && "string" == typeof y[1] || (m = !1,
- b = O), m || (f[v] = b);
+ g = b.length >= 5 && "lang-" === b.substring(0, 5), !g || y && "string" == typeof y[1] || (g = !1,
+ b = j), g || (f[v] = b);
}
- var k = d;
- if (d += v.length, m) {
- var C = y[1], S = v.indexOf(C), T = S + C.length;
- y[2] && (T = v.length - y[2].length, S = T - C.length);
- var E = b.substring(5);
- n(l + k, v.substring(0, S), a, u), n(l + k + S, C, c(E, C), u), n(l + k + T, v.substring(T), a, u);
- } else u.push(l + k, b);
+ var C = d;
+ if (d += v.length, g) {
+ var k = y[1], S = v.indexOf(k), _ = S + k.length;
+ y[2] && (_ = v.length - y[2].length, S = _ - k.length);
+ var T = b.substring(5);
+ n(l + C, v.substring(0, S), s, u), n(l + C + S, k, c(T, k), u), n(l + C + _, v.substring(_), s, u);
+ } else u.push(l + C, b);
}
e.decorations = u;
};
- return a;
+ return s;
}
function r(e) {
var t = [], n = [];
- e.tripleQuotedStrings ? t.push([ P, /^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/, null, "'\"" ]) : e.multiLineStrings ? t.push([ P, /^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/, null, "'\"`" ]) : t.push([ P, /^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/, null, "\"'" ]),
- e.verbatimStrings && n.push([ P, /^@\"(?:[^\"]|\"\")*(?:\"|$)/, null ]);
+ e.tripleQuotedStrings ? t.push([ N, /^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/, null, "'\"" ]) : e.multiLineStrings ? t.push([ N, /^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/, null, "'\"`" ]) : t.push([ N, /^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/, null, "\"'" ]),
+ e.verbatimStrings && n.push([ N, /^@\"(?:[^\"]|\"\")*(?:\"|$)/, null ]);
var i = e.hashComments;
- i && (e.cStyleComments ? (i > 1 ? t.push([ N, /^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/, null, "#" ]) : t.push([ N, /^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/, null, "#" ]),
- n.push([ P, /^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/, null ])) : t.push([ N, /^#[^\r\n]*/, null, "#" ])),
- e.cStyleComments && (n.push([ N, /^\/\/[^\r\n]*/, null ]), n.push([ N, /^\/\*[\s\S]*?(?:\*\/|$)/, null ]));
- var r = e.regexLiterals;
- if (r) {
- var s = r > 1 ? "" : "\n\r", a = s ? "." : "[\\S\\s]", l = "/(?=[^/*" + s + "])" + "(?:[^/\\x5B\\x5C" + s + "]" + "|\\x5C" + a + "|\\x5B(?:[^\\x5C\\x5D" + s + "]" + "|\\x5C" + a + ")*(?:\\x5D|$))+" + "/";
- n.push([ "lang-regex", RegExp("^" + q + "(" + l + ")") ]);
+ if (i && (e.cStyleComments ? (i > 1 ? t.push([ P, /^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/, null, "#" ]) : t.push([ P, /^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/, null, "#" ]),
+ n.push([ N, /^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/, null ])) : t.push([ P, /^#[^\r\n]*/, null, "#" ])),
+ e.cStyleComments && (n.push([ P, /^\/\/[^\r\n]*/, null ]), n.push([ P, /^\/\*[\s\S]*?(?:\*\/|$)/, null ])),
+ e.regexLiterals) {
+ var r = "/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/";
+ n.push([ "lang-regex", new RegExp("^" + q + "(" + r + ")") ]);
}
- var c = e.types;
- c && n.push([ L, c ]);
- var u = ("" + e.keywords).replace(/^ | $/g, "");
- u.length && n.push([ $, new RegExp("^(?:" + u.replace(/[\s,]+/g, "|") + ")\\b"), null ]),
- t.push([ M, /^\s+/, null, " \r\n " ]);
- var d = "^.[^\\s\\w.$@'\"`/\\\\]*";
- return e.regexLiterals && (d += "(?!s*/)"), n.push([ R, /^@[a-z_$][a-z_$@0-9]*/i, null ], [ L, /^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/, null ], [ M, /^[a-z_$][a-z_$@0-9]*/i, null ], [ R, new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*", "i"), null, "0123456789" ], [ M, /^\\[\s\S]?/, null ], [ A, new RegExp(d), null ]),
+ var a = e.types;
+ a && n.push([ A, a ]);
+ var s = ("" + e.keywords).replace(/^ | $/g, "");
+ s.length && n.push([ I, new RegExp("^(?:" + s.replace(/[\s,]+/g, "|") + ")\\b"), null ]),
+ t.push([ $, /^\s+/, null, " \r\n " ]);
+ var l = /^.[^\s\w\.$@\'\"\`\/\\]*/;
+ return n.push([ M, /^@[a-z_$][a-z_$@0-9]*/i, null ], [ A, /^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/, null ], [ $, /^[a-z_$][a-z_$@0-9]*/i, null ], [ M, new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*", "i"), null, "0123456789" ], [ $, /^\\[\s\S]?/, null ], [ L, l, null ]),
o(t, n);
}
- function s(e, t, n) {
+ function a(e, t, n) {
function i(e) {
- var t = e.nodeType;
- if (1 != t || r.test(e.className)) {
- if ((3 == t || 4 == t) && n) {
- var l = e.nodeValue, c = l.match(s);
+ switch (e.nodeType) {
+ case 1:
+ if (r.test(e.className)) break;
+ if ("br" === e.nodeName) o(e), e.parentNode && e.parentNode.removeChild(e); else for (var t = e.firstChild; t; t = t.nextSibling) i(t);
+ break;
+
+ case 3:
+ case 4:
+ if (n) {
+ var l = e.nodeValue, c = l.match(a);
if (c) {
var u = l.substring(0, c.index);
e.nodeValue = u;
var d = l.substring(c.index + c[0].length);
if (d) {
var p = e.parentNode;
- p.insertBefore(a.createTextNode(d), e.nextSibling);
+ p.insertBefore(s.createTextNode(d), e.nextSibling);
}
o(e), u || e.parentNode.removeChild(e);
}
}
- } else if ("br" === e.nodeName) o(e), e.parentNode && e.parentNode.removeChild(e); else for (var f = e.firstChild; f; f = f.nextSibling) i(f);
+ }
}
function o(e) {
function t(e, n) {
var i = n ? e.cloneNode(!1) : e, o = e.parentNode;
if (o) {
- var r = t(o, 1), s = e.nextSibling;
+ var r = t(o, 1), a = e.nextSibling;
r.appendChild(i);
- for (var a = s; a; a = s) s = a.nextSibling, r.appendChild(a);
+ for (var s = a; s; s = a) a = s.nextSibling, r.appendChild(s);
}
return i;
}
@@ -6296,43 +6372,43 @@ var prettyPrintOne, prettyPrint;
for (var n, i = t(e.nextSibling, 0); (n = i.parentNode) && 1 === n.nodeType; ) i = n;
c.push(i);
}
- for (var r = /(?:^|\s)nocode(?:\s|$)/, s = /\r\n?|\n/, a = e.ownerDocument, l = a.createElement("li"); e.firstChild; ) l.appendChild(e.firstChild);
+ for (var r = /(?:^|\s)nocode(?:\s|$)/, a = /\r\n?|\n/, s = e.ownerDocument, l = s.createElement("li"); e.firstChild; ) l.appendChild(e.firstChild);
for (var c = [ l ], u = 0; u < c.length; ++u) i(c[u]);
t === (0 | t) && c[0].setAttribute("value", t);
- var d = a.createElement("ol");
+ var d = s.createElement("ol");
d.className = "linenums";
for (var p = Math.max(0, 0 | t - 1) || 0, u = 0, f = c.length; f > u; ++u) l = c[u],
- l.className = "L" + (u + p) % 10, l.firstChild || l.appendChild(a.createTextNode(" ")),
+ l.className = "L" + (u + p) % 10, l.firstChild || l.appendChild(s.createTextNode(" ")),
d.appendChild(l);
e.appendChild(d);
}
- function a(e) {
+ function s(e) {
var t = /\bMSIE\s(\d+)/.exec(navigator.userAgent);
t = t && +t[1] <= 8;
- var n = /\n/g, i = e.sourceCode, o = i.length, r = 0, s = e.spans, a = s.length, l = 0, c = e.decorations, u = c.length, d = 0;
+ var n = /\n/g, i = e.sourceCode, o = i.length, r = 0, a = e.spans, s = a.length, l = 0, c = e.decorations, u = c.length, d = 0;
c[u] = o;
var p, f;
for (f = p = 0; u > f; ) c[f] !== c[f + 2] ? (c[p++] = c[f++], c[p++] = c[f++]) : f += 2;
for (u = p, f = p = 0; u > f; ) {
- for (var h = c[f], g = c[f + 1], m = f + 2; u >= m + 2 && c[m + 1] === g; ) m += 2;
- c[p++] = h, c[p++] = g, f = m;
+ for (var h = c[f], m = c[f + 1], g = f + 2; u >= g + 2 && c[g + 1] === m; ) g += 2;
+ c[p++] = h, c[p++] = m, f = g;
}
u = c.length = p;
var v, b = e.sourceNode;
b && (v = b.style.display, b.style.display = "none");
try {
- for (;a > l; ) {
- s[l];
- var y, w = s[l + 2] || o, x = c[d + 2] || o, m = Math.min(w, x), k = s[l + 1];
- if (1 !== k.nodeType && (y = i.substring(r, m))) {
- t && (y = y.replace(n, "\r")), k.nodeValue = y;
- var C = k.ownerDocument, S = C.createElement("span");
+ for (;s > l; ) {
+ a[l];
+ var y, x = a[l + 2] || o, w = c[d + 2] || o, g = Math.min(x, w), C = a[l + 1];
+ if (1 !== C.nodeType && (y = i.substring(r, g))) {
+ t && (y = y.replace(n, "\r")), C.nodeValue = y;
+ var k = C.ownerDocument, S = k.createElement("span");
S.className = c[d + 1];
- var T = k.parentNode;
- T.replaceChild(S, k), S.appendChild(k), w > r && (s[l + 1] = k = C.createTextNode(i.substring(m, w)),
- T.insertBefore(k, S.nextSibling));
+ var _ = C.parentNode;
+ _.replaceChild(S, C), S.appendChild(C), x > r && (a[l + 1] = C = k.createTextNode(i.substring(g, x)),
+ _.insertBefore(C, S.nextSibling));
}
- r = m, r >= w && (l += 2), r >= x && (d += 2);
+ r = g, r >= x && (l += 2), r >= w && (d += 2);
}
} finally {
b && (b.style.display = v);
@@ -6352,14 +6428,14 @@ var prettyPrintOne, prettyPrint;
var n = e.langExtension;
try {
var i = t(e.sourceNode, e.pre), o = i.sourceCode;
- e.sourceCode = o, e.spans = i.spans, e.basePos = 0, c(n, o)(e), a(e);
+ e.sourceCode = o, e.spans = i.spans, e.basePos = 0, c(n, o)(e), s(e);
} catch (r) {
- f.console && console.log(r && r.stack || r);
+ f.console && console.log(r && r.stack ? r.stack : r);
}
}
function d(e, t, n) {
- var i = document.createElement("div");
- i.innerHTML = "
" + e + "
", i = i.firstChild, n && s(i, n, !0);
+ var i = document.createElement("pre");
+ i.innerHTML = e, n && a(i, n, !0);
var o = {
langExtension: t,
numberLines: n,
@@ -6368,82 +6444,67 @@ var prettyPrintOne, prettyPrint;
};
return u(o), i.innerHTML;
}
- function p(e, t) {
- function n(e) {
- return r.getElementsByTagName(e);
+ function p(e) {
+ function t(e) {
+ return document.getElementsByTagName(e);
}
- function o() {
- for (var t = f.PR_SHOULD_USE_CONTINUATION ? g.now() + 250 : 1/0; v < c.length && g.now() < t; v++) {
- for (var n = c[v], r = S, l = n; l = l.previousSibling; ) {
- var d = l.nodeType, p = (7 === d || 8 === d) && l.nodeValue;
- if (p ? !/^\??prettify\b/.test(p) : 3 !== d || /\S/.test(l.nodeValue)) break;
- if (p) {
- r = {}, p.replace(/\b(\w+)=([\w:.%+-]+)/g, function(e, t, n) {
- r[t] = n;
- });
- break;
- }
- }
- var h = n.className;
- if ((r !== S || y.test(h)) && !w.test(h)) {
- for (var T = !1, E = n.parentNode; E; E = E.parentNode) {
- var _ = E.tagName;
- if (C.test(_) && E.className && y.test(E.className)) {
- T = !0;
+ function n() {
+ for (var t = f.PR_SHOULD_USE_CONTINUATION ? d.now() + 250 : 1/0; h < r.length && d.now() < t; h++) {
+ var o = r[h], s = o.className;
+ if (g.test(s) && !v.test(s)) {
+ for (var l = !1, c = o.parentNode; c; c = c.parentNode) {
+ var w = c.tagName;
+ if (x.test(w) && c.className && g.test(c.className)) {
+ l = !0;
break;
}
}
- if (!T) {
- n.className += " prettyprinted";
- var I = r.lang;
- if (!I) {
- I = h.match(b);
- var P;
- !I && (P = i(n)) && k.test(P.tagName) && (I = P.className.match(b)), I && (I = I[1]);
+ if (!l) {
+ o.className += " prettyprinted";
+ var C, k = s.match(m);
+ !k && (C = i(o)) && y.test(C.tagName) && (k = C.className.match(m)), k && (k = k[1]);
+ var S;
+ if (b.test(o.tagName)) S = 1; else {
+ var _ = o.currentStyle, T = _ ? _.whiteSpace : document.defaultView && document.defaultView.getComputedStyle ? document.defaultView.getComputedStyle(o, null).getPropertyValue("white-space") : 0;
+ S = T && "pre" === T.substring(0, 3);
}
- var $;
- if (x.test(n.tagName)) $ = 1; else {
- var N = n.currentStyle, L = a.defaultView, R = N ? N.whiteSpace : L && L.getComputedStyle ? L.getComputedStyle(n, null).getPropertyValue("white-space") : 0;
- $ = R && "pre" === R.substring(0, 3);
- }
- var A = r.linenums;
- (A = "true" === A || +A) || (A = h.match(/\blinenums\b(?::(\d+))?/), A = A ? A[1] && A[1].length ? +A[1] : !0 : !1),
- A && s(n, A, $), m = {
- langExtension: I,
- sourceNode: n,
- numberLines: A,
- pre: $
- }, u(m);
+ var E = o.className.match(/\blinenums\b(?::(\d+))?/);
+ E = E ? E[1] && E[1].length ? +E[1] : !0 : !1, E && a(o, E, S), p = {
+ langExtension: k,
+ sourceNode: o,
+ numberLines: E,
+ pre: S
+ }, u(p);
}
}
}
- v < c.length ? setTimeout(o, 250) : "function" == typeof e && e();
+ h < r.length ? setTimeout(n, 250) : e && e();
}
- for (var r = t || document.body, a = r.ownerDocument || document, l = [ n("pre"), n("code"), n("xmp") ], c = [], d = 0; d < l.length; ++d) for (var p = 0, h = l[d].length; h > p; ++p) c.push(l[d][p]);
- l = null;
- var g = Date;
- g.now || (g = {
+ for (var o = [ t("pre"), t("code"), t("xmp") ], r = [], s = 0; s < o.length; ++s) for (var l = 0, c = o[s].length; c > l; ++l) r.push(o[s][l]);
+ o = null;
+ var d = Date;
+ d.now || (d = {
now: function() {
return +new Date();
}
});
- var m, v = 0, b = /\blang(?:uage)?-([\w.]+)(?!\S)/, y = /\bprettyprint\b/, w = /\bprettyprinted\b/, x = /pre|xmp/i, k = /^code$/i, C = /^(?:pre|code|xmp)$/i, S = {};
- o();
+ var p, h = 0, m = /\blang(?:uage)?-([\w.]+)(?!\S)/, g = /\bprettyprint\b/, v = /\bprettyprinted\b/, b = /pre|xmp/i, y = /^code$/i, x = /^(?:pre|code|xmp)$/i;
+ n();
}
- var f = window, h = [ "break,continue,do,else,for,if,return,while" ], g = [ h, "auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile" ], m = [ g, "catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof" ], v = [ m, "alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where" ], b = [ m, "abstract,assert,boolean,byte,extends,final,finally,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient" ], y = [ b, "as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,internal,into,is,let,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var,virtual,where" ], w = "all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes", x = [ m, "debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN" ], k = "caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END", C = [ h, "and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None" ], S = [ h, "alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END" ], T = [ h, "as,assert,const,copy,drop,enum,extern,fail,false,fn,impl,let,log,loop,match,mod,move,mut,priv,pub,pure,ref,self,static,struct,true,trait,type,unsafe,use" ], E = [ h, "case,done,elif,esac,eval,fi,function,in,local,set,then,until" ], _ = [ v, y, x, k, C, S, E ], I = /^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/, P = "str", $ = "kwd", N = "com", L = "typ", R = "lit", A = "pun", M = "pln", z = "tag", D = "dec", O = "src", j = "atn", H = "atv", F = "nocode", q = "(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*", B = /\S/, W = r({
- keywords: _,
+ var f = window, h = [ "break,continue,do,else,for,if,return,while" ], m = [ h, "auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile" ], g = [ m, "catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof" ], v = [ g, "alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where" ], b = [ g, "abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient" ], y = [ b, "as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,let,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var,virtual,where" ], x = "all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes", w = [ g, "debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN" ], C = "caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END", k = [ h, "and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None" ], S = [ h, "alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END" ], _ = [ h, "case,done,elif,esac,eval,fi,function,in,local,set,then,until" ], T = [ v, y, w, C + k, S, _ ], E = /^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/, N = "str", I = "kwd", P = "com", A = "typ", M = "lit", L = "pun", $ = "pln", z = "tag", R = "dec", j = "src", D = "atn", O = "atv", F = "nocode", q = "(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*", B = /\S/, H = r({
+ keywords: T,
hashComments: !0,
cStyleComments: !0,
multiLineStrings: !0,
regexLiterals: !0
}), U = {};
- l(W, [ "default-code" ]), l(o([], [ [ M, /^[^]+/ ], [ D, /^]*(?:>|$)/ ], [ N, /^<\!--[\s\S]*?(?:-\->|$)/ ], [ "lang-", /^<\?([\s\S]+?)(?:\?>|$)/ ], [ "lang-", /^<%([\s\S]+?)(?:%>|$)/ ], [ A, /^(?:<[%?]|[%?]>)/ ], [ "lang-", /^]*>([\s\S]+?)<\/xmp\b[^>]*>/i ], [ "lang-js", /^}
- *
define style rules. See the example page for examples.
- *
mark the {@code
} and {@code } tags in your source with
- * {@code class=prettyprint.}
- * You can also use the (html deprecated) {@code } tag, but the pretty
- * printer needs to do more substantial DOM manipulations to support that, so
- * some css styles may not be preserved.
- *
- * That's it. I wanted to keep the API as simple as possible, so there's no
- * need to specify which language the code is in, but if you wish, you can add
- * another class to the {@code
} or {@code } element to specify the
- * language, as in {@code
}. Any class that
- * starts with "lang-" followed by a file extension, specifies the file type.
- * See the "lang-*.js" files in this directory for code that implements
- * per-language file handlers.
- *
- * Change log:
- * cbeust, 2006/08/22
- *
- * Java annotations (start with "@") are now captured as literals ("lit")
- *
- * @requires console
- */
-
-// JSLint declarations
-/*global console, document, navigator, setTimeout, window, define */
-
-/** @define {boolean} */
-var IN_GLOBAL_SCOPE = true;
-
-/**
- * Split {@code prettyPrint} into multiple timeouts so as not to interfere with
- * UI events.
- * If set to {@code false}, {@code prettyPrint()} is synchronous.
- */
-window['PR_SHOULD_USE_CONTINUATION'] = true;
-
-/**
- * Pretty print a chunk of code.
- * @param {string} sourceCodeHtml The HTML to pretty print.
- * @param {string} opt_langExtension The language name to use.
- * Typically, a filename extension like 'cpp' or 'java'.
- * @param {number|boolean} opt_numberLines True to number lines,
- * or the 1-indexed number of the first line in sourceCodeHtml.
- * @return {string} code as html, but prettier
- */
-var prettyPrintOne;
-/**
- * Find all the {@code
} and {@code } tags in the DOM with
- * {@code class=prettyprint} and prettify them.
- *
- * @param {Function} opt_whenDone called when prettifying is done.
- * @param {HTMLElement|HTMLDocument} opt_root an element or document
- * containing all the elements to pretty print.
- * Defaults to {@code document.body}.
- */
-var prettyPrint;
-
-
-(function () {
- var win = window;
- // Keyword lists for various languages.
- // We use things that coerce to strings to make them compact when minified
- // and to defeat aggressive optimizers that fold large string constants.
- var FLOW_CONTROL_KEYWORDS = ["break,continue,do,else,for,if,return,while"];
- var C_KEYWORDS = [FLOW_CONTROL_KEYWORDS,"auto,case,char,const,default," +
- "double,enum,extern,float,goto,inline,int,long,register,short,signed," +
- "sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];
- var COMMON_KEYWORDS = [C_KEYWORDS,"catch,class,delete,false,import," +
- "new,operator,private,protected,public,this,throw,true,try,typeof"];
- var CPP_KEYWORDS = [COMMON_KEYWORDS,"alignof,align_union,asm,axiom,bool," +
- "concept,concept_map,const_cast,constexpr,decltype,delegate," +
- "dynamic_cast,explicit,export,friend,generic,late_check," +
- "mutable,namespace,nullptr,property,reinterpret_cast,static_assert," +
- "static_cast,template,typeid,typename,using,virtual,where"];
- var JAVA_KEYWORDS = [COMMON_KEYWORDS,
- "abstract,assert,boolean,byte,extends,final,finally,implements,import," +
- "instanceof,interface,null,native,package,strictfp,super,synchronized," +
- "throws,transient"];
- var CSHARP_KEYWORDS = [JAVA_KEYWORDS,
- "as,base,by,checked,decimal,delegate,descending,dynamic,event," +
- "fixed,foreach,from,group,implicit,in,internal,into,is,let," +
- "lock,object,out,override,orderby,params,partial,readonly,ref,sbyte," +
- "sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort," +
- "var,virtual,where"];
- var COFFEE_KEYWORDS = "all,and,by,catch,class,else,extends,false,finally," +
- "for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then," +
- "throw,true,try,unless,until,when,while,yes";
- var JSCRIPT_KEYWORDS = [COMMON_KEYWORDS,
- "debugger,eval,export,function,get,null,set,undefined,var,with," +
- "Infinity,NaN"];
- var PERL_KEYWORDS = "caller,delete,die,do,dump,elsif,eval,exit,foreach,for," +
- "goto,if,import,last,local,my,next,no,our,print,package,redo,require," +
- "sub,undef,unless,until,use,wantarray,while,BEGIN,END";
- var PYTHON_KEYWORDS = [FLOW_CONTROL_KEYWORDS, "and,as,assert,class,def,del," +
- "elif,except,exec,finally,from,global,import,in,is,lambda," +
- "nonlocal,not,or,pass,print,raise,try,with,yield," +
- "False,True,None"];
- var RUBY_KEYWORDS = [FLOW_CONTROL_KEYWORDS, "alias,and,begin,case,class," +
- "def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo," +
- "rescue,retry,self,super,then,true,undef,unless,until,when,yield," +
- "BEGIN,END"];
- var RUST_KEYWORDS = [FLOW_CONTROL_KEYWORDS, "as,assert,const,copy,drop," +
- "enum,extern,fail,false,fn,impl,let,log,loop,match,mod,move,mut,priv," +
- "pub,pure,ref,self,static,struct,true,trait,type,unsafe,use"];
- var SH_KEYWORDS = [FLOW_CONTROL_KEYWORDS, "case,done,elif,esac,eval,fi," +
- "function,in,local,set,then,until"];
- var ALL_KEYWORDS = [
- CPP_KEYWORDS, CSHARP_KEYWORDS, JSCRIPT_KEYWORDS, PERL_KEYWORDS,
- PYTHON_KEYWORDS, RUBY_KEYWORDS, SH_KEYWORDS];
- var C_TYPES = /^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/;
-
- // token style names. correspond to css classes
- /**
- * token style for a string literal
- * @const
- */
- var PR_STRING = 'str';
- /**
- * token style for a keyword
- * @const
- */
- var PR_KEYWORD = 'kwd';
- /**
- * token style for a comment
- * @const
- */
- var PR_COMMENT = 'com';
- /**
- * token style for a type
- * @const
- */
- var PR_TYPE = 'typ';
- /**
- * token style for a literal value. e.g. 1, null, true.
- * @const
- */
- var PR_LITERAL = 'lit';
- /**
- * token style for a punctuation string.
- * @const
- */
- var PR_PUNCTUATION = 'pun';
- /**
- * token style for plain text.
- * @const
- */
- var PR_PLAIN = 'pln';
-
- /**
- * token style for an sgml tag.
- * @const
- */
- var PR_TAG = 'tag';
- /**
- * token style for a markup declaration such as a DOCTYPE.
- * @const
- */
- var PR_DECLARATION = 'dec';
- /**
- * token style for embedded source.
- * @const
- */
- var PR_SOURCE = 'src';
- /**
- * token style for an sgml attribute name.
- * @const
- */
- var PR_ATTRIB_NAME = 'atn';
- /**
- * token style for an sgml attribute value.
- * @const
- */
- var PR_ATTRIB_VALUE = 'atv';
-
- /**
- * A class that indicates a section of markup that is not code, e.g. to allow
- * embedding of line numbers within code listings.
- * @const
- */
- var PR_NOCODE = 'nocode';
-
-
-
- /**
- * A set of tokens that can precede a regular expression literal in
- * javascript
- * http://web.archive.org/web/20070717142515/http://www.mozilla.org/js/language/js20/rationale/syntax.html
- * has the full list, but I've removed ones that might be problematic when
- * seen in languages that don't support regular expression literals.
- *
- *
Specifically, I've removed any keywords that can't precede a regexp
- * literal in a syntactically legal javascript program, and I've removed the
- * "in" keyword since it's not a keyword in many languages, and might be used
- * as a count of inches.
- *
- *
The link above does not accurately describe EcmaScript rules since
- * it fails to distinguish between (a=++/b/i) and (a++/b/i) but it works
- * very well in practice.
- *
- * @private
- * @const
- */
- var REGEXP_PRECEDER_PATTERN = '(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*';
-
- // CAVEAT: this does not properly handle the case where a regular
- // expression immediately follows another since a regular expression may
- // have flags for case-sensitivity and the like. Having regexp tokens
- // adjacent is not valid in any language I'm aware of, so I'm punting.
- // TODO: maybe style special characters inside a regexp as punctuation.
-
- /**
- * Given a group of {@link RegExp}s, returns a {@code RegExp} that globally
- * matches the union of the sets of strings matched by the input RegExp.
- * Since it matches globally, if the input strings have a start-of-input
- * anchor (/^.../), it is ignored for the purposes of unioning.
- * @param {Array.} regexs non multiline, non-global regexs.
- * @return {RegExp} a global regex.
- */
- function combinePrefixPatterns(regexs) {
- var capturedGroupIndex = 0;
-
- var needToFoldCase = false;
- var ignoreCase = false;
- for (var i = 0, n = regexs.length; i < n; ++i) {
- var regex = regexs[i];
- if (regex.ignoreCase) {
- ignoreCase = true;
- } else if (/[a-z]/i.test(regex.source.replace(
- /\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi, ''))) {
- needToFoldCase = true;
- ignoreCase = false;
- break;
- }
- }
-
- var escapeCharToCodeUnit = {
- 'b': 8,
- 't': 9,
- 'n': 0xa,
- 'v': 0xb,
- 'f': 0xc,
- 'r': 0xd
- };
-
- function decodeEscape(charsetPart) {
- var cc0 = charsetPart.charCodeAt(0);
- if (cc0 !== 92 /* \\ */) {
- return cc0;
- }
- var c1 = charsetPart.charAt(1);
- cc0 = escapeCharToCodeUnit[c1];
- if (cc0) {
- return cc0;
- } else if ('0' <= c1 && c1 <= '7') {
- return parseInt(charsetPart.substring(1), 8);
- } else if (c1 === 'u' || c1 === 'x') {
- return parseInt(charsetPart.substring(2), 16);
- } else {
- return charsetPart.charCodeAt(1);
- }
- }
-
- function encodeEscape(charCode) {
- if (charCode < 0x20) {
- return (charCode < 0x10 ? '\\x0' : '\\x') + charCode.toString(16);
- }
- var ch = String.fromCharCode(charCode);
- return (ch === '\\' || ch === '-' || ch === ']' || ch === '^')
- ? "\\" + ch : ch;
- }
-
- function caseFoldCharset(charSet) {
- var charsetParts = charSet.substring(1, charSet.length - 1).match(
- new RegExp(
- '\\\\u[0-9A-Fa-f]{4}'
- + '|\\\\x[0-9A-Fa-f]{2}'
- + '|\\\\[0-3][0-7]{0,2}'
- + '|\\\\[0-7]{1,2}'
- + '|\\\\[\\s\\S]'
- + '|-'
- + '|[^-\\\\]',
- 'g'));
- var ranges = [];
- var inverse = charsetParts[0] === '^';
-
- var out = ['['];
- if (inverse) { out.push('^'); }
-
- for (var i = inverse ? 1 : 0, n = charsetParts.length; i < n; ++i) {
- var p = charsetParts[i];
- if (/\\[bdsw]/i.test(p)) { // Don't muck with named groups.
- out.push(p);
- } else {
- var start = decodeEscape(p);
- var end;
- if (i + 2 < n && '-' === charsetParts[i + 1]) {
- end = decodeEscape(charsetParts[i + 2]);
- i += 2;
- } else {
- end = start;
- }
- ranges.push([start, end]);
- // If the range might intersect letters, then expand it.
- // This case handling is too simplistic.
- // It does not deal with non-latin case folding.
- // It works for latin source code identifiers though.
- if (!(end < 65 || start > 122)) {
- if (!(end < 65 || start > 90)) {
- ranges.push([Math.max(65, start) | 32, Math.min(end, 90) | 32]);
- }
- if (!(end < 97 || start > 122)) {
- ranges.push([Math.max(97, start) & ~32, Math.min(end, 122) & ~32]);
- }
- }
- }
- }
-
- // [[1, 10], [3, 4], [8, 12], [14, 14], [16, 16], [17, 17]]
- // -> [[1, 12], [14, 14], [16, 17]]
- ranges.sort(function (a, b) { return (a[0] - b[0]) || (b[1] - a[1]); });
- var consolidatedRanges = [];
- var lastRange = [];
- for (var i = 0; i < ranges.length; ++i) {
- var range = ranges[i];
- if (range[0] <= lastRange[1] + 1) {
- lastRange[1] = Math.max(lastRange[1], range[1]);
- } else {
- consolidatedRanges.push(lastRange = range);
- }
- }
-
- for (var i = 0; i < consolidatedRanges.length; ++i) {
- var range = consolidatedRanges[i];
- out.push(encodeEscape(range[0]));
- if (range[1] > range[0]) {
- if (range[1] + 1 > range[0]) { out.push('-'); }
- out.push(encodeEscape(range[1]));
- }
- }
- out.push(']');
- return out.join('');
- }
-
- function allowAnywhereFoldCaseAndRenumberGroups(regex) {
- // Split into character sets, escape sequences, punctuation strings
- // like ('(', '(?:', ')', '^'), and runs of characters that do not
- // include any of the above.
- var parts = regex.source.match(
- new RegExp(
- '(?:'
- + '\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]' // a character set
- + '|\\\\u[A-Fa-f0-9]{4}' // a unicode escape
- + '|\\\\x[A-Fa-f0-9]{2}' // a hex escape
- + '|\\\\[0-9]+' // a back-reference or octal escape
- + '|\\\\[^ux0-9]' // other escape sequence
- + '|\\(\\?[:!=]' // start of a non-capturing group
- + '|[\\(\\)\\^]' // start/end of a group, or line start
- + '|[^\\x5B\\x5C\\(\\)\\^]+' // run of other characters
- + ')',
- 'g'));
- var n = parts.length;
-
- // Maps captured group numbers to the number they will occupy in
- // the output or to -1 if that has not been determined, or to
- // undefined if they need not be capturing in the output.
- var capturedGroups = [];
-
- // Walk over and identify back references to build the capturedGroups
- // mapping.
- for (var i = 0, groupIndex = 0; i < n; ++i) {
- var p = parts[i];
- if (p === '(') {
- // groups are 1-indexed, so max group index is count of '('
- ++groupIndex;
- } else if ('\\' === p.charAt(0)) {
- var decimalValue = +p.substring(1);
- if (decimalValue) {
- if (decimalValue <= groupIndex) {
- capturedGroups[decimalValue] = -1;
- } else {
- // Replace with an unambiguous escape sequence so that
- // an octal escape sequence does not turn into a backreference
- // to a capturing group from an earlier regex.
- parts[i] = encodeEscape(decimalValue);
- }
- }
- }
- }
-
- // Renumber groups and reduce capturing groups to non-capturing groups
- // where possible.
- for (var i = 1; i < capturedGroups.length; ++i) {
- if (-1 === capturedGroups[i]) {
- capturedGroups[i] = ++capturedGroupIndex;
- }
- }
- for (var i = 0, groupIndex = 0; i < n; ++i) {
- var p = parts[i];
- if (p === '(') {
- ++groupIndex;
- if (!capturedGroups[groupIndex]) {
- parts[i] = '(?:';
- }
- } else if ('\\' === p.charAt(0)) {
- var decimalValue = +p.substring(1);
- if (decimalValue && decimalValue <= groupIndex) {
- parts[i] = '\\' + capturedGroups[decimalValue];
- }
- }
- }
-
- // Remove any prefix anchors so that the output will match anywhere.
- // ^^ really does mean an anchored match though.
- for (var i = 0; i < n; ++i) {
- if ('^' === parts[i] && '^' !== parts[i + 1]) { parts[i] = ''; }
- }
-
- // Expand letters to groups to handle mixing of case-sensitive and
- // case-insensitive patterns if necessary.
- if (regex.ignoreCase && needToFoldCase) {
- for (var i = 0; i < n; ++i) {
- var p = parts[i];
- var ch0 = p.charAt(0);
- if (p.length >= 2 && ch0 === '[') {
- parts[i] = caseFoldCharset(p);
- } else if (ch0 !== '\\') {
- // TODO: handle letters in numeric escapes.
- parts[i] = p.replace(
- /[a-zA-Z]/g,
- function (ch) {
- var cc = ch.charCodeAt(0);
- return '[' + String.fromCharCode(cc & ~32, cc | 32) + ']';
- });
- }
- }
- }
-
- return parts.join('');
- }
-
- var rewritten = [];
- for (var i = 0, n = regexs.length; i < n; ++i) {
- var regex = regexs[i];
- if (regex.global || regex.multiline) { throw new Error('' + regex); }
- rewritten.push(
- '(?:' + allowAnywhereFoldCaseAndRenumberGroups(regex) + ')');
- }
-
- return new RegExp(rewritten.join('|'), ignoreCase ? 'gi' : 'g');
- }
-
- /**
- * Split markup into a string of source code and an array mapping ranges in
- * that string to the text nodes in which they appear.
- *
- *
- * where #1 is a reference to the {@code "print "} text node above, and so
- * on for the other text nodes.
- *
- *
- *
- * The {@code} spans array is an array of pairs. Even elements are the start
- * indices of substrings, and odd elements are the text nodes (or BR elements)
- * that contain the text for those substrings.
- * Substrings continue until the next index or the end of the source.
- *
- *
- * @param {Node} node an HTML DOM subtree containing source-code.
- * @param {boolean} isPreformatted true if white-space in text nodes should
- * be considered significant.
- * @return {Object} source code and the text nodes in which they occur.
- */
- function extractSourceSpans(node, isPreformatted) {
- var nocode = /(?:^|\s)nocode(?:\s|$)/;
-
- var chunks = [];
- var length = 0;
- var spans = [];
- var k = 0;
-
- function walk(node) {
- var type = node.nodeType;
- if (type == 1) { // Element
- if (nocode.test(node.className)) { return; }
- for (var child = node.firstChild; child; child = child.nextSibling) {
- walk(child);
- }
- var nodeName = node.nodeName.toLowerCase();
- if ('br' === nodeName || 'li' === nodeName) {
- chunks[k] = '\n';
- spans[k << 1] = length++;
- spans[(k++ << 1) | 1] = node;
- }
- } else if (type == 3 || type == 4) { // Text
- var text = node.nodeValue;
- if (text.length) {
- if (!isPreformatted) {
- text = text.replace(/[ \t\r\n]+/g, ' ');
- } else {
- text = text.replace(/\r\n?/g, '\n'); // Normalize newlines.
- }
- // TODO: handle tabs here?
- chunks[k] = text;
- spans[k << 1] = length;
- length += text.length;
- spans[(k++ << 1) | 1] = node;
- }
- }
- }
-
- walk(node);
-
- return {
- sourceCode: chunks.join('').replace(/\n$/, ''),
- spans: spans
- };
- }
-
- /**
- * Apply the given language handler to sourceCode and add the resulting
- * decorations to out.
- * @param {number} basePos the index of sourceCode within the chunk of source
- * whose decorations are already present on out.
- */
- function appendDecorations(basePos, sourceCode, langHandler, out) {
- if (!sourceCode) { return; }
- var job = {
- sourceCode: sourceCode,
- basePos: basePos
- };
- langHandler(job);
- out.push.apply(out, job.decorations);
- }
-
- var notWs = /\S/;
-
- /**
- * Given an element, if it contains only one child element and any text nodes
- * it contains contain only space characters, return the sole child element.
- * Otherwise returns undefined.
- *
- * This is meant to return the CODE element in {@code
} when
- * there is a single child element that contains all the non-space textual
- * content, but not to return anything where there are multiple child elements
- * as in {@code
......
} or when there
- * is textual content.
- */
- function childContentWrapper(element) {
- var wrapper = undefined;
- for (var c = element.firstChild; c; c = c.nextSibling) {
- var type = c.nodeType;
- wrapper = (type === 1) // Element Node
- ? (wrapper ? element : c)
- : (type === 3) // Text Node
- ? (notWs.test(c.nodeValue) ? element : wrapper)
- : wrapper;
- }
- return wrapper === element ? undefined : wrapper;
- }
-
- /** Given triples of [style, pattern, context] returns a lexing function,
- * The lexing function interprets the patterns to find token boundaries and
- * returns a decoration list of the form
- * [index_0, style_0, index_1, style_1, ..., index_n, style_n]
- * where index_n is an index into the sourceCode, and style_n is a style
- * constant like PR_PLAIN. index_n-1 <= index_n, and style_n-1 applies to
- * all characters in sourceCode[index_n-1:index_n].
- *
- * The stylePatterns is a list whose elements have the form
- * [style : string, pattern : RegExp, DEPRECATED, shortcut : string].
- *
- * Style is a style constant like PR_PLAIN, or can be a string of the
- * form 'lang-FOO', where FOO is a language extension describing the
- * language of the portion of the token in $1 after pattern executes.
- * E.g., if style is 'lang-lisp', and group 1 contains the text
- * '(hello (world))', then that portion of the token will be passed to the
- * registered lisp handler for formatting.
- * The text before and after group 1 will be restyled using this decorator
- * so decorators should take care that this doesn't result in infinite
- * recursion. For example, the HTML lexer rule for SCRIPT elements looks
- * something like ['lang-js', /<[s]cript>(.+?)<\/script>/]. This may match
- * '
-
+