File tree 4 files changed +10
-9
lines changed
4 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -454,8 +454,8 @@ var Parser = (function () {
454
454
break ;
455
455
456
456
// table
457
- case / ^ ( (?: (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) ) | (?: (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) | (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) ) + ) $ / . test ( line ) :
458
- var tableMatches = line . match ( / ^ ( (?: (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) ) | (?: (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) | (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) ) + ) $ / ) ;
457
+ case / ^ ( (?: (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) ) | (?: (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) | (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) ) + ) $ / g . test ( line ) :
458
+ var tableMatches = / ^ ( (?: (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) ) | (?: (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) | (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) ) + ) $ / g . exec ( line ) ;
459
459
if ( this . isBlock ( 'normal' ) ) {
460
460
var block = this . getBlock ( ) ;
461
461
var head = false ;
@@ -466,7 +466,7 @@ var Parser = (function () {
466
466
head = true ;
467
467
this . backBlock ( 1 , 'table' ) ;
468
468
}
469
-
469
+ console . log ( tableMatches ) ;
470
470
if ( tableMatches [ 1 ] [ 0 ] == '|' ) {
471
471
tableMatches [ 1 ] = tableMatches [ 1 ] . substr ( 1 ) ;
472
472
Original file line number Diff line number Diff line change 500
500
break ;
501
501
502
502
// table
503
- case / ^ ( (?: (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) ) | (?: (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) | (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) ) + ) $ / . test ( line ) :
504
- var tableMatches = line . match ( / ^ ( (?: (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) ) | (?: (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) | (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) ) + ) $ / ) ;
503
+ case / ^ ( (?: (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) ) | (?: (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) | (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) ) + ) $ / g . test ( line ) :
504
+ var tableMatches = / ^ ( (?: (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) ) | (?: (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) | (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) ) + ) $ / g . exec ( line ) ;
505
505
if ( this . isBlock ( 'normal' ) ) {
506
506
var block = this . getBlock ( ) ;
507
507
var head = false ;
Original file line number Diff line number Diff line change @@ -409,8 +409,8 @@ export default class Parser {
409
409
break
410
410
411
411
// table
412
- case / ^ ( (?: (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) ) | (?: (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) | (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) ) + ) $ / . test ( line ) :
413
- let tableMatches = line . match ( / ^ ( (?: (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) ) | (?: (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) | (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) ) + ) $ / )
412
+ case / ^ ( (?: (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) ) | (?: (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) | (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) ) + ) $ / g . test ( line ) :
413
+ let tableMatches = / ^ ( (?: (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) ) | (?: (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) | (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) ) + ) $ / g . exec ( line )
414
414
if ( this . isBlock ( 'normal' ) ) {
415
415
let block = this . getBlock ( )
416
416
let head = false
Original file line number Diff line number Diff line change @@ -78,13 +78,14 @@ describe('HyperDown.js', function() {
78
78
assert . equal ( '<table><tbody><tr><td>test</td><td>test</td><tr></tbody></table>' , parser . makeHtml ( '<table><tbody><tr><td>test</td><td>test</td><tr></tbody></table>' ) ) ;
79
79
} ) ;
80
80
it ( 'type2 |' , function ( ) {
81
- assert . equal ( '<table><thead><tr><th>test</th><th>test</th></tr></thead><thead><tr><th>------</th><th colspan="2">------</th></tr></thead><thead><tr><th>test</th><th>test</th></tr></thead></tbody></table>' , parser . makeHtml ( 'test | test\n------ | ------|\ntest | test' ) ) ;
81
+ assert . equal ( '<table><thead><tr><th>test</th><th>test</th></tr></thead><thead><tr><th>------</th><th colspan="2">------</th></tr></thead><thead><tr><th>test</th><th>test</th></tr></thead></tbody></table>' ,
82
+ parser . makeHtml ( '| Item | Value | Qty |\n| :-------- | --------:| :--: |\n| Computer | 1600 USD | 5 |\n| Phone | 12 USD | 12 |\n| Pipe | 1 USD | 234 |' ) ) ;
82
83
} ) ;
83
84
} ) ;
84
85
85
86
describe ( 'footnote' , function ( ) {
86
87
it ( '脚注 ' , function ( ) {
87
- assert . equal ( '123 ' , parser . makeHtml ( '[^demo]: 这是一个示例脚注。' ) ) ;
88
+ assert . equal ( '' , parser . makeHtml ( '[^demo]: 这是一个示例脚注。' ) ) ;
88
89
} ) ;
89
90
} ) ;
90
91
} ) ;
You can’t perform that action at this time.
0 commit comments