Skip to content

Commit

Permalink
tests rowspan&colspan
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNorthMemory committed Aug 19, 2024
1 parent 2153d2e commit 9ae0c33
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions patterns.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ module.exports = options => {
let idx = i - 2;
while (idx > 0 && 'tbody_open' !== tokens[--idx].type);

const calc = tokens[idx].meta ? tokens[idx].meta.colsnum >> 0 : 1;
const calc = tokens[idx].meta.colsnum >> 0;
if (calc < 2) { return; }

const level = tokens[i].level + 2;
Expand Down Expand Up @@ -226,16 +226,16 @@ module.exports = options => {
}
}

for (let k = n; k < i; k++) {
for (let k = n + 2; k < i; k++) {
if ('tr_close' == tokens[k].type) {
end = k;
break;
} else if ('td_open' == tokens[k].type) {
k > idx && one.push(k);
one.push(k);
}
}

const off = one.indexOf(idx);
const off = one.indexOf(n);
let real = num - off;
real = real > cols ? cols : real;
cols > real && token.attrSet('colspan', real + '');
Expand Down
2 changes: 1 addition & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ function describeTestsWithOptions(options, postText) {
src += '| -- | -- | -- | -- |\n';
src += '| 1 {colspan=2}| 11 {colspan=3} | 111| 1111 |\n';
src += '| 2 {rowspan=2} | 22 {colspan=2} | 222 | 2222 |\n';
src += '| 3 | 33 {colspan=2} | 333 | 3333 |\n';
src += '| 3 | 33 {colspan=4} | 333 | 3333 |\n';
src += '\n';
src += '{border=4}';
expected = '<table border="1">\n';
Expand Down

0 comments on commit 9ae0c33

Please sign in to comment.