Skip to content

Commit

Permalink
fix: table annotation rank
Browse files Browse the repository at this point in the history
  • Loading branch information
Colin-Alexa Robinson committed Feb 28, 2024
1 parent f534d05 commit ee33a5b
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ export class Table extends BlockAnnotation<{
static type = "table";

get rank() {
return 6; // higher than SliceAnnotation's rank of 5
return 4; // lower than sliceAnnotation's rank of 5
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,6 @@
exports[`commonmark tables with column headings 1`] = `
{
"blocks": [
{
"attributes": {
"columns": [
{
"name": "column 1",
"slice": "M00000001",
"type": "peritext",
},
{
"name": "column 2",
"slice": "M00000002",
"type": "peritext",
},
],
"rows": [
{
"column 1": {
"jsonValue": "data 1.1",
"slice": "M00000003",
},
"column 2": {
"jsonValue": "data 1.2",
"slice": "M00000004",
},
},
],
},
"id": "B00000000",
"parents": [],
"selfClosing": false,
"type": "data-set",
},
{
"attributes": {
"columns": [
Expand All @@ -50,16 +18,14 @@ exports[`commonmark tables with column headings 1`] = `
"dataSet": "M00000000",
"showColumnHeaders": true,
},
"id": "B00000001",
"parents": [
"data-set",
],
"id": "B00000000",
"parents": [],
"selfClosing": false,
"type": "table",
},
],
"marks": [],
"text": "column 1 column 2 data 1.1 data 1.2",
"text": "",
}
`;

Expand Down
10 changes: 5 additions & 5 deletions packages/@atjson/renderer-commonmark/test/commonmark.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1902,31 +1902,31 @@ After all the lists
id: "dataSetId",
start: 0,
end: 35,
attributes: { refs: ["tableId"], retain: true },
attributes: { refs: ["tableId"] },
}),
new SliceAnnotation({
id: "column1id",
start: 0,
end: 8,
attributes: { refs: ["dataSetId"], retain: true },
attributes: { refs: ["dataSetId"] },
}),
new SliceAnnotation({
id: "column2id",
start: 9,
end: 17,
attributes: { refs: ["dataSetId"], retain: true },
attributes: { refs: ["dataSetId"] },
}),
new SliceAnnotation({
id: "cell1_1id",
start: 18,
end: 26,
attributes: { refs: ["dataSetId"], retain: true },
attributes: { refs: ["dataSetId"] },
}),
new SliceAnnotation({
id: "cell1_2id",
start: 27,
end: 35,
attributes: { refs: ["dataSetId"], retain: true },
attributes: { refs: ["dataSetId"] },
}),
{
type: "-offset-table",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
exports[`tables converting 1`] = `
{
"blocks": [
{
"attributes": {
"dataSet": "M00000000",
},
"id": "B00000000",
"parents": [],
"selfClosing": false,
"type": "table",
},
{
"attributes": {
"columns": [
Expand Down Expand Up @@ -40,38 +49,29 @@ exports[`tables converting 1`] = `
},
],
},
"id": "B00000000",
"parents": [],
"selfClosing": false,
"type": "data-set",
},
{
"attributes": {
"dataSet": "M00000000",
},
"id": "B00000001",
"parents": [
"data-set",
"table",
],
"selfClosing": false,
"type": "table",
"type": "data-set",
},
],
"marks": [
{
"attributes": {
"refs": [
"B00000001",
"B00000000",
],
},
"id": "M00000000",
"range": "(0..33]",
"range": "(1..33]",
"type": "slice",
},
{
"attributes": {
"refs": [
"B00000000",
"B00000001",
],
},
"id": "M00000001",
Expand All @@ -81,7 +81,7 @@ exports[`tables converting 1`] = `
{
"attributes": {
"refs": [
"B00000000",
"B00000001",
],
},
"id": "M00000002",
Expand All @@ -91,7 +91,7 @@ exports[`tables converting 1`] = `
{
"attributes": {
"refs": [
"B00000000",
"B00000001",
],
},
"id": "M00000003",
Expand All @@ -101,7 +101,7 @@ exports[`tables converting 1`] = `
{
"attributes": {
"refs": [
"B00000000",
"B00000001",
],
},
"id": "M00000004",
Expand All @@ -111,7 +111,7 @@ exports[`tables converting 1`] = `
{
"attributes": {
"refs": [
"B00000000",
"B00000001",
],
},
"id": "M00000005",
Expand All @@ -121,7 +121,7 @@ exports[`tables converting 1`] = `
{
"attributes": {
"refs": [
"B00000000",
"B00000001",
],
},
"id": "M00000006",
Expand Down

0 comments on commit ee33a5b

Please sign in to comment.