Browse Source

fix(paragraph): workaround QML bug

QML has a bug that changes the behavior or String.search().
This prevents blocks from being correctly unhashified.
This commit works around that bug, using RegExp.test
instead of String.search.
Credits to @qyvlik

Closes #246, Closes #338
Estevao Soares dos Santos 8 years ago
parent
commit
f7a429e8db
5 changed files with 6 additions and 4 deletions
  1. 3 2
      dist/showdown.js
  2. 0 0
      dist/showdown.js.map
  3. 1 1
      dist/showdown.min.js
  4. 0 0
      dist/showdown.min.js.map
  5. 2 1
      src/subParsers/paragraphs.js

+ 3 - 2
dist/showdown.js

@@ -1,4 +1,4 @@
-;/*! showdown 31-01-2017 */
+;/*! showdown 05-02-2017 */
 (function(){
 /**
  * Created by Tivie on 13-07-2015.
@@ -2375,7 +2375,8 @@ 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) {
+    // use RegExp.test instead of string.search because of QML bug
+    while (/¨(K|G)(\d+)\1/.test(grafsOutIt)) {
       var delim = RegExp.$1,
           num   = RegExp.$2;
 

File diff suppressed because it is too large
+ 0 - 0
dist/showdown.js.map


File diff suppressed because it is too large
+ 1 - 1
dist/showdown.min.js


File diff suppressed because it is too large
+ 0 - 0
dist/showdown.min.js.map


+ 2 - 1
src/subParsers/paragraphs.js

@@ -36,7 +36,8 @@ 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) {
+    // use RegExp.test instead of string.search because of QML bug
+    while (/¨(K|G)(\d+)\1/.test(grafsOutIt)) {
       var delim = RegExp.$1,
           num   = RegExp.$2;
 

Some files were not shown because too many files changed in this diff