document-ir 0.0.12 → 0.0.13

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.
@@ -623,26 +623,32 @@ export class IdentityTransformer {
623
623
  }
624
624
  async date(node) {
625
625
  await this.beforeInline();
626
+ const content = node.content && await this.chooseChildren(node.content);
626
627
  await this.afterInline();
627
628
  return {
628
629
  type: "date",
629
- isoDate: `${node.isoDate}`,
630
+ isoDate: node.isoDate,
631
+ content,
630
632
  };
631
633
  }
632
634
  async time(node) {
633
635
  await this.beforeInline();
636
+ const content = node.content && await this.chooseChildren(node.content);
634
637
  await this.afterInline();
635
638
  return {
636
639
  type: "time",
637
- isoTime: `${node.isoTime}`,
640
+ isoTime: node.isoTime,
641
+ content,
638
642
  };
639
643
  }
640
644
  async datetime(node) {
641
645
  await this.beforeInline();
646
+ const content = node.content && await this.chooseChildren(node.content);
642
647
  await this.afterInline();
643
648
  return {
644
649
  type: "datetime",
645
- iso8601: `${node.iso8601}`,
650
+ iso8601: node.iso8601,
651
+ content,
646
652
  };
647
653
  }
648
654
  async subText(node) {
@@ -247,22 +247,19 @@ export class NodeVisitor {
247
247
  }
248
248
  }
249
249
  date(node) {
250
- this.text({
251
- type: "text",
252
- text: node.isoDate,
253
- });
250
+ this.beforeInline();
251
+ this.chooseChildren(node.content);
252
+ this.afterInline();
254
253
  }
255
254
  time(node) {
256
- this.text({
257
- type: "text",
258
- text: node.isoTime,
259
- });
255
+ this.beforeInline();
256
+ this.chooseChildren(node.content);
257
+ this.afterInline();
260
258
  }
261
259
  datetime(node) {
262
- this.text({
263
- type: "text",
264
- text: node.iso8601,
265
- });
260
+ this.beforeInline();
261
+ this.chooseChildren(node.content);
262
+ this.afterInline();
266
263
  }
267
264
  subText(node) {
268
265
  this.beforeInline();
package/esm/types.d.ts CHANGED
@@ -301,14 +301,17 @@ export interface SubTextNode {
301
301
  export interface DateNode {
302
302
  type: "date";
303
303
  isoDate: string;
304
+ content: Node[];
304
305
  }
305
306
  export interface TimeNode {
306
307
  type: "time";
307
308
  isoTime: string;
309
+ content: Node[];
308
310
  }
309
311
  export interface DateTimeNode {
310
312
  type: "datetime";
311
313
  iso8601: string;
314
+ content: Node[];
312
315
  }
313
316
  export type Node = ArrayNode | BlockNode | BlockQuoteNode | BoldNode | BreakNode | BubbleNode | CardNode | CenterNode | CodeNode | ColumnsNode | DefinitionNode | DefinitionListNode | DefinitionReferenceNode | EmbedNode | EmojiNode | FigureNode | FigureCaptionNode | FigureImageNode | FormattedTextNode | HeaderNode | HighTechAlertNode | HorizontalRuleNode | ImageNode | ItalicNode | LinkNode | ListNode | NoteNode | ParagraphNode | QuoteNode | RedactedNode | RegionNode | ScriptNode | SecretNode | SmallerNode | StickerNode | StrikeThroughNode | TextNode | TableNode | SocialNode | UnderlineNode | VideoNode | DateNode | TimeNode | DateTimeNode | SuperTextNode | SubTextNode | WarningNode;
314
317
  export interface DocumentMeta {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "module": "./esm/index.js",
3
3
  "main": "./script/index.js",
4
4
  "name": "document-ir",
5
- "version": "0.0.12",
5
+ "version": "0.0.13",
6
6
  "description": "Intermediate representation and transformers for documents",
7
7
  "license": "MIT",
8
8
  "repository": {
@@ -626,26 +626,32 @@ class IdentityTransformer {
626
626
  }
627
627
  async date(node) {
628
628
  await this.beforeInline();
629
+ const content = node.content && await this.chooseChildren(node.content);
629
630
  await this.afterInline();
630
631
  return {
631
632
  type: "date",
632
- isoDate: `${node.isoDate}`,
633
+ isoDate: node.isoDate,
634
+ content,
633
635
  };
634
636
  }
635
637
  async time(node) {
636
638
  await this.beforeInline();
639
+ const content = node.content && await this.chooseChildren(node.content);
637
640
  await this.afterInline();
638
641
  return {
639
642
  type: "time",
640
- isoTime: `${node.isoTime}`,
643
+ isoTime: node.isoTime,
644
+ content,
641
645
  };
642
646
  }
643
647
  async datetime(node) {
644
648
  await this.beforeInline();
649
+ const content = node.content && await this.chooseChildren(node.content);
645
650
  await this.afterInline();
646
651
  return {
647
652
  type: "datetime",
648
- iso8601: `${node.iso8601}`,
653
+ iso8601: node.iso8601,
654
+ content,
649
655
  };
650
656
  }
651
657
  async subText(node) {
@@ -250,22 +250,19 @@ class NodeVisitor {
250
250
  }
251
251
  }
252
252
  date(node) {
253
- this.text({
254
- type: "text",
255
- text: node.isoDate,
256
- });
253
+ this.beforeInline();
254
+ this.chooseChildren(node.content);
255
+ this.afterInline();
257
256
  }
258
257
  time(node) {
259
- this.text({
260
- type: "text",
261
- text: node.isoTime,
262
- });
258
+ this.beforeInline();
259
+ this.chooseChildren(node.content);
260
+ this.afterInline();
263
261
  }
264
262
  datetime(node) {
265
- this.text({
266
- type: "text",
267
- text: node.iso8601,
268
- });
263
+ this.beforeInline();
264
+ this.chooseChildren(node.content);
265
+ this.afterInline();
269
266
  }
270
267
  subText(node) {
271
268
  this.beforeInline();
package/script/types.d.ts CHANGED
@@ -301,14 +301,17 @@ export interface SubTextNode {
301
301
  export interface DateNode {
302
302
  type: "date";
303
303
  isoDate: string;
304
+ content: Node[];
304
305
  }
305
306
  export interface TimeNode {
306
307
  type: "time";
307
308
  isoTime: string;
309
+ content: Node[];
308
310
  }
309
311
  export interface DateTimeNode {
310
312
  type: "datetime";
311
313
  iso8601: string;
314
+ content: Node[];
312
315
  }
313
316
  export type Node = ArrayNode | BlockNode | BlockQuoteNode | BoldNode | BreakNode | BubbleNode | CardNode | CenterNode | CodeNode | ColumnsNode | DefinitionNode | DefinitionListNode | DefinitionReferenceNode | EmbedNode | EmojiNode | FigureNode | FigureCaptionNode | FigureImageNode | FormattedTextNode | HeaderNode | HighTechAlertNode | HorizontalRuleNode | ImageNode | ItalicNode | LinkNode | ListNode | NoteNode | ParagraphNode | QuoteNode | RedactedNode | RegionNode | ScriptNode | SecretNode | SmallerNode | StickerNode | StrikeThroughNode | TextNode | TableNode | SocialNode | UnderlineNode | VideoNode | DateNode | TimeNode | DateTimeNode | SuperTextNode | SubTextNode | WarningNode;
314
317
  export interface DocumentMeta {