소스 검색

refactor(hr): speed up hr parsing

speed up horizontal rule parsing by simplifying the regex
Estevao Soares dos Santos 8 년 전
부모
커밋
0a856d5394
5개의 변경된 파일8개의 추가작업 그리고 8개의 파일을 삭제
  1. 4 4
      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. 3 3
      src/subParsers/blockGamut.js

+ 4 - 4
dist/showdown.js

@@ -1,4 +1,4 @@
-;/*! showdown 01-12-2016 */
+;/*! showdown 17-12-2016 */
 (function(){
 /**
  * Created by Tivie on 13-07-2015.
@@ -1249,9 +1249,9 @@ showdown.subParser('blockGamut', function (text, options, globals) {
 
   // Do Horizontal Rules:
   var key = showdown.subParser('hashBlock')('<hr />', options, globals);
-  text = text.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm, key);
-  text = text.replace(/^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$/gm, key);
-  text = text.replace(/^[ ]{0,2}([ ]?_[ ]?){3,}[ \t]*$/gm, key);
+  text = text.replace(/^ {0,2}( ?\* ?){3,}[ \t]*$/gm, key);
+  text = text.replace(/^ {0,2}( ?- ?){3,}[ \t]*$/gm, key);
+  text = text.replace(/^ {0,2}( ?_ ?){3,}[ \t]*$/gm, key);
 
   text = showdown.subParser('lists')(text, options, globals);
   text = showdown.subParser('codeBlocks')(text, options, globals);

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
dist/showdown.js.map


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 1
dist/showdown.min.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
dist/showdown.min.js.map


+ 3 - 3
src/subParsers/blockGamut.js

@@ -14,9 +14,9 @@ showdown.subParser('blockGamut', function (text, options, globals) {
 
   // Do Horizontal Rules:
   var key = showdown.subParser('hashBlock')('<hr />', options, globals);
-  text = text.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm, key);
-  text = text.replace(/^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$/gm, key);
-  text = text.replace(/^[ ]{0,2}([ ]?_[ ]?){3,}[ \t]*$/gm, key);
+  text = text.replace(/^ {0,2}( ?\* ?){3,}[ \t]*$/gm, key);
+  text = text.replace(/^ {0,2}( ?- ?){3,}[ \t]*$/gm, key);
+  text = text.replace(/^ {0,2}( ?_ ?){3,}[ \t]*$/gm, key);
 
   text = showdown.subParser('lists')(text, options, globals);
   text = showdown.subParser('codeBlocks')(text, options, globals);

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.