diff --git a/lib/gollum/frontend/public/gollum/livepreview/index.html b/lib/gollum/frontend/public/gollum/livepreview/index.html index 17fd51cd..17b8891c 100644 --- a/lib/gollum/frontend/public/gollum/livepreview/index.html +++ b/lib/gollum/frontend/public/gollum/livepreview/index.html @@ -2,41 +2,45 @@
-
-
+
-
-
+
-
-
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/multi_select_commands.js b/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/multi_select_commands.js
index ed396fb3..ebac5cc7 100644
--- a/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/multi_select_commands.js
+++ b/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/multi_select_commands.js
@@ -92,7 +92,7 @@ exports.multiSelectCommands = [{
bindKey: "esc",
exec: function(editor) { editor.exitMultiSelectMode(); },
readonly: true,
- isAvailable: function(editor) {return editor.inMultiSelectMode}
+ isAvailable: function(editor) {return editor && editor.inMultiSelectMode}
}];
var HashHandler = require("../keyboard/hash_handler").HashHandler;
diff --git a/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/config.js b/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/config.js
index 73a83d51..0bdaf786 100644
--- a/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/config.js
+++ b/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/config.js
@@ -97,10 +97,9 @@ exports.init = function() {
}
}
- var m = src.match(/^(?:(.*\/)ace\.js)(?:\?|$)/);
- if (m) {
- scriptUrl = m[1] || m[2];
- }
+ var m = src.match(/^(.*)\/ace(\-\w+)?\.js(\?|$)/);
+ if (m)
+ scriptUrl = m[1];
}
if (scriptUrl) {
diff --git a/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/css/editor.css b/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/css/editor.css
index c1cd0f0c..0a668fff 100644
--- a/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/css/editor.css
+++ b/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/css/editor.css
@@ -50,9 +50,11 @@
.ace_gutter-cell.ace_info {
background-image: url("data:image/gif;base64,R0lGODlhEAAQAMQAAAAAAEFBQVJSUl5eXmRkZGtra39/f4WFhYmJiZGRkaampry8vMPDw8zMzNXV1dzc3OTk5Orq6vDw8P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABQALAAAAAAQABAAAAUuICWOZGmeaBml5XGwFCQSBGyXRSAwtqQIiRuiwIM5BoYVbEFIyGCQoeJGrVptIQA7");
- background-repeat: no-repeat;
background-position: 2px center;
}
+.ace_dark .ace_gutter-cell.ace_info {
+ background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpGRTk5MTVGREIxNDkxMUUxOTc5Q0FFREQyMTNGMjBFQyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpGRTk5MTVGRUIxNDkxMUUxOTc5Q0FFREQyMTNGMjBFQyI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkZFOTkxNUZCQjE0OTExRTE5NzlDQUVERDIxM0YyMEVDIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkZFOTkxNUZDQjE0OTExRTE5NzlDQUVERDIxM0YyMEVDIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+SIDkjAAAAJ1JREFUeNpi/P//PwMlgImBQkB7A6qrq/+DMC55FkIGKCoq4pVnpFkgTp069f/+/fv/r1u37r+tre1/kg0A+ptn9uzZYLaRkRHpLvjw4cNXWVlZhufPnzOcO3eOdAO0tbVPAjHDmzdvGA4fPsxIsgGSkpJmv379Ynj37h2DjIyMCMkG3LhxQ/T27dsMampqDHZ2dq/pH41DxwCAAAMAFdc68dUsFZgAAAAASUVORK5CYII=");
+}
.ace_editor .ace_sb {
position: absolute;
@@ -246,9 +248,11 @@
background-image: url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%00%05%08%06%00%00%00%8Do%26%E5%00%00%004IDATx%DAe%8A%B1%0D%000%0C%C2%F2%2CK%96%BC%D0%8F9%81%88H%E9%D0%0E%96%C0%10%92%3E%02%80%5E%82%E4%A9*-%EEsw%C8%CC%11%EE%96w%D8%DC%E9*Eh%0C%151(%00%00%00%00IEND%AEB%60%82");
background-repeat: no-repeat;
- background-position: center 5px;
+ background-position: center 4px;
border-radius: 3px;
+
+ border: 1px solid transparent;
}
.ace_fold-widget.end {
@@ -262,11 +266,8 @@
.ace_fold-widget:hover {
border: 1px solid rgba(0, 0, 0, 0.3);
background-color: rgba(255, 255, 255, 0.2);
- -moz-box-shadow:inset 0 1px 1px rgba(255, 255, 255, 0.7);
-moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
- -webkit-box-shadow:inset 0 1px 1px rgba(255, 255, 255, 0.7);
-webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
- box-shadow:inset 0 1px 1px rgba(255, 255, 255, 0.7);
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
background-position: center 4px;
}
@@ -274,14 +275,34 @@
.ace_fold-widget:active {
border: 1px solid rgba(0, 0, 0, 0.4);
background-color: rgba(0, 0, 0, 0.05);
- -moz-box-shadow:inset 0 1px 1px rgba(255, 255, 255);
-moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
- -webkit-box-shadow:inset 0 1px 1px rgba(255, 255, 255);
-webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
- box-shadow:inset 0 1px 1px rgba(255, 255, 255);
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
}
-
+/**
+ * Dark version for fold widgets
+ */
+.ace_dark .ace_fold-widget {
+ background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC");
+}
+.ace_dark .ace_fold-widget.end {
+ background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==");
+}
+.ace_dark .ace_fold-widget.closed {
+ background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==");
+}
+.ace_dark .ace_fold-widget:hover {
+ box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
+ background-color: rgba(255, 255, 255, 0.1);
+}
+.ace_dark .ace_fold-widget:active {
+ -moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
+ -webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
+ box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
+}
+
+
+
.ace_fold-widget.invalid {
background-color: #FFB4B4;
border-color: #DE5555;
diff --git a/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session/bracket_match.js b/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session/bracket_match.js
index 83c8f572..9b977b8c 100644
--- a/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session/bracket_match.js
+++ b/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session/bracket_match.js
@@ -94,7 +94,7 @@ function BracketMatch() {
var match = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
if (!match) {
chr = line.charAt(pos.column);
- pos.column++;
+ pos = {row: pos.row, column: pos.column + 1};
match = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
before = false;
}
@@ -123,9 +123,6 @@ function BracketMatch() {
range.cursor = range.start;
}
- if (!before)
- pos.column--;
-
return range;
};
@@ -194,7 +191,7 @@ function BracketMatch() {
return null;
};
- this.$findClosingBracket = function(bracket, position, typeRe, allowBlankLine) {
+ this.$findClosingBracket = function(bracket, position, typeRe) {
var closingBracket = this.$brackets[bracket];
var depth = 1;
@@ -239,12 +236,6 @@ function BracketMatch() {
// whose type matches typeRe
do {
token = iterator.stepForward();
- if (allowBlankLine) {
- // if you've reached the doc end, or, you match a new content line
- if (token === null || token.type == "string") {
- return {row: iterator.getCurrentTokenRow() + (token === null ? 1 : -1), column: 0};
- }
- }
} while (token && !typeRe.test(token.type));
if (token == null)
diff --git a/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor.js b/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor.js
index 1efac5fc..5b387f98 100644
--- a/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor.js
+++ b/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor.js
@@ -1772,7 +1772,7 @@ var Editor = function(renderer, session) {
var range = this.session.getBracketRange(cursor);
if (!range) {
- range = editor.find({
+ range = this.find({
needle: /[{}()\[\]]/g,
preventScroll:true,
start: {row: cursor.row, column: cursor.column - 1}
@@ -1787,10 +1787,10 @@ var Editor = function(renderer, session) {
pos = range && range.cursor || pos;
if (pos) {
if (select) {
- if (range && range.isEqual(editor.getSelectionRange()))
+ if (range && range.isEqual(this.getSelectionRange()))
this.clearSelection();
else
- this.selection.selectTo(pos.row, pos.column);
+ this.selection.selectTo(pos.row, pos.column);
} else {
this.clearSelection();
this.moveCursorTo(pos.row, pos.column);
diff --git a/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/state_handler.js b/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/state_handler.js
index c7efe552..fa7e5d5c 100644
--- a/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/state_handler.js
+++ b/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/state_handler.js
@@ -105,7 +105,7 @@ StateHandler.prototype = {
var bufferObj = {
bufferToUse: bufferToUse,
- symbolicName: symbolicName,
+ symbolicName: symbolicName
};
if (e) {
diff --git a/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/marker.js b/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/marker.js
index f5999338..127cf7f3 100644
--- a/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/marker.js
+++ b/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/marker.js
@@ -73,7 +73,7 @@ var Marker = function(parentEl) {
var html = [];
- for ( var key in this.markers) {
+ for (var key in this.markers) {
var marker = this.markers[key];
if (!marker.range) {
@@ -140,29 +140,25 @@ var Marker = function(parentEl) {
}
};
- // Draws a multi line marker, where lines span the full width
- this.drawMultiLineMarker = function(stringBuilder, range, clazz, layerConfig, type) {
+ // Draws a multi line marker, where lines span the full width
+ this.drawMultiLineMarker = function(stringBuilder, range, clazz, config, type) {
var padding = type === "background" ? 0 : this.$padding;
- var layerWidth = layerConfig.width + 2 * this.$padding - padding;
// from selection start to the end of the line
- var height = layerConfig.lineHeight;
- var width = Math.round(layerWidth - (range.start.column * layerConfig.characterWidth));
- var top = this.$getTop(range.start.row, layerConfig);
- var left = Math.round(
- padding + range.start.column * layerConfig.characterWidth
- );
+ var height = config.lineHeight;
+ var top = this.$getTop(range.start.row, config);
+ var left = Math.round(padding + range.start.column * config.characterWidth);
stringBuilder.push(
""
);
// from start of the last line to the selection end
- top = this.$getTop(range.end.row, layerConfig);
- width = Math.round(range.end.column * layerConfig.characterWidth);
+ top = this.$getTop(range.end.row, config);
+ var width = Math.round(range.end.column * config.characterWidth);
stringBuilder.push(
""
);
diff --git a/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/text.js b/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/text.js
index 92683967..e96dff28 100644
--- a/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/text.js
+++ b/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/text.js
@@ -131,7 +131,7 @@ var Text = function(parentEl) {
container.appendChild(measureNode);
}
}
-
+
// Size and width can be null if the editor is not visible or
// detached from the document
if (!this.element.offsetWidth)
@@ -153,7 +153,7 @@ var Text = function(parentEl) {
return null;
return size;
- }
+ }
: function() {
if (!this.$measureNode) {
var measureNode = this.$measureNode = dom.createElement("div");
@@ -178,7 +178,7 @@ var Text = function(parentEl) {
container.appendChild(measureNode);
}
-
+
var rect = this.$measureNode.getBoundingClientRect();
var size = {
@@ -382,7 +382,7 @@ var Text = function(parentEl) {
"lparen": true
};
- this.$renderToken = function(stringBuilder, screenColumn, token, value) {
+ this.$renderToken = function(stringBuilder, screenColumn, token, value) {
var self = this;
var replaceReg = /\t|&|<|( +)|([\u0000-\u0019\u00a0\u1680\u180E\u2000-\u200b\u2028\u2029\u202F\u205F\u3000\uFEFF])|[\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3000-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]/g;
var replaceFunc = function(c, a, b, tabIdx, idx4) {
@@ -447,7 +447,7 @@ var Text = function(parentEl) {
"'>"
);
}
-
+
for (var i = 0; i < tokens.length; i++) {
var token = tokens[i];
var value = token.value;
@@ -461,12 +461,12 @@ var Text = function(parentEl) {
else {
while (chars + value.length >= splitChars) {
screenColumn = self.$renderToken(
- stringBuilder, screenColumn,
+ stringBuilder, screenColumn,
token, value.substring(0, splitChars - chars)
);
value = value.substring(splitChars - chars);
chars = splitChars;
-
+
if (!onlyContents) {
stringBuilder.push("s around - // "paragraphs" that are wrapped in non-block-level tags, such as anchors, - // phrase emphasis, and spans. The list of tags we're looking for is - // hard-coded: - var block_tags_a = "p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del" - var block_tags_b = "p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math" - - // First, look for nested blocks, e.g.: - //
tags around block-level tags.
- text = _HashHTMLBlocks(text);
- text = _FormParagraphs(text, doNotUnhash);
-
- return text;
- }
-
- function _RunSpanGamut(text) {
- //
- // These are all the transformations that occur *within* block-level
- // tags like paragraphs, headers, and list items.
- //
-
- text = _DoCodeSpans(text);
- text = _EscapeSpecialCharsWithinTagAttributes(text);
- text = _EncodeBackslashEscapes(text);
-
- // Process anchor and image tags. Images must come first,
- // because ![foo][f] looks like an anchor.
- text = _DoImages(text);
- text = _DoAnchors(text);
-
- // Make links out of things like ` Just type tags
- //
-
- // Strip leading and trailing lines:
- text = text.replace(/^\n+/g, "");
- text = text.replace(/\n+$/g, "");
-
- var grafs = text.split(/\n{2,}/g);
- var grafsOut = [];
-
- var markerRe = /~K(\d+)K/;
-
- //
- // Wrap tags.
- //
- var end = grafs.length;
- for (var i = 0; i < end; i++) {
- var str = grafs[i];
-
- // if this is an HTML marker, copy it
- if (markerRe.test(str)) {
- grafsOut.push(str);
- }
- else if (/\S/.test(str)) {
- str = _RunSpanGamut(str);
- str = str.replace(/^([ \t]*)/g, " ");
- str += "
\n");
-
- return text;
- }
-
- function _EscapeSpecialCharsWithinTagAttributes(text) {
- //
- // Within tags -- meaning between < and > -- encode [\ ` * _] so they
- // don't conflict with their use in Markdown for code, italics and strong.
- //
-
- // Build a regex to find HTML tags and comments. See Friedl's
- // "Mastering Regular Expressions", 2nd Ed., pp. 200-201.
-
- // SE: changed the comment part of the regex
-
- var regex = /(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|-]|-[^>])(?:[^-]|-[^-])*)--)>)/gi;
-
- text = text.replace(regex, function (wholeMatch) {
- var tag = wholeMatch.replace(/(.)<\/?code>(?=.)/g, "$1`");
- tag = escapeCharacters(tag, wholeMatch.charAt(1) == "!" ? "\\`*_/" : "\\`*_"); // also escape slashes in comments to prevent autolinking there -- http://meta.stackoverflow.com/questions/95987
- return tag;
- });
-
- return text;
- }
-
- function _DoAnchors(text) {
- //
- // Turn Markdown link shortcuts into XHTML tags.
- //
- //
- // First, handle reference-style links: [link text] [id]
- //
-
- /*
- text = text.replace(/
- ( // wrap whole match in $1
- \[
- (
- (?:
- \[[^\]]*\] // allow brackets nested one level
- |
- [^\[] // or anything else
- )*
- )
- \]
-
- [ ]? // one optional space
- (?:\n[ ]*)? // one optional newline followed by spaces
-
- \[
- (.*?) // id = $3
- \]
- )
- ()()()() // pad remaining backreferences
- /g, writeAnchorTag);
- */
- text = text.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g, writeAnchorTag);
-
- //
- // Next, inline-style links: [link text](url "optional title")
- //
-
- /*
- text = text.replace(/
- ( // wrap whole match in $1
- \[
- (
- (?:
- \[[^\]]*\] // allow brackets nested one level
- |
- [^\[\]] // or anything else
- )*
- )
- \]
- \( // literal paren
- [ \t]*
- () // no id, so leave $3 empty
- ( // href = $4
- (?:
- \([^)]*\) // allow one level of (correctly nested) parens (think MSDN)
- |
- [^()\s]
- )*?
- )>?
- [ \t]*
- ( // $5
- (['"]) // quote char = $6
- (.*?) // Title = $7
- \6 // matching quote
- [ \t]* // ignore any spaces/tabs between closing quote and )
- )? // title is optional
- \)
- )
- /g, writeAnchorTag);
- */
-
- text = text.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()((?:\([^)]*\)|[^()\s])*?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g, writeAnchorTag);
-
- //
- // Last, handle reference-style shortcuts: [link text]
- // These must come last in case you've also got [link test][1]
- // or [link test](/foo)
- //
-
- /*
- text = text.replace(/
- ( // wrap whole match in $1
- \[
- ([^\[\]]+) // link text = $2; can't contain '[' or ']'
- \]
- )
- ()()()()() // pad rest of backreferences
- /g, writeAnchorTag);
- */
- text = text.replace(/(\[([^\[\]]+)\])()()()()()/g, writeAnchorTag);
-
- return text;
- }
-
- function writeAnchorTag(wholeMatch, m1, m2, m3, m4, m5, m6, m7) {
- if (m7 == undefined) m7 = "";
- var whole_match = m1;
- var link_text = m2.replace(/:\/\//g, "~P"); // to prevent auto-linking withing the link. will be converted back after the auto-linker runs
- var link_id = m3.toLowerCase();
- var url = m4;
- var title = m7;
-
- if (url == "") {
- if (link_id == "") {
- // lower-case and turn embedded newlines into spaces
- link_id = link_text.toLowerCase().replace(/ ?\n/g, " ");
- }
- url = "#" + link_id;
-
- if (g_urls.get(link_id) != undefined) {
- url = g_urls.get(link_id);
- if (g_titles.get(link_id) != undefined) {
- title = g_titles.get(link_id);
- }
- }
- else {
- if (whole_match.search(/\(\s*\)$/m) > -1) {
- // Special case for explicit empty url
- url = "";
- } else {
- return whole_match;
- }
- }
- }
- url = encodeProblemUrlChars(url);
- url = escapeCharacters(url, "*_");
- var result = "" + link_text + "";
-
- return result;
- }
-
- function _DoImages(text) {
- //
- // Turn Markdown image shortcuts into tags.
- //
-
- //
- // First, handle reference-style labeled images: ![alt text][id]
- //
-
- /*
- text = text.replace(/
- ( // wrap whole match in $1
- !\[
- (.*?) // alt text = $2
- \]
-
- [ ]? // one optional space
- (?:\n[ ]*)? // one optional newline followed by spaces
-
- \[
- (.*?) // id = $3
- \]
- )
- ()()()() // pad rest of backreferences
- /g, writeImageTag);
- */
- text = text.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g, writeImageTag);
-
- //
- // Next, handle inline images: 
- // Don't forget: encode * and _
-
- /*
- text = text.replace(/
- ( // wrap whole match in $1
- !\[
- (.*?) // alt text = $2
- \]
- \s? // One optional whitespace character
- \( // literal paren
- [ \t]*
- () // no id, so leave $3 empty
- (\S+?)>? // src url = $4
- [ \t]*
- ( // $5
- (['"]) // quote char = $6
- (.*?) // title = $7
- \6 // matching quote
- [ \t]*
- )? // title is optional
- \)
- )
- /g, writeImageTag);
- */
- text = text.replace(/(!\[(.*?)\]\s?\([ \t]*()(\S+?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g, writeImageTag);
-
- return text;
- }
-
- function attributeEncode(text) {
- // unconditionally replace angle brackets here -- what ends up in an attribute (e.g. alt or title)
- // never makes sense to have verbatim HTML in it (and the sanitizer would totally break it)
- return text.replace(/>/g, ">").replace(/";
-
- return result;
- }
-
- function _DoHeaders(text) {
-
- // Setext-style headers:
- // Header 1
- // ========
- //
- // Header 2
- // --------
- //
- text = text.replace(/^(.+)[ \t]*\n=+[ \t]*\n+/gm,
- function (wholeMatch, m1) { return "
" + _RunSpanGamut(m1) + "
\n\n"; }
- );
-
- text = text.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm,
- function (matchFound, m1) { return "" + _RunSpanGamut(m1) + "
\n\n"; }
- );
-
- // atx-style headers:
- // # Header 1
- // ## Header 2
- // ## Header 2 with closing hashes ##
- // ...
- // ###### Header 6
- //
-
- /*
- text = text.replace(/
- ^(\#{1,6}) // $1 = string of #'s
- [ \t]*
- (.+?) // $2 = Header text
- [ \t]*
- \#* // optional closing #'s (not counted)
- \n+
- /gm, function() {...});
- */
-
- text = text.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm,
- function (wholeMatch, m1, m2) {
- var h_level = m1.length;
- return "` blocks.
- //
-
- /*
- text = text.replace(/
- (?:\n\n|^)
- ( // $1 = the code block -- one or more lines, starting with a space/tab
- (?:
- (?:[ ]{4}|\t) // Lines must start with a tab or a tab-width of spaces - attacklab: g_tab_width
- .*\n+
- )+
- )
- (\n*[ ]{0,3}[^ \t\n]|(?=~0)) // attacklab: g_tab_width
- /g ,function(){...});
- */
-
- // attacklab: sentinel workarounds for lack of \A and \Z, safari\khtml bug
- text += "~0";
-
- text = text.replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g,
- function (wholeMatch, m1, m2) {
- var codeblock = m1;
- var nextChar = m2;
-
- codeblock = _EncodeCode(_Outdent(codeblock));
- codeblock = _Detab(codeblock);
- codeblock = codeblock.replace(/^\n+/g, ""); // trim leading newlines
- codeblock = codeblock.replace(/\n+$/g, ""); // trim trailing whitespace
-
- codeblock = "
";
-
- return "\n\n" + codeblock + "\n\n" + nextChar;
- }
- );
-
- // attacklab: strip sentinel
- text = text.replace(/~0/, "");
-
- return text;
- }
-
- function hashBlock(text) {
- text = text.replace(/(^\n+|\n+$)/g, "");
- return "\n\n~K" + (g_html_blocks.push(text) - 1) + "K\n\n";
- }
-
- function _DoCodeSpans(text) {
- //
- // * Backtick quotes are used for " + codeblock + "\n spans.
- //
- // * You can use multiple backticks as the delimiters if you want to
- // include literal backticks in the code span. So, this input:
- //
- // Just type ``foo `bar` baz`` at the prompt.
- //
- // Will translate to:
- //
- // foo `bar` baz at the prompt.`bar` ...
- //
-
- /*
- text = text.replace(/
- (^|[^\\]) // Character before opening ` can't be a backslash
- (`+) // $2 = Opening run of `
- ( // $3 = The code block
- [^\r]*?
- [^`] // attacklab: work around lack of lookbehind
- )
- \2 // Matching closer
- (?!`)
- /gm, function(){...});
- */
-
- text = text.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,
- function (wholeMatch, m1, m2, m3, m4) {
- var c = m3;
- c = c.replace(/^([ \t]*)/g, ""); // leading whitespace
- c = c.replace(/[ \t]*$/g, ""); // trailing whitespace
- c = _EncodeCode(c);
- c = c.replace(/:\/\//g, "~P"); // to prevent auto-linking. Not necessary in code *blocks*, but in code spans. Will be converted back after the auto-linker runs.
- return m1 + "" + c + "";
- }
- );
-
- return text;
- }
-
- function _DoCodeSpansGollum(text) {
- //
- // Gollum wraps code in one pre. Use ` to mark code pre.
- // Gollum requires exactly three starting and ending `.
- //
- text = text.replace(/(^|[^\\])(`{3})([^\r]*?[^`])\2(?!`)/gm,
- function (wholeMatch, m1, m2, m3, m4) {
- var c = m3;
- c = c.replace(/^([ \t]*)/g, ""); // leading whitespace
- c = c.replace(/[ \t]*$/g, ""); // trailing whitespace
- c = _EncodeCode(c);
- // Set to use 'm' multiline option.
- c = c.replace(/:\/\//gm, "~P"); // to prevent auto-linking. Not necessary in code *blocks*, but in code spans. Will be converted back after the auto-linker runs.
- return m1 + hashBlock("`" + c + "
");
- }
- );
-
- return text;
- }
-
- function _EncodeCode(text) {
- //
- // Encode/escape certain characters inside Markdown code runs.
- // The point is that in code, these characters are literals,
- // and lose their special Markdown meanings.
- //
- // Encode all ampersands; HTML entities are not
- // entities within a Markdown code span.
- text = text.replace(/&/g, "&");
-
- // Do the angle bracket song and dance:
- text = text.replace(//g, ">");
-
- // Now, escape characters that are magic in Markdown:
- text = escapeCharacters(text, "\*_{}[]\\", false);
-
- // jj the line above breaks this:
- //---
-
- //* Item
-
- // 1. Subitem
-
- // special char: *
- //---
-
- return text;
- }
-
- function _DoItalicsAndBold(text) {
-
- // must go first:
- text = text.replace(/([\W_]|^)(\*\*|__)(?=\S)([^\r]*?\S[\*_]*)\2([\W_]|$)/g,
- "$1$3$4");
-
- text = text.replace(/([\W_]|^)(\*|_)(?=\S)([^\r\*_]*?\S)\2([\W_]|$)/g,
- "$1$3$4");
-
- return text;
- }
-
- function _DoBlockQuotes(text) {
-
- /*
- text = text.replace(/
- ( // Wrap whole match in $1
- (
- ^[ \t]*>[ \t]? // '>' at the start of a line
- .+\n // rest of the first line
- (.+\n)* // subsequent consecutive lines
- \n* // blanks
- )+
- )
- /gm, function(){...});
- */
-
- text = text.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm,
- function (wholeMatch, m1) {
- var bq = m1;
-
- // attacklab: hack around Konqueror 3.5.4 bug:
- // "----------bug".replace(/^-/g,"") == "bug"
-
- bq = bq.replace(/^[ \t]*>[ \t]?/gm, "~0"); // trim one level of quoting
-
- // attacklab: clean up hack
- bq = bq.replace(/~0/g, "");
-
- bq = bq.replace(/^[ \t]+$/gm, ""); // trim whitespace-only lines
- bq = _RunBlockGamut(bq); // recurse
-
- bq = bq.replace(/(^|\n)/g, "$1 ");
- // These leading spaces screw with content, so we need to fix that:
- bq = bq.replace(
- /(\s*
[^\r]+?<\/pre>)/gm,
- function (wholeMatch, m1) {
- var pre = m1;
- // attacklab: hack around Konqueror 3.5.4 bug:
- pre = pre.replace(/^ /mg, "~0");
- pre = pre.replace(/~0/g, "");
- return pre;
- });
-
- return hashBlock("\n" + bq + "\n
");
- }
- );
- return text;
- }
-
- function _FormParagraphs(text, doNotUnhash) {
- //
- // Params:
- // $text - string to process with html ]*")?(\stitle="[^"<>]*")?\s?\/?>)$/i;
-
- function sanitizeTag(tag) {
- if (tag.match(basic_tag_whitelist) || tag.match(a_white) || tag.match(img_white))
- return tag;
- else
- return "";
- }
-
- ///
";
- var match;
- var tagpaired = [];
- var tagremove = [];
- var needsRemoval = false;
-
- // loop through matched tags in forward order
- for (var ctag = 0; ctag < tagcount; ctag++) {
- tagname = tags[ctag].replace(/<\/?(\w+).*/, "$1");
- // skip any already paired tags
- // and skip tags in our ignore list; assume they're self-closed
- if (tagpaired[ctag] || ignoredtags.search("<" + tagname + ">") > -1)
- continue;
-
- tag = tags[ctag];
- match = -1;
-
- if (!/^<\//.test(tag)) {
- // this is an opening tag
- // search forwards (next tags), look for closing tags
- for (var ntag = ctag + 1; ntag < tagcount; ntag++) {
- if (!tagpaired[ntag] && tags[ntag] == "" + tagname + ">") {
- match = ntag;
- break;
- }
- }
- }
-
- if (match == -1)
- needsRemoval = tagremove[ctag] = true; // mark for removal
- else
- tagpaired[match] = true; // mark paired
- }
-
- if (!needsRemoval)
- return html;
-
- // delete all orphaned tags from the string
-
- var ctag = 0;
- html = html.replace(re, function (match) {
- var res = tagremove[ctag] ? "" : match;
- ctag++;
- return res;
- });
- return html;
- }
-})();
diff --git a/lib/gollum/frontend/public/gollum/livepreview/js/sundown/sundown_o2.js b/lib/gollum/frontend/public/gollum/livepreview/js/sundown/sundown_o2.js
new file mode 100644
index 00000000..cf107401
--- /dev/null
+++ b/lib/gollum/frontend/public/gollum/livepreview/js/sundown/sundown_o2.js
@@ -0,0 +1 @@
+function c(b){throw b}var aa=void 0,m=!0,n=null,p=!1;try{this.Module=Module}catch(ca){this.Module=Module={}}var da="object"===typeof process,fa="object"===typeof window,ha="function"===typeof importScripts,ia=!fa&&!da&&!ha;if(da){Module.print=(function(b){process.stdout.write(b+"\n")});Module.printErr=(function(b){process.stderr.write(b+"\n")});var ja=require("fs"),ma=require("path");Module.read=(function(b){var b=ma.normalize(b),e=ja.readFileSync(b).toString();!e&&b!=ma.resolve(b)&&(b=path.join(__dirname,"..","src",b),e=ja.readFileSync(b).toString());return e});Module.load=(function(b){na(read(b))});Module.arguments||(Module.arguments=process.argv.slice(2))}else{ia?(Module.print=print,Module.printErr=printErr,Module.read="undefined"!=typeof read?read:(function(b){snarf(b)}),Module.arguments||("undefined"!=typeof scriptArgs?Module.arguments=scriptArgs:"undefined"!=typeof arguments&&(Module.arguments=arguments))):fa?(Module.print||(Module.print=(function(b){console.log(b)})),Module.printErr||(Module.printErr=(function(b){console.log(b)})),Module.read=(function(b){var e=new XMLHttpRequest;e.open("GET",b,p);e.send(n);return e.responseText}),Module.arguments||"undefined"!=typeof arguments&&(Module.arguments=arguments)):ha?Module.load=importScripts:c("Unknown runtime environment. Where are we?")}function na(b){eval.call(n,b)}"undefined"==!Module.load&&Module.read&&(Module.load=(function(b){na(Module.read(b))}));Module.printErr||(Module.printErr=(function(){}));Module.print||(Module.print=Module.printErr);Module.arguments||(Module.arguments=[]);Module.print=Module.print;Module.qc=Module.printErr;Module.preRun||(Module.preRun=[]);Module.postRun||(Module.postRun=[]);function qa(b){if(1==ra){return 1}var e={"%i1":1,"%i8":1,"%i16":2,"%i32":4,"%i64":8,"%float":4,"%double":8}["%"+b];e||("*"==b[b.length-1]?e=ra:"i"==b[0]&&(b=parseInt(b.substr(1)),va(0==b%8),e=b/8));return e}function wa(b){var e=s;s+=b;s=s+3>>2<<2;return e}function xa(b){var e=Ca;Ca+=b;Ca=Ca+3>>2<<2;if(Ca>=Da){for(;Da<=Ca;){Da=2*Da+4095>>12<<12}var b=u,a=new ArrayBuffer(Da);u=new Int8Array(a);Ea=new Int16Array(a);v=new Int32Array(a);z=new Uint8Array(a);Fa=new Uint16Array(a);B=new Uint32Array(a);Oa=new Float32Array(a);Qa=new Float64Array(a);u.set(b)}return e}var ra=4,Ra={},Ya;function Za(b){Module.print(b+":\n"+Error().stack);c("Assertion: "+b)}function va(b,e){b||Za("Assertion failed: "+e)}var $a=this;function ab(b,e,a,d){function f(a,b){if("string"==b){if(a===n||a===aa||0===a){return 0}g||(g=s);var d=wa(a.length+1);bb(a,d);return d}return"array"==b?(g||(g=s),d=wa(a.length),cb(a,d),d):a}var g=0;try{var h=eval("_"+b)}catch(i){try{h=$a.Module["_"+b]}catch(j){}}va(h,"Cannot call unknown function "+b+" (perhaps LLVM optimizations or closure removed it?)");var k=0,b=d?d.map((function(b){return f(b,a[k++])})):[],e=(function(a,b){if("string"==b){return db(a)}va("array"!=b);return a})(h.apply(n,b),e);g&&(s=g);return e}Module.ccall=ab;Module.cwrap=(function(b,e,a){return(function(){return ab(b,e,a,Array.prototype.slice.call(arguments))})});function fb(b,e,a){a=a||"i8";"*"===a[a.length-1]&&(a="i32");switch(a){case"i1":u[b]=e;break;case"i8":u[b]=e;break;case"i16":Ea[b>>1]=e;break;case"i32":v[b>>2]=e;break;case"i64":v[b>>2]=e;break;case"float":Oa[b>>2]=e;break;case"double":gb[0]=e;v[b>>2]=nb[0];v[b+4>>2]=nb[1];break;default:Za("invalid type for setValue: "+a)}}Module.setValue=fb;Module.getValue=(function(b,e){e=e||"i8";"*"===e[e.length-1]&&(e="i32");switch(e){case"i1":return u[b];case"i8":return u[b];case"i16":return Ea[b>>1];case"i32":return v[b>>2];case"i64":return v[b>>2];case"float":return Oa[b>>2];case"double":return nb[0]=v[b>>2],nb[1]=v[b+4>>2],gb[0];default:Za("invalid type for setValue: "+e)}return n});var C=2;Module.ALLOC_NORMAL=0;Module.ALLOC_STACK=1;Module.ALLOC_STATIC=C;function F(b,e,a){var d,f;"number"===typeof b?(d=m,f=b):(d=p,f=b.length);var g="string"===typeof e?e:n,a=[ob,wa,xa][a===aa?C:a](Math.max(f,g?1:e.length));if(d){return pb(a,f),a}d=0;for(var h;d>>0?l=0:(rd(b,e,a,t,q,v[g>>2],4),l=l+1|0)}}while(0);return l}qd.X=1;function rd(b,e,a,d,f,g,h){var i,j,k=s;s+=16;j=(e+40|0)>>2;var l=0==(v[j]|0);do{if(!l){var o=e+36|0;if(0!=(v[o>>2]|0)){var t=P(e,1);i=0==(d|0)?0:124==u[a]<<24>>24&1;var q=0!=(f|0)&i>>>0
>>16&2,x=14-(q|o|w)+(r<
>>0)){break}v[i>>2]=g+t|0;xe(v[W+24>>2],v[W+12>>2]+t|0);break b}i=v[e+2];e=i>>2}q>>>0>2]>>>0&&(v[W+16>>2]=q);h=q+t|0;for(e=W+444|0;0!=(e|0);){i=e|0;if((v[i>>2]|0)==(h|0)){if(0!=(v[e+12>>2]&8|0)){break}v[i>>2]=q;var w=e+4|0;v[w>>2]=v[w>>2]+t|0;w=ye(q,h,b);a=51;break a}e=v[e+8>>2]}ze(q,t)}}while(0);r=B[W+12>>2];r>>>0>b>>>0?(w=r-b|0,v[W+12>>2]=w,d=r=B[W+24>>2],v[W+24>>2]=d+b|0,v[b+(d+4)>>2]=w|1,v[r+4>>2]=b|3,w=r+8|0,a=51):a=50}}while(0);50==a&&(v[Ae>>2]=12,w=0);return w}se.X=1;function Be(b){var e;0==(v[te>>2]|0)&&ue();var a=4294967232>b>>>0;a:do{if(a){var d=B[W+24>>2];if(0!=(d|0)){var f=B[W+12>>2],g=f>>>0>(b+40|0)>>>0;do{if(g){var h=B[te+8>>2],i=(Math.floor(((-40-b-1+f+h|0)>>>0)/(h>>>0))-1)*h|0,j=ve(d);if(0==(v[j+12>>2]&8|0)){var k=we(0);e=(j+4|0)>>2;if((k|0)==(v[j>>2]+v[e]|0)&&(i=we(-(2147483646>>0?-2147483648-h|0:i)|0),h=we(0),-1!=(i|0)&h>>>0
>>0?(v[d]=g|i&1|2,v[b+(g-4)>>2]=q|3,v[a]|=1,q=b+g|0):q=0,r=f,f=18)}do{if(18==f&&0!=(r|0)){0!=(q|0)&&Nc(q);h=r+8|0;break a}}while(0);f=ob(e);if(0==(f|0)){h=0;break a}d=j-(0==(v[d]&3|0)?8:4)|0;td(f,b,d>>>0
x&&-4<=x?(i=(103==i?"f":"F").charCodeAt(0),w-=x+1):(i=(103==i?"e":"E").charCodeAt(0),w--),x=Math.min(w,20)}if(101==i||69==i){y=h.toExponential(x),/[eE][-+]\d$/.test(y)&&(y=y.slice(0,-1)+"0"+y.slice(-1))}else{if(102==i||70==i){y=h.toFixed(x)}}j=y.split("e");if(r&&!o){for(;1
i&&(y=y.toUpperCase());y.split("").forEach((function(a){g.push(a.charCodeAt(0))}))}else{if(115==i){k=a("i8*")||0;t=sc(k);r&&(t=Math.min(sc(k),w));if(!l){for(;t