From 7cc96bdac5f73ee9eb0b67d9278ad5f43c59b5bf Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Tue, 20 Jan 2015 17:29:59 -0500 Subject: [PATCH] FIX: v8 issue with regexp --- vendor/assets/javascripts/better_markdown.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vendor/assets/javascripts/better_markdown.js b/vendor/assets/javascripts/better_markdown.js index f01451ec2..7a9e74b8c 100644 --- a/vendor/assets/javascripts/better_markdown.js +++ b/vendor/assets/javascripts/better_markdown.js @@ -825,7 +825,6 @@ // TODO: Cache this regexp for certain depths. // Create a regexp suitable for matching an li for a given stack depth function regex_for_depth( depth ) { - return new RegExp( // m[1] = indent, m[2] = list_type "(?:^(" + indent_re + "{0," + depth + "} {0,3})(" + any_list + ")\\s+)|" + @@ -871,8 +870,11 @@ replace = new RegExp("^" + indent_re + "{" + depth + "}", "gm"), ret = []; + while ( blocks.length > 0 ) { - if ( re.exec( blocks[0] ) ) { + // HACK: Fixes a v8 issue + test = blocks[0].replace(/^ {8,}/, ' '); + if ( re.exec( test ) ) { var b = blocks.shift(), // Now remove that indent x = b.replace( replace, "");