@@ -324,7 +324,7 @@ var Parser = (function () {
324
324
text = text . replace ( / < ( [ _ a - z 0 - 9 -\. \+ ] + @ [ ^ @ ] + \. [ a - z ] { 2 , } ) > / ig, "<a href=\"mailto:$1\">$1</a>" ) ;
325
325
326
326
// autolink url
327
- text = text . replace ( / ( ^ | [ ^ " ] ) ( ( h t t p | h t t p s | f t p | m a i l t o ) : [ _ a - z 0 - 9 -\. \/ % # @ \? \+ = ~ \| \, ] + ) ( $ | [ ^ " ] ) / ig, "$1<a href=\"$2\">$2</a>$4" ) ;
327
+ text = text . replace ( / ( ^ | [ ^ " ] ) ( ( h t t p | h t t p s | f t p | m a i l t o ) : [ _ a - z 0 - 9 -\. \/ % # @ \? \+ = ~ \| \, & \( \) ] + ) ( $ | [ ^ " ] ) / ig, "$1<a href=\"$2\">$2</a>$4" ) ;
328
328
329
329
text = this . call ( 'afterParseInlineBeforeRelease' , text ) ;
330
330
@@ -346,6 +346,8 @@ var Parser = (function () {
346
346
} , {
347
347
key : 'parseBlock' ,
348
348
value : function parseBlock ( text , lines ) {
349
+ var _this4 = this ;
350
+
349
351
this . blocks = [ ] ;
350
352
this . current = 'normal' ;
351
353
this . pos = - 1 ;
@@ -458,34 +460,28 @@ var Parser = (function () {
458
460
case / ^ ( (?: (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) ) | (?: (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) | (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) ) + ) $ / g. test ( line ) :
459
461
var tableMatches = / ^ ( (?: (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) ) | (?: (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) | (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) ) + ) $ / g. exec ( line ) ;
460
462
if ( this . isBlock ( 'normal' ) ) {
461
- var block = this . getBlock ( ) ;
462
- var head = false ;
463
-
464
- if ( block . length === 0 || block [ 0 ] !== 'normal' || / ^ \s * $ / . test ( lines [ block [ 2 ] ] ) ) {
465
- this . startBlock ( 'table' , key ) ;
466
- } else {
467
- head = true ;
468
- this . backBlock ( 1 , 'table' ) ;
469
- }
470
-
471
- if ( tableMatches [ 1 ] [ 0 ] == '|' ) {
472
- tableMatches [ 1 ] = tableMatches [ 1 ] . substr ( 1 ) ;
463
+ ( function ( ) {
464
+ var block = _this4 . getBlock ( ) ;
465
+ var head = false ;
473
466
474
- if ( tableMatches [ 1 ] [ tableMatches [ 1 ] . length - 1 ] == '|' ) {
475
- tableMatches [ 1 ] = tableMatches [ 1 ] . slice ( 0 , - 1 ) ;
467
+ if ( block . length === 0 || block [ 0 ] !== 'normal' || / ^ \s * $ / . test ( lines [ block [ 2 ] ] ) ) {
468
+ _this4 . startBlock ( 'table' , key ) ;
469
+ } else {
470
+ head = true ;
471
+ _this4 . backBlock ( 1 , 'table' ) ;
476
472
}
477
- }
478
473
479
- var rows = tableMatches [ 1 ] . split ( / ( \+ | \| ) / ) ;
480
- var aligns = [ ] ;
481
- var _iteratorNormalCompletion = true ;
482
- var _didIteratorError = false ;
483
- var _iteratorError = undefined ;
474
+ if ( tableMatches [ 1 ] [ 0 ] == '|' ) {
475
+ tableMatches [ 1 ] = tableMatches [ 1 ] . substr ( 1 ) ;
484
476
485
- try {
486
- for ( var _iterator = rows [ Symbol . iterator ] ( ) , _step ; ! ( _iteratorNormalCompletion = ( _step = _iterator . next ( ) ) . done ) ; _iteratorNormalCompletion = true ) {
487
- var row = _step . value ;
477
+ if ( tableMatches [ 1 ] [ tableMatches [ 1 ] . length - 1 ] == '|' ) {
478
+ tableMatches [ 1 ] = tableMatches [ 1 ] . slice ( 0 , - 1 ) ;
479
+ }
480
+ }
488
481
482
+ var rows = tableMatches [ 1 ] . split ( / ( \+ | \| ) / ) ;
483
+ var aligns = [ ] ;
484
+ rows . forEach ( function ( row ) {
489
485
var align = 'none' ;
490
486
491
487
if ( tableMatches = row . match ( / ^ \s * ( : ? ) \- + ( : ? ) \s * $ / ) ) {
@@ -499,23 +495,10 @@ var Parser = (function () {
499
495
}
500
496
501
497
aligns . push ( align ) ;
502
- }
503
- } catch ( err ) {
504
- _didIteratorError = true ;
505
- _iteratorError = err ;
506
- } finally {
507
- try {
508
- if ( ! _iteratorNormalCompletion && _iterator [ 'return' ] ) {
509
- _iterator [ 'return' ] ( ) ;
510
- }
511
- } finally {
512
- if ( _didIteratorError ) {
513
- throw _iteratorError ;
514
- }
515
- }
516
- }
498
+ } ) ;
517
499
518
- this . setBlock ( key , [ head , aligns ] ) ;
500
+ _this4 . setBlock ( key , [ head , aligns ] ) ;
501
+ } ) ( ) ;
519
502
}
520
503
break ;
521
504
@@ -688,10 +671,10 @@ var Parser = (function () {
688
671
} , {
689
672
key : 'parsePre' ,
690
673
value : function parsePre ( lines ) {
691
- var _this4 = this ;
674
+ var _this5 = this ;
692
675
693
676
lines . forEach ( function ( line , ind ) {
694
- lines [ ind ] = _this4 . htmlspecialchars ( line . substr ( 4 ) ) ;
677
+ lines [ ind ] = _this5 . htmlspecialchars ( line . substr ( 4 ) ) ;
695
678
} ) ;
696
679
var str = lines . join ( '\n' ) ;
697
680
@@ -763,7 +746,7 @@ var Parser = (function () {
763
746
} , {
764
747
key : 'parseList' ,
765
748
value : function parseList ( lines ) {
766
- var _this5 = this ;
749
+ var _this6 = this ;
767
750
768
751
var html = '' ;
769
752
var minSpace = 99999 ;
@@ -818,7 +801,7 @@ var Parser = (function () {
818
801
}
819
802
820
803
if ( leftLines . length ) {
821
- html += "<li>" + _this5 . parse ( leftLines . join ( "\n" ) ) + "</li>" ;
804
+ html += "<li>" + _this6 . parse ( leftLines . join ( "\n" ) ) + "</li>" ;
822
805
}
823
806
824
807
leftLines = [ text ] ;
@@ -845,7 +828,7 @@ var Parser = (function () {
845
828
} , {
846
829
key : 'parseTable' ,
847
830
value : function parseTable ( lines , value ) {
848
- var _this6 = this ;
831
+ var _this7 = this ;
849
832
850
833
var _value = _slicedToArray ( value , 2 ) ;
851
834
@@ -924,7 +907,7 @@ var Parser = (function () {
924
907
html += ' align="' + aligns [ key ] + '"' ;
925
908
}
926
909
927
- html += '>' + _this6 . parseInline ( text ) + ( '</' + tag + '>' ) ;
910
+ html += '>' + _this7 . parseInline ( text ) + ( '</' + tag + '>' ) ;
928
911
} ) ;
929
912
930
913
html += '</tr>' ;
@@ -937,9 +920,9 @@ var Parser = (function () {
937
920
} ;
938
921
939
922
for ( var key in lines ) {
940
- var _ret = _loop ( key ) ;
923
+ var _ret2 = _loop ( key ) ;
941
924
942
- if ( _ret === 'continue' ) continue ;
925
+ if ( _ret2 === 'continue' ) continue ;
943
926
}
944
927
945
928
if ( body !== null ) {
@@ -970,10 +953,10 @@ var Parser = (function () {
970
953
} , {
971
954
key : 'parseNormal' ,
972
955
value : function parseNormal ( lines ) {
973
- var _this7 = this ;
956
+ var _this8 = this ;
974
957
975
958
lines = lines . map ( function ( line ) {
976
- return _this7 . parseInline ( line ) ;
959
+ return _this8 . parseInline ( line ) ;
977
960
} ) ;
978
961
979
962
var str = lines . join ( "\n" ) . trim ( ) ;
@@ -1031,10 +1014,10 @@ var Parser = (function () {
1031
1014
} , {
1032
1015
key : 'parseHtml' ,
1033
1016
value : function parseHtml ( lines , type ) {
1034
- var _this8 = this ;
1017
+ var _this9 = this ;
1035
1018
1036
1019
lines . forEach ( function ( line ) {
1037
- line = _this8 . parseInline ( line , _this8 . specialWhiteList [ type ] ? _this8 . specialWhiteList [ type ] : '' ) ;
1020
+ line = _this9 . parseInline ( line , _this9 . specialWhiteList [ type ] ? _this9 . specialWhiteList [ type ] : '' ) ;
1038
1021
} ) ;
1039
1022
1040
1023
return lines . join ( "\n" ) ;
0 commit comments