Skip to content

Commit d6268e3

Browse files
author
Jiang Shang
committedSep 2, 2015
bugfix
1 parent 43861f9 commit d6268e3

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed
 

‎dist/Parser.js

+3-3
Original file line numberDiff line numberDiff 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

‎hyperdown.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -500,8 +500,8 @@
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;

‎src/Parser.js

+2-2
Original file line numberDiff line numberDiff 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

‎test/test.js

+3-2
Original file line numberDiff line numberDiff 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
});

0 commit comments

Comments
 (0)