Jelajahi Sumber

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 tahun lalu
induk
melakukan
f7a429e8db

+ 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 ditekan karena terlalu besar
+ 0 - 0
dist/showdown.js.map


File diff ditekan karena terlalu besar
+ 1 - 1
dist/showdown.min.js


File diff ditekan karena terlalu besar
+ 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;
 

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini