Skip to content

Commit

Permalink
fix: removing changes on renderer-commonmark file
Browse files Browse the repository at this point in the history
  • Loading branch information
a-rena committed Jul 23, 2024
1 parent b926594 commit 8550464
Show file tree
Hide file tree
Showing 3 changed files with 2,029 additions and 14 deletions.
19 changes: 5 additions & 14 deletions packages/@atjson/renderer-commonmark/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -782,10 +782,8 @@ export default class CommonmarkRenderer extends Renderer {
}
> = {};

for (let [
index,
{ name, slice: sliceId, textAlignment },
] of table.attributes.columns.entries()) {
for (let { name, slice: sliceId, textAlignment } of table.attributes
.columns) {
let headerText = "";
if (table.attributes.showColumnHeaders) {
if (sliceId) {
Expand All @@ -798,7 +796,6 @@ export default class CommonmarkRenderer extends Renderer {
headerText = name;
}
}
name = name === "" ? `column ${index + 1}` : name;
columns[name] = {
header: headerText.replace(/\n/g, " "),
rows: [],
Expand All @@ -808,8 +805,7 @@ export default class CommonmarkRenderer extends Renderer {
}

for (let row of dataSet.attributes.records) {
for (let [index, { name }] of table.attributes.columns.entries()) {
name = name === "" ? `column ${index + 1}` : name;
for (let { name } of table.attributes.columns) {
let cellText = "";
let sliceId = row[name]?.slice;

Expand Down Expand Up @@ -837,11 +833,7 @@ export default class CommonmarkRenderer extends Renderer {
let headerRow = "|";
let separatorRow = "|";

for (let [
index,
{ name, textAlignment },
] of table.attributes.columns.entries()) {
name = name === "" ? `column ${index + 1}` : name;
for (let { name, textAlignment } of table.attributes.columns) {
let headerText = columns[name].header;
let columnWidth = columns[name].width;
headerRow +=
Expand All @@ -865,8 +857,7 @@ export default class CommonmarkRenderer extends Renderer {

dataSet.attributes.records.forEach((_row, index) => {
body += "|";
for (let [i, { name }] of table.attributes.columns.entries()) {
name = name === "" ? `column ${i + 1}` : name;
for (let { name } of table.attributes.columns) {
let cellText = columns[name].rows[index];
let columnWidth = columns[name].width;
body +=
Expand Down
Loading

0 comments on commit 8550464

Please sign in to comment.