@columnus/shared 0.1.49 → 0.1.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/csv.js CHANGED
@@ -4764,10 +4764,33 @@ function visitInlineContent(content, visit) {
4764
4764
  function walkInlineContent(content, parts) {
4765
4765
  visitInlineContent(content, {
4766
4766
  text: (t) => parts.push(t),
4767
- recordLink: (props) => parts.push(props.table ? `[${props.table}]` : "[record]"),
4767
+ recordLink: (props) => parts.push(props.table ? `[${props.table}]` : "[Record]"),
4768
4768
  link: (nested) => walkInlineContent(nested, parts)
4769
4769
  });
4770
4770
  }
4771
+ function walkTableCell(cell, parts) {
4772
+ if (Array.isArray(cell)) {
4773
+ walkInlineContent(cell, parts);
4774
+ return;
4775
+ }
4776
+ if (cell && typeof cell === "object") {
4777
+ const node = cell;
4778
+ if (node.type === "tableCell" && Array.isArray(node.content)) {
4779
+ walkInlineContent(node.content, parts);
4780
+ }
4781
+ }
4782
+ }
4783
+ function walkTableContent(content, parts) {
4784
+ if (!content || typeof content !== "object" || Array.isArray(content)) return;
4785
+ const rows = content.rows ?? [];
4786
+ for (const row of rows) {
4787
+ for (const cell of row.cells ?? []) {
4788
+ const before = parts.length;
4789
+ walkTableCell(cell, parts);
4790
+ if (parts.length > before) parts.push(" ");
4791
+ }
4792
+ }
4793
+ }
4771
4794
  function walkBlocks(blocks, parts) {
4772
4795
  for (const block of blocks) {
4773
4796
  if (block.type === "recordTable") {
@@ -4781,6 +4804,8 @@ function walkBlocks(blocks, parts) {
4781
4804
  parts.push("[data table]");
4782
4805
  }
4783
4806
  parts.push(" ");
4807
+ } else if (block.type === "table") {
4808
+ walkTableContent(block.content, parts);
4784
4809
  } else if (Array.isArray(block.content)) {
4785
4810
  walkInlineContent(block.content, parts);
4786
4811
  parts.push(" ");