File tree Expand file tree Collapse file tree 4 files changed +10
-9
lines changed Expand file tree Collapse file tree 4 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -454,8 +454,8 @@ var Parser = (function () {
454454 break ;
455455
456456 // table
457- case / ^ ( (?: (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) ) | (?: (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) | (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) ) + ) $ / . test ( line ) :
458- var tableMatches = line . match ( / ^ ( (?: (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) ) | (?: (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) | (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) ) + ) $ / ) ;
457+ case / ^ ( (?: (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) ) | (?: (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) | (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) ) + ) $ / g . test ( line ) :
458+ var tableMatches = / ^ ( (?: (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) ) | (?: (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) | (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) ) + ) $ / g . exec ( line ) ;
459459 if ( this . isBlock ( 'normal' ) ) {
460460 var block = this . getBlock ( ) ;
461461 var head = false ;
@@ -466,7 +466,7 @@ var Parser = (function () {
466466 head = true ;
467467 this . backBlock ( 1 , 'table' ) ;
468468 }
469-
469+ console . log ( tableMatches ) ;
470470 if ( tableMatches [ 1 ] [ 0 ] == '|' ) {
471471 tableMatches [ 1 ] = tableMatches [ 1 ] . substr ( 1 ) ;
472472
Original file line number Diff line number Diff line change 500500 break ;
501501
502502 // table
503- case / ^ ( (?: (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) ) | (?: (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) | (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) ) + ) $ / . test ( line ) :
504- var tableMatches = line . match ( / ^ ( (?: (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) ) | (?: (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) | (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) ) + ) $ / ) ;
503+ case / ^ ( (?: (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) ) | (?: (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) | (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) ) + ) $ / g . test ( line ) :
504+ var tableMatches = / ^ ( (?: (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) ) | (?: (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) | (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) ) + ) $ / g . exec ( line ) ;
505505 if ( this . isBlock ( 'normal' ) ) {
506506 var block = this . getBlock ( ) ;
507507 var head = false ;
Original file line number Diff line number Diff line change @@ -409,8 +409,8 @@ export default class Parser {
409409 break
410410
411411 // table
412- case / ^ ( (?: (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) ) | (?: (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) | (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) ) + ) $ / . test ( line ) :
413- let tableMatches = line . match ( / ^ ( (?: (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) ) | (?: (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) | (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) ) + ) $ / )
412+ case / ^ ( (?: (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) ) | (?: (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) | (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) ) + ) $ / g . test ( line ) :
413+ let tableMatches = / ^ ( (?: (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) ) | (?: (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) | (?: (?: [ : ] * \- [ : ] * ) + (?: \| | \+ ) (?: [ : ] * \- [ : ] * ) + ) ) + ) $ / g . exec ( line )
414414 if ( this . isBlock ( 'normal' ) ) {
415415 let block = this . getBlock ( )
416416 let head = false
Original file line number Diff line number Diff line change @@ -78,13 +78,14 @@ describe('HyperDown.js', function() {
7878 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>' ) ) ;
7979 } ) ;
8080 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 |' ) ) ;
8283 } ) ;
8384 } ) ;
8485
8586 describe ( 'footnote' , function ( ) {
8687 it ( '脚注 ' , function ( ) {
87- assert . equal ( '123 ' , parser . makeHtml ( '[^demo]: 这是一个示例脚注。' ) ) ;
88+ assert . equal ( '' , parser . makeHtml ( '[^demo]: 这是一个示例脚注。' ) ) ;
8889 } ) ;
8990 } ) ;
9091} ) ;
You can’t perform that action at this time.
0 commit comments