/** * SyntaxHighlighter * http://alexgorbatchev.com/SyntaxHighlighter * * SyntaxHighlighter is donationware. If you are using it, please donate. * http://alexgorbatchev.com/SyntaxHighlighter/donate.html * * @version * 3.0.83 (July 02 2010) * * @copyright * Copyright (C) 2004-2010 Alex Gorbatchev. * * @license * Dual licensed under the MIT and GPL licenses. */ var XRegExp; if (XRegExp) throw Error("can't load XRegExp twice in the same frame"); (function() { function r(f, e) { if (!XRegExp.isRegExp(f)) throw TypeError("type RegExp expected"); var a = f._xregexp; f = XRegExp(f.source, t(f) + (e || "")); if (a) f._xregexp = { source: a.source, captureNames: a.captureNames ? a.captureNames.slice(0) : null }; return f } function t(f) { return (f.global ? "g" : "") + (f.ignoreCase ? "i" : "") + (f.multiline ? "m" : "") + (f.extended ? "x" : "") + (f.sticky ? "y" : "") } function B(f, e, a, b) { var c = u.length, d, h, g; v = true; try { for (; c--;) { g = u[c]; if (a & g.scope && (!g.trigger || g.trigger.call(b))) { g.pattern.lastIndex = e; if ((h = g.pattern.exec(f)) && h.index === e) { d = { output: g.handler.call(b, h, a), match: h }; break } } } } catch (i) { throw i } finally { v = false } return d } function p(f, e, a) { if (Array.prototype.indexOf) return f.indexOf(e, a); for (a = a || 0; a < f.length; a++) if (f[a] === e) return a; return -1 } XRegExp = function(f, e) { var a = [], b = XRegExp.OUTSIDE_CLASS, c = 0, d, h; if (XRegExp.isRegExp(f)) { if (e !== undefined) throw TypeError("can't supply flags when constructing one RegExp from another"); return r(f) } if (v) throw Error("can't call the XRegExp constructor within token definition functions"); e = e || ""; for (d = { hasNamedCapture: false, captureNames: [], hasFlag: function(g) { return e.indexOf(g) > -1 }, setFlag: function(g) { e += g } }; c < f.length;) if (h = B(f, c, b, d)) { a.push(h.output); c += h.match[0].length || 1 } else if (h = n.exec.call(z[b], f.slice(c))) { a.push(h[0]); c += h[0].length } else { h = f.charAt(c); if (h === "[") b = XRegExp.INSIDE_CLASS; else if (h === "]") b = XRegExp.OUTSIDE_CLASS; a.push(h); c++ } a = RegExp(a.join(""), n.replace.call(e, w, "")); a._xregexp = { source: f, captureNames: d.hasNamedCapture ? d.captureNames : null }; return a }; XRegExp.version = "1.5.0"; XRegExp.INSIDE_CLASS = 1; XRegExp.OUTSIDE_CLASS = 2; var C = /\$(?:(\d\d?|[$&`'])|{([$\w]+)})/g, w = /[^gimy]+|([\s\S])(?=[\s\S]*\1)/g, A = /^(?:[?*+]|{\d+(?:,\d*)?})\??/, v = false, u = [], n = { exec: RegExp.prototype.exec, test: RegExp.prototype.test, match: String.prototype.match, replace: String.prototype.replace, split: String.prototype.split }, x = n.exec.call(/()??/, "")[1] === undefined, D = function() { var f = /^/g; n.test.call(f, ""); return !f.lastIndex }(), y = function() { var f = /x/g; n.replace.call("x", f, ""); return !f.lastIndex }(), E = RegExp.prototype.sticky !== undefined, z = {}; z[XRegExp.INSIDE_CLASS] = /^(?:\\(?:[0-3][0-7]{0,2}|[4-7][0-7]?|x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|c[A-Za-z]|[\s\S]))/; z[XRegExp.OUTSIDE_CLASS] = /^(?:\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9]\d*|x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|c[A-Za-z]|[\s\S])|\(\?[:=!]|[?*+]\?|{\d+(?:,\d*)?}\??)/; XRegExp.addToken = function(f, e, a, b) { u.push({ pattern: r(f, "g" + (E ? "y" : "")), handler: e, scope: a || XRegExp.OUTSIDE_CLASS, trigger: b || null }) }; XRegExp.cache = function(f, e) { var a = f + "/" + (e || ""); return XRegExp.cache[a] || (XRegExp.cache[a] = XRegExp(f, e)) }; XRegExp.copyAsGlobal = function(f) { return r(f, "g") }; XRegExp.escape = function(f) { return f.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&") }; XRegExp.execAt = function(f, e, a, b) { e = r(e, "g" + (b && E ? "y" : "")); e.lastIndex = a = a || 0; f = e.exec(f); return b ? f && f.index === a ? f : null : f }; XRegExp.freezeTokens = function() { XRegExp.addToken = function() { throw Error("can't run addToken after freezeTokens") } }; XRegExp.isRegExp = function(f) { return Object.prototype.toString.call(f) === "[object RegExp]" }; XRegExp.iterate = function(f, e, a, b) { for (var c = r(e, "g"), d = -1, h; h = c.exec(f);) { a.call(b, h, ++d, f, c); c.lastIndex === h.index && c.lastIndex++ } if (e.global) e.lastIndex = 0 }; XRegExp.matchChain = function(f, e) { return function a(b, c) { var d = e[c].regex ? e[c] : { regex: e[c] }, h = r(d.regex, "g"), g = [], i; for (i = 0; i < b.length; i++) XRegExp.iterate(b[i], h, function(k) { g.push(d.backref ? k[d.backref] || "" : k[0]) }); return c === e.length - 1 || !g.length ? g : a(g, c + 1) }([f], 0) }; RegExp.prototype.apply = function(f, e) { return this.exec(e[0]) }; RegExp.prototype.call = function(f, e) { return this.exec(e) }; RegExp.prototype.exec = function(f) { var e = n.exec.apply(this, arguments), a; if (e) { if (!x && e.length > 1 && p(e, "") > -1) { a = RegExp(this.source, n.replace.call(t(this), "g", "")); n.replace.call(f.slice(e.index), a, function() { for (var c = 1; c < arguments.length - 2; c++) if (arguments[c] === undefined) e[c] = undefined }) } if (this._xregexp && this._xregexp.captureNames) for (var b = 1; b < e.length; b++) if (a = this._xregexp.captureNames[b - 1]) e[a] = e[b]; !D && this.global && !e[0].length && this.lastIndex > e.index && this.lastIndex-- } return e }; if (!D) RegExp.prototype.test = function(f) { (f = n.exec.call(this, f)) && this.global && !f[0].length && this.lastIndex > f.index && this.lastIndex--; return !!f }; String.prototype.match = function(f) { XRegExp.isRegExp(f) || (f = RegExp(f)); if (f.global) { var e = n.match.apply(this, arguments); f.lastIndex = 0; return e } return f.exec(this) }; String.prototype.replace = function(f, e) { var a = XRegExp.isRegExp(f), b, c; if (a && typeof e.valueOf() === "string" && e.indexOf("${") === -1 && y) return n.replace.apply(this, arguments); if (a) { if (f._xregexp) b = f._xregexp.captureNames } else f += ""; if (typeof e === "function") c = n.replace.call(this, f, function() { if (b) { arguments[0] = new String(arguments[0]); for (var d = 0; d < b.length; d++) if (b[d]) arguments[0][b[d]] = arguments[d + 1] } if (a && f.global) f.lastIndex = arguments[arguments.length - 2] + arguments[0].length; return e.apply(null, arguments) }); else { c = this + ""; c = n.replace.call(c, f, function() { var d = arguments; return n.replace.call(e, C, function(h, g, i) { if (g) switch (g) { case "$": return "$"; case "&": return d[0]; case "`": return d[d.length - 1].slice(0, d[d.length - 2]); case "'": return d[d.length - 1].slice(d[d.length - 2] + d[0].length); default: i = ""; g = +g; if (!g) return h; for (; g > d.length - 3;) { i = String.prototype.slice.call(g, -1) + i; g = Math.floor(g / 10) } return (g ? d[g] || "" : "$") + i } else { g = +i; if (g <= d.length - 3) return d[g]; g = b ? p(b, i) : -1; return g > -1 ? d[g + 1] : h } }) }) } if (a && f.global) f.lastIndex = 0; return c }; String.prototype.split = function(f, e) { if (!XRegExp.isRegExp(f)) return n.split.apply(this, arguments); var a = this + "", b = [], c = 0, d, h; if (e === undefined || +e < 0) e = Infinity; else { e = Math.floor(+e); if (!e) return [] } for (f = XRegExp.copyAsGlobal(f); d = f.exec(a);) { if (f.lastIndex > c) { b.push(a.slice(c, d.index)); d.length > 1 && d.index < a.length && Array.prototype.push.apply(b, d.slice(1)); h = d[0].length; c = f.lastIndex; if (b.length >= e) break } f.lastIndex === d.index && f.lastIndex++ } if (c === a.length) { if (!n.test.call(f, "") || h) b.push("") } else b.push(a.slice(c)); return b.length > e ? b.slice(0, e) : b }; XRegExp.addToken(/\(\?#[^)]*\)/, function(f) { return n.test.call(A, f.input.slice(f.index + f[0].length)) ? "" : "(?:)" }); XRegExp.addToken(/\((?!\?)/, function() { this.captureNames.push(null); return "(" }); XRegExp.addToken(/\(\?<([$\w]+)>/, function(f) { this.captureNames.push(f[1]); this.hasNamedCapture = true; return "(" }); XRegExp.addToken(/\\k<([\w$]+)>/, function(f) { var e = p(this.captureNames, f[1]); return e > -1 ? "\\" + (e + 1) + (isNaN(f.input.charAt(f.index + f[0].length)) ? "" : "(?:)") : f[0] }); XRegExp.addToken(/\[\^?]/, function(f) { return f[0] === "[]" ? "\\b\\B" : "[\\s\\S]" }); XRegExp.addToken(/^\(\?([imsx]+)\)/, function(f) { this.setFlag(f[1]); return "" }); XRegExp.addToken(/(?:\s+|#.*)+/, function(f) { return n.test.call(A, f.input.slice(f.index + f[0].length)) ? "" : "(?:)" }, XRegExp.OUTSIDE_CLASS, function() { return this.hasFlag("x") }); XRegExp.addToken(/\./, function() { return "[\\s\\S]" }, XRegExp.OUTSIDE_CLASS, function() { return this.hasFlag("s") }) })(); typeof exports != "undefined" && (exports.XRegExp = XRegExp); var SyntaxHighlighter = function() { function r(a, b) { a.className.indexOf(b) != -1 || (a.className += " " + b) } function t(a) { return a.indexOf("highlighter_") == 0 ? a : "highlighter_" + a } function B(a) { return e.vars.highlighters[t(a)] } function p(a, b, c) { if (a == null) return null; var d = c != true ? a.childNodes : [a.parentNode], h = { "#": "id", ".": "className" }[b.substr(0, 1)] || "nodeName", g, i; g = h != "nodeName" ? b.substr(1) : b.toUpperCase(); if ((a[h] || "").indexOf(g) != -1) return a; for (a = 0; d && a < d.length && i == null; a++) i = p(d[a], b, c); return i } function C(a, b) { var c = {}, d; for (d in a) c[d] = a[d]; for (d in b) c[d] = b[d]; return c } function w(a, b, c, d) { function h(g) { g = g || window.event; if (!g.target) { g.target = g.srcElement; g.preventDefault = function() { this.returnValue = false } } c.call(d || window, g) } a.attachEvent ? a.attachEvent("on" + b, h) : a.addEventListener(b, h, false) } function A(a, b) { var c = e.vars.discoveredBrushes, d = null; if (c == null) { c = {}; for (var h in e.brushes) { var g = e.brushes[h]; d = g.aliases; if (d != null) { g.brushName = h.toLowerCase(); for (g = 0; g < d.length; g++) c[d[g]] = h } } e.vars.discoveredBrushes = c } d = e.brushes[c[a]]; d == null && b != false && window.alert(e.config.strings.alert + (e.config.strings.noBrush + a)); return d } function v(a, b) { for (var c = a.split("\n"), d = 0; d < c.length; d++) c[d] = b(c[d], d); return c.join("\n") } function u(a, b) { if (a == null || a.length == 0 || a == "\n") return a; a = a.replace(/' + c + "" }); return a } function n(a, b) { a.split("\n"); for (var c = "", d = 0; d < 50; d++) c += " "; return a = v(a, function(h) { if (h.indexOf("\t") == -1) return h; for (var g = 0; (g = h.indexOf("\t")) != -1;) h = h.substr(0, g) + c.substr(0, b - g % b) + h.substr(g + 1, h.length); return h }) } function x(a) { return a.replace(/^\s+|\s+$/g, "") } function D(a, b) { if (a.index < b.index) return -1; else if (a.index > b.index) return 1; else if (a.length < b.length) return -1; else if (a.length > b.length) return 1; return 0 } function y(a, b) { function c(k) { return k[0] } for (var d = null, h = [], g = b.func ? b.func : c; (d = b.regex.exec(a)) != null;) { var i = g(d, b); if (typeof i == "string") i = [new e.Match(i, d.index, b.css)]; h = h.concat(i) } return h } function E(a) { var b = /(.*)((>|<).*)/; return a.replace(e.regexLib.url, function(c) { var d = "", h = null; if (h = b.exec(c)) { c = h[1]; d = h[2] } return '' + c + "" + d }) } function z() { for (var a = document.getElementsByTagName("script"), b = [], c = 0; c < a.length; c++) a[c].type == "syntaxhighlighter" && b.push(a[c]); return b } function f(a) { a = a.target; var b = p(a, ".syntaxhighlighter", true); a = p(a, ".container", true); var c = document.createElement("textarea"); if (!(!a || !b || p(a, "textarea"))) { B(b.id); r(b, "source"); for (var d = a.childNodes, h = [], g = 0; g < d.length; g++) h.push(d[g].innerText || d[g].textContent); h = h.join("\r"); c.appendChild(document.createTextNode(h)); a.appendChild(c); c.focus(); c.select(); w(c, "blur", function() { c.parentNode.removeChild(c); b.className = b.className.replace("source", "") }) } } if (typeof require != "undefined" && typeof XRegExp == "undefined") XRegExp = require("XRegExp").XRegExp; var e = { defaults: { "class-name": "", "first-line": 1, "pad-line-numbers": false, highlight: null, title: null, "smart-tabs": true, "tab-size": 4, gutter: true, toolbar: false, "quick-code": true, collapse: false, "auto-links": true, light: false, "html-script": false }, config: { space: " ", useScriptTags: true, bloggerMode: false, stripBrs: false, tagName: "pre", strings: { expandSource: "expand source", help: "?", alert: "SyntaxHighlighter\n\n", noBrush: "Can't find brush for: ", brushNotHtmlScript: "Brush wasn't configured for html-script option: ", aboutDialog: '
' + j + "" : "") + i)
}
return a
},
getTitleHtml: function(a) {
return a ? "| ' + this.getLineNumbersHtml(a) + " | " : "") + '' + b + " |
.*?)(?" + a.right.source + ")", "sgi")
}
}
};
return e
}();
typeof exports != "undefined" && (exports.SyntaxHighlighter = SyntaxHighlighter);