From 10fb1cf45113d51c04b743c45940dc42c64518b0 Mon Sep 17 00:00:00 2001 From: Estevao Soares dos Santos Date: Sun, 29 Jan 2017 00:07:19 +0000 Subject: [PATCH] =?UTF-8?q?refactor:=20use=20=C2=A8=20instead=20of=20~=20a?= =?UTF-8?q?s=20escape=20character?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/showdown.js | Bin 78006 -> 78024 bytes dist/showdown.js.map | Bin 228525 -> 228451 bytes dist/showdown.min.js | Bin 32171 -> 32226 bytes dist/showdown.min.js.map | Bin 34829 -> 34829 bytes src/converter.js | 15 ++++++------- src/helpers.js | 2 +- src/subParsers/blockQuotes.js | 8 +++---- src/subParsers/codeBlocks.js | 6 ++--- src/subParsers/detab.js | 8 +++---- src/subParsers/githubCodeBlocks.js | 6 ++--- src/subParsers/hashBlock.js | 2 +- src/subParsers/hashElement.js | 4 ++-- src/subParsers/hashHTMLBlocks.js | 4 ++-- src/subParsers/hashHTMLSpans.js | 4 ++-- src/subParsers/hashPreCodeTags.js | 2 +- src/subParsers/headers.js | 10 ++++----- src/subParsers/lists.js | 30 ++++++++++++------------- src/subParsers/outdent.js | 4 ++-- src/subParsers/paragraphs.js | 6 ++--- src/subParsers/strikethrough.js | 2 +- src/subParsers/stripLinkDefinitions.js | 6 ++--- src/subParsers/tables.js | 2 +- src/subParsers/unescapeSpecialChars.js | 2 +- 23 files changed, 61 insertions(+), 62 deletions(-) diff --git a/dist/showdown.js b/dist/showdown.js index ef48514910b40182c1aeb92db2eed843b9dfc885..44b03346f67a7244076c95937226c98505befaba 100644 GIT binary patch delta 727 zcmX|8Ur19?80Tzvn_icW{*5hX$IQ0tYAYkituQ4af;}vaf;LHXxY4H7U5)-&uMzlA zC%ZJnffd{oBDt_zG8tV$CO++9L9v7()KfDP3!D#~?=rev_?`28-|zQ*=li8gOs>S3 zyzaJU%!fx4L!*fi+}<%~(t9xe>FnlwDPk zBJor!6x1d!8x`@W8U|&u@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d|_y?9TT{!>% diff --git a/dist/showdown.min.js b/dist/showdown.min.js index 1ce09ffb1fa4e39b4a541ae2d1227145d6645f14..03e74462e2bb673fe8b3827c6d58ac741fbab772 100644 GIT binary patch delta 653 zcmZ4eoAJ?aMt*%QMTO#w{PL9i@;n72%Z>bU!c2!&Y}ON=A)|O`g?_q@(xDY0N}4)} zwuyR0sRcQS$*CIpF)9#=%}?|bnScshKwK3SbY(!DP<1Ir+xbKftuO$pNV82t7<6dG zWIe}MP?==gWE2@~r;k9VOqO+aWd~~2)YMO(yis3dbB(hGBS=7BM@eb2V3hRae@@(+ zFSz_3y@bc z`9h}j-kU1OsPkcKlkTR>D}?nxlE**mY3MM$&Ss8%C7rZ^@z z78tM^_EvS9UlesQN&+1Wil$uaqSTVoqCAB}ZCfRfmvklnPPtKCdqh6nUYa z$RuCq0uoYDQPR{&v`y42N-fAqOitC%uL}Vy-JET-olm&V04SYin}#Gk+1&A!7+5^n zHW^9WKtFx*fnt%#3xZiDzl-9U9PM<5v2L=avn$ZT0%u1?);a@y9i_?o#WIsQow+yP zbNR_AQ|DOcgkisvhMu;)X5HlPZV^BO0^KE9>YSiv^X0KkmMZ1jJl%aKGtk%|?*K-i z5~&ca$>)6JfUI{ui-4qUfcWI@K)%V_eb+#En``{`0~Kzz4KM|%2g+~m4zvd`&jc+1 zl6k?afU;5{R*b?B-z#Y%d2DiKsPg8%&^BHUps%gV5{ncjKTHk+YAZ}O0+LIU`+%BF zQ_h0SV@dnN3HDNsZMyyBH}+DKRnkp>;!){RK(Z{|0H}0Dx)BqQb0^aoNGfLS0FzFW zWwX7If~Ye)2NKAraRUqFpZ467b#g8Mwf@W50wlNOo&=g)pV!GE5~5jcRI3pkQydc< z3k*jMd#k#T%~Hi(j3RXgnwt9QxzuqtRw}3uiU%N@qt$17{siN9UZ)Q{x2Xcr2V89krcwGMyZq^CmlF L%WOVZW6uo$*<%q9 delta 55 zcmeC3z|=c|X@i>uqseA>3uiU%a%V@!N@pEUN9U}~Q{x2Xc+!Cana([ \t]?/gm, '~0'); // trim one level of quoting + bq = bq.replace(/^[ \t]*>[ \t]?/gm, '¨0'); // trim one level of quoting // attacklab: clean up hack - bq = bq.replace(/~0/g, ''); + bq = bq.replace(/¨0/g, ''); bq = bq.replace(/^[ \t]+$/gm, ''); // trim whitespace-only lines bq = showdown.subParser('githubCodeBlocks')(bq, options, globals); @@ -22,8 +22,8 @@ showdown.subParser('blockQuotes', function (text, options, globals) { 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, '');
+      pre = pre.replace(/^  /mg, '¨0');
+      pre = pre.replace(/¨0/g, '');
       return pre;
     });
 
diff --git a/src/subParsers/codeBlocks.js b/src/subParsers/codeBlocks.js
index ca6b606..8a13174 100644
--- a/src/subParsers/codeBlocks.js
+++ b/src/subParsers/codeBlocks.js
@@ -7,9 +7,9 @@ showdown.subParser('codeBlocks', function (text, options, globals) {
   text = globals.converter._dispatch('codeBlocks.before', text, options, globals);
 
   // sentinel workarounds for lack of \A and \Z, safari\khtml bug
-  text += '~0';
+  text += '¨0';
 
-  var pattern = /(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g;
+  var pattern = /(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g;
   text = text.replace(pattern, function (wholeMatch, m1, m2) {
     var codeblock = m1,
         nextChar = m2,
@@ -31,7 +31,7 @@ showdown.subParser('codeBlocks', function (text, options, globals) {
   });
 
   // strip sentinel
-  text = text.replace(/~0/, '');
+  text = text.replace(/¨0/, '');
 
   text = globals.converter._dispatch('codeBlocks.after', text, options, globals);
   return text;
diff --git a/src/subParsers/detab.js b/src/subParsers/detab.js
index b3c6d65..77eed44 100644
--- a/src/subParsers/detab.js
+++ b/src/subParsers/detab.js
@@ -8,10 +8,10 @@ showdown.subParser('detab', function (text) {
   text = text.replace(/\t(?=\t)/g, '    '); // g_tab_width
 
   // replace the nth with two sentinels
-  text = text.replace(/\t/g, '~A~B');
+  text = text.replace(/\t/g, '¨A¨B');
 
   // use the sentinel to anchor our regex so it doesn't explode
-  text = text.replace(/~B(.+?)~A/g, function (wholeMatch, m1) {
+  text = text.replace(/¨B(.+?)¨A/g, function (wholeMatch, m1) {
     var leadingText = m1,
         numSpaces = 4 - leadingText.length % 4;  // g_tab_width
 
@@ -24,8 +24,8 @@ showdown.subParser('detab', function (text) {
   });
 
   // clean up sentinels
-  text = text.replace(/~A/g, '    ');  // g_tab_width
-  text = text.replace(/~B/g, '');
+  text = text.replace(/¨A/g, '    ');  // g_tab_width
+  text = text.replace(/¨B/g, '');
 
   return text;
 
diff --git a/src/subParsers/githubCodeBlocks.js b/src/subParsers/githubCodeBlocks.js
index 877096c..0a88a4e 100644
--- a/src/subParsers/githubCodeBlocks.js
+++ b/src/subParsers/githubCodeBlocks.js
@@ -18,7 +18,7 @@ showdown.subParser('githubCodeBlocks', function (text, options, globals) {
 
   text = globals.converter._dispatch('githubCodeBlocks.before', text, options, globals);
 
-  text += '~0';
+  text += '¨0';
 
   text = text.replace(/(?:^|\n)```(.*)\n([\s\S]*?)\n```/g, function (wholeMatch, language, codeblock) {
     var end = (options.omitExtraWLInCodeBlocks) ? '' : '\n';
@@ -36,11 +36,11 @@ showdown.subParser('githubCodeBlocks', function (text, options, globals) {
     // Since GHCodeblocks can be false positives, we need to
     // store the primitive text and the parsed text in a global var,
     // and then return a token
-    return '\n\n~G' + (globals.ghCodeBlocks.push({text: wholeMatch, codeblock: codeblock}) - 1) + 'G\n\n';
+    return '\n\n¨G' + (globals.ghCodeBlocks.push({text: wholeMatch, codeblock: codeblock}) - 1) + 'G\n\n';
   });
 
   // attacklab: strip sentinel
-  text = text.replace(/~0/, '');
+  text = text.replace(/¨0/, '');
 
   return globals.converter._dispatch('githubCodeBlocks.after', text, options, globals);
 });
diff --git a/src/subParsers/hashBlock.js b/src/subParsers/hashBlock.js
index 3196f1d..145ac66 100644
--- a/src/subParsers/hashBlock.js
+++ b/src/subParsers/hashBlock.js
@@ -1,5 +1,5 @@
 showdown.subParser('hashBlock', function (text, options, globals) {
   'use strict';
   text = text.replace(/(^\n+|\n+$)/g, '');
-  return '\n\n~K' + (globals.gHtmlBlocks.push(text) - 1) + 'K\n\n';
+  return '\n\n¨K' + (globals.gHtmlBlocks.push(text) - 1) + 'K\n\n';
 });
diff --git a/src/subParsers/hashElement.js b/src/subParsers/hashElement.js
index 7bf1291..80ad42d 100644
--- a/src/subParsers/hashElement.js
+++ b/src/subParsers/hashElement.js
@@ -11,8 +11,8 @@ showdown.subParser('hashElement', function (text, options, globals) {
     // strip trailing blank lines
     blockText = blockText.replace(/\n+$/g, '');
 
-    // Replace the element text with a marker ("~KxK" where x is its key)
-    blockText = '\n\n~K' + (globals.gHtmlBlocks.push(blockText) - 1) + 'K\n\n';
+    // Replace the element text with a marker ("¨KxK" where x is its key)
+    blockText = '\n\n¨K' + (globals.gHtmlBlocks.push(blockText) - 1) + 'K\n\n';
 
     return blockText;
   };
diff --git a/src/subParsers/hashHTMLBlocks.js b/src/subParsers/hashHTMLBlocks.js
index 442bb2e..fc674c5 100644
--- a/src/subParsers/hashHTMLBlocks.js
+++ b/src/subParsers/hashHTMLBlocks.js
@@ -44,7 +44,7 @@ showdown.subParser('hashHTMLBlocks', function (text, options, globals) {
       if (left.search(/\bmarkdown\b/) !== -1) {
         txt = left + globals.converter.makeHtml(match) + right;
       }
-      return '\n\n~K' + (globals.gHtmlBlocks.push(txt) - 1) + 'K\n\n';
+      return '\n\n¨K' + (globals.gHtmlBlocks.push(txt) - 1) + 'K\n\n';
     };
 
   for (var i = 0; i < blockTags.length; ++i) {
@@ -57,7 +57,7 @@ showdown.subParser('hashHTMLBlocks', function (text, options, globals) {
 
   // Special case for standalone HTML comments
   text = showdown.helper.replaceRecursiveRegExp(text, function (txt) {
-    return '\n\n~K' + (globals.gHtmlBlocks.push(txt) - 1) + 'K\n\n';
+    return '\n\n¨K' + (globals.gHtmlBlocks.push(txt) - 1) + 'K\n\n';
   }, '^ {0,3}', 'gm');
 
   // PHP and ASP-style processor instructions ( and <%...%>)
diff --git a/src/subParsers/hashHTMLSpans.js b/src/subParsers/hashHTMLSpans.js
index 0d4fb02..9ac71bb 100644
--- a/src/subParsers/hashHTMLSpans.js
+++ b/src/subParsers/hashHTMLSpans.js
@@ -7,7 +7,7 @@ showdown.subParser('hashHTMLSpans', function (text, config, globals) {
   var matches = showdown.helper.matchRecursiveRegExp(text, ']*>', '', 'gi');
 
   for (var i = 0; i < matches.length; ++i) {
-    text = text.replace(matches[i][0], '~C' + (globals.gHtmlSpans.push(matches[i][0]) - 1) + 'C');
+    text = text.replace(matches[i][0], '¨C' + (globals.gHtmlSpans.push(matches[i][0]) - 1) + 'C');
   }
   return text;
 });
@@ -19,7 +19,7 @@ showdown.subParser('unhashHTMLSpans', function (text, config, globals) {
   'use strict';
 
   for (var i = 0; i < globals.gHtmlSpans.length; ++i) {
-    text = text.replace('~C' + i + 'C', globals.gHtmlSpans[i]);
+    text = text.replace('¨C' + i + 'C', globals.gHtmlSpans[i]);
   }
 
   return text;
diff --git a/src/subParsers/hashPreCodeTags.js b/src/subParsers/hashPreCodeTags.js
index 5d5cd2a..07b4d3a 100644
--- a/src/subParsers/hashPreCodeTags.js
+++ b/src/subParsers/hashPreCodeTags.js
@@ -7,7 +7,7 @@ showdown.subParser('hashPreCodeTags', function (text, config, globals) {
   var repFunc = function (wholeMatch, match, left, right) {
     // encode html entities
     var codeblock = left + showdown.subParser('encodeCode')(match) + right;
-    return '\n\n~G' + (globals.ghCodeBlocks.push({text: wholeMatch, codeblock: codeblock}) - 1) + 'G\n\n';
+    return '\n\n¨G' + (globals.ghCodeBlocks.push({text: wholeMatch, codeblock: codeblock}) - 1) + 'G\n\n';
   };
 
   text = showdown.helper.replaceRecursiveRegExp(text, repFunc, '^ {0,3}]*>\\s*]*>', '^ {0,3}\\s*
', 'gim'); diff --git a/src/subParsers/headers.js b/src/subParsers/headers.js index 332e139..72eadcd 100644 --- a/src/subParsers/headers.js +++ b/src/subParsers/headers.js @@ -58,13 +58,13 @@ showdown.subParser('headers', function (text, options, globals) { if (ghHeaderId) { escapedId = m .replace(/ /g, '-') - //replace previously escaped chars (&, ~ and $) + // replace previously escaped chars (&, ¨ and $) .replace(/&/g, '') - .replace(/~T/g, '') - .replace(/~D/g, '') - //replace rest of the chars (&~$ are repeated as they might have been escaped) + .replace(/¨T/g, '') + .replace(/¨D/g, '') + // replace rest of the chars (&~$ are repeated as they might have been escaped) // borrowed from github's redcarpet (some they should produce similar results) - .replace(/[&+$,\/:;=?@"#{}|^~\[\]`\\*)(%.!'<>]/g, '') + .replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g, '') .toLowerCase(); } else { escapedId = m.replace(/[^\w]/g, '').toLowerCase(); diff --git a/src/subParsers/lists.js b/src/subParsers/lists.js index ee4f30b..baed74b 100644 --- a/src/subParsers/lists.js +++ b/src/subParsers/lists.js @@ -39,16 +39,16 @@ showdown.subParser('lists', function (text, options, globals) { listStr = listStr.replace(/\n{2,}$/, '\n'); // attacklab: add sentinel to emulate \z - listStr += '~0'; + listStr += '¨0'; - var rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(~0| {0,3}([*+-]|\d+[.])[ \t]+))/gm, - isParagraphed = (/\n[ \t]*\n(?!~0)/.test(listStr)); + var rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm, + isParagraphed = (/\n[ \t]*\n(?!¨0)/.test(listStr)); // Since version 1.5, nesting sublists requires 4 spaces (or 1 tab) indentation, // which is a syntax breaking change // activating this option reverts to old behavior if (options.disableForced4SpacesIndentedSublists) { - rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm; + rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm; } listStr = listStr.replace(rgx, function (wholeMatch, m1, m2, m3, m4, taskbtn, checked) { @@ -76,10 +76,10 @@ showdown.subParser('lists', function (text, options, globals) { //
  • a
// instead of: //
  • - - a
- // So, to prevent it, we will put a marker (~A)in the beginning of the line + // So, to prevent it, we will put a marker (¨A)in the beginning of the line // Kind of hackish/monkey patching, but seems more effective than overcomplicating the list parser item = item.replace(/^([-*+]|\d\.)[ \t]+[\S\n ]*/g, function (wm2) { - return '~A' + wm2; + return '¨A' + wm2; }); // m1 - Leading line or @@ -96,17 +96,17 @@ showdown.subParser('lists', function (text, options, globals) { // Colapse double linebreaks item = item.replace(/\n\n+/g, '\n\n'); // replace double linebreaks with a placeholder - item = item.replace(/\n\n/g, '~B'); + item = item.replace(/\n\n/g, '¨B'); if (isParagraphed) { item = showdown.subParser('paragraphs')(item, options, globals); } else { item = showdown.subParser('spanGamut')(item, options, globals); } - item = item.replace(/~B/g, '\n\n'); + item = item.replace(/¨B/g, '\n\n'); } - // now we need to remove the marker (~A) - item = item.replace('~A', ''); + // now we need to remove the marker (¨A) + item = item.replace('¨A', ''); // we can finally wrap the line in list item tags item = '' + item + '\n'; @@ -114,7 +114,7 @@ showdown.subParser('lists', function (text, options, globals) { }); // attacklab: strip sentinel - listStr = listStr.replace(/~0/g, ''); + listStr = listStr.replace(/¨0/g, ''); globals.gListLevel--; @@ -166,17 +166,17 @@ showdown.subParser('lists', function (text, options, globals) { // add sentinel to hack around khtml/safari bug: // http://bugs.webkit.org/show_bug.cgi?id=11231 - text += '~0'; + text += '¨0'; if (globals.gListLevel) { - text = text.replace(/^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm, + text = text.replace(/^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm, function (wholeMatch, list, m2) { var listType = (m2.search(/[*+-]/g) > -1) ? 'ul' : 'ol'; return parseConsecutiveLists(list, listType, true); } ); } else { - text = text.replace(/(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm, + text = text.replace(/(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm, function (wholeMatch, m1, list, m3) { var listType = (m3.search(/[*+-]/g) > -1) ? 'ul' : 'ol'; return parseConsecutiveLists(list, listType, false); @@ -185,7 +185,7 @@ showdown.subParser('lists', function (text, options, globals) { } // strip sentinel - text = text.replace(/~0/, ''); + text = text.replace(/¨0/, ''); text = globals.converter._dispatch('lists.after', text, options, globals); return text; }); diff --git a/src/subParsers/outdent.js b/src/subParsers/outdent.js index d27db2e..6d8799d 100644 --- a/src/subParsers/outdent.js +++ b/src/subParsers/outdent.js @@ -6,10 +6,10 @@ showdown.subParser('outdent', function (text) { // attacklab: hack around Konqueror 3.5.4 bug: // "----------bug".replace(/^-/g,"") == "bug" - text = text.replace(/^(\t|[ ]{1,4})/gm, '~0'); // attacklab: g_tab_width + text = text.replace(/^(\t|[ ]{1,4})/gm, '¨0'); // attacklab: g_tab_width // attacklab: clean up hack - text = text.replace(/~0/g, ''); + text = text.replace(/¨0/g, ''); return text; }); diff --git a/src/subParsers/paragraphs.js b/src/subParsers/paragraphs.js index 5ab37ea..a24344d 100644 --- a/src/subParsers/paragraphs.js +++ b/src/subParsers/paragraphs.js @@ -16,7 +16,7 @@ showdown.subParser('paragraphs', function (text, options, globals) { for (var i = 0; i < end; i++) { var str = grafs[i]; // if this is an HTML marker, copy it - if (str.search(/~(K|G)(\d+)\1/g) >= 0) { + if (str.search(/¨(K|G)(\d+)\1/g) >= 0) { grafsOut.push(str); } else { str = showdown.subParser('spanGamut')(str, options, globals); @@ -33,7 +33,7 @@ showdown.subParser('paragraphs', function (text, options, globals) { grafsOutIt = grafsOut[i], codeFlag = false; // if this is a marker for an html block... - while (grafsOutIt.search(/~(K|G)(\d+)\1/) >= 0) { + while (grafsOutIt.search(/¨(K|G)(\d+)\1/) >= 0) { var delim = RegExp.$1, num = RegExp.$2; @@ -50,7 +50,7 @@ showdown.subParser('paragraphs', function (text, options, globals) { } blockText = blockText.replace(/\$/g, '$$$$'); // Escape any dollar signs - grafsOutIt = grafsOutIt.replace(/(\n\n)?~(K|G)\d+\2(\n\n)?/, blockText); + grafsOutIt = grafsOutIt.replace(/(\n\n)?¨(K|G)\d+\2(\n\n)?/, blockText); // Check if grafsOutIt is a pre->code if (/^]*>\s*]*>/.test(grafsOutIt)) { codeFlag = true; diff --git a/src/subParsers/strikethrough.js b/src/subParsers/strikethrough.js index 789c01f..e7c8757 100644 --- a/src/subParsers/strikethrough.js +++ b/src/subParsers/strikethrough.js @@ -3,7 +3,7 @@ showdown.subParser('strikethrough', function (text, options, globals) { if (options.strikethrough) { text = globals.converter._dispatch('strikethrough.before', text, options, globals); - text = text.replace(/(?:~T){2}([\s\S]+?)(?:~T){2}/g, '$1'); + text = text.replace(/(?:~){2}([\s\S]+?)(?:~){2}/g, '$1'); text = globals.converter._dispatch('strikethrough.after', text, options, globals); } diff --git a/src/subParsers/stripLinkDefinitions.js b/src/subParsers/stripLinkDefinitions.js index 127cf69..a0da495 100644 --- a/src/subParsers/stripLinkDefinitions.js +++ b/src/subParsers/stripLinkDefinitions.js @@ -6,10 +6,10 @@ showdown.subParser('stripLinkDefinitions', function (text, options, globals) { 'use strict'; - var regex = /^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=~0))/gm; + var regex = /^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=¨0))/gm; // attacklab: sentinel workarounds for lack of \A and \Z, safari\khtml bug - text += '~0'; + text += '¨0'; text = text.replace(regex, function (wholeMatch, linkId, url, width, height, blankLines, title) { linkId = linkId.toLowerCase(); @@ -36,7 +36,7 @@ showdown.subParser('stripLinkDefinitions', function (text, options, globals) { }); // attacklab: strip sentinel - text = text.replace(/~0/, ''); + text = text.replace(/¨0/, ''); return text; }); diff --git a/src/subParsers/tables.js b/src/subParsers/tables.js index b705d08..c57b926 100644 --- a/src/subParsers/tables.js +++ b/src/subParsers/tables.js @@ -5,7 +5,7 @@ showdown.subParser('tables', function (text, options, globals) { return text; } - var tableRgx = /^ {0,3}\|?.+\|.+\n[ \t]{0,3}\|?[ \t]*:?[ \t]*(?:-|=){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:-|=){2,}[\s\S]+?(?:\n\n|~0)/gm; + var tableRgx = /^ {0,3}\|?.+\|.+\n[ \t]{0,3}\|?[ \t]*:?[ \t]*(?:-|=){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:-|=){2,}[\s\S]+?(?:\n\n|¨0)/gm; function parseStyles(sLine) { if (/^:[ \t]*--*$/.test(sLine)) { diff --git a/src/subParsers/unescapeSpecialChars.js b/src/subParsers/unescapeSpecialChars.js index 1873f43..dbb1618 100644 --- a/src/subParsers/unescapeSpecialChars.js +++ b/src/subParsers/unescapeSpecialChars.js @@ -4,7 +4,7 @@ showdown.subParser('unescapeSpecialChars', function (text) { 'use strict'; - text = text.replace(/~E(\d+)E/g, function (wholeMatch, m1) { + text = text.replace(/¨E(\d+)E/g, function (wholeMatch, m1) { var charCodeToReplace = parseInt(m1); return String.fromCharCode(charCodeToReplace); });