text-doc-ir 0.0.13 → 0.0.14

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/esm/main.js CHANGED
@@ -735,9 +735,18 @@ export class FixedWidthTextVisitor extends NodeVisitor {
735
735
  { type: "horizontal-rule" },
736
736
  ],
737
737
  });
738
- super.document(node);
738
+ this.beforeBlock();
739
+ this.chooseChildren(node.content);
740
+ this.afterBlock();
739
741
  this.horizontalRule({ type: "horizontal-rule" });
742
+ this.beforeBlock();
743
+ if (node.definitions) {
744
+ this.chooseChildren(node.definitions);
745
+ }
746
+ this.afterBlock();
747
+ this.pushLine();
740
748
  if (this.state.linkCount > 0) {
749
+ this.beforeBlock();
741
750
  const max = this.state.linkCount;
742
751
  const length = Math.max(7, `[L${max}]: `.length);
743
752
  for (let i = 1; i <= max; i++) {
@@ -758,8 +767,14 @@ export class FixedWidthTextVisitor extends NodeVisitor {
758
767
  }
759
768
  }
760
769
  }
770
+ if (this.state.imageCount == 0) {
771
+ this.afterBlock();
772
+ }
761
773
  }
762
774
  if (this.state.imageCount > 0) {
775
+ if (this.state.linkCount == 0) {
776
+ this.beforeBlock();
777
+ }
763
778
  const length = Math.max(7, `[L${this.state.imageCount}]: `.length);
764
779
  for (let i = 1; i <= this.state.imageCount; i++) {
765
780
  const label = `[I${i}]: `;
@@ -780,6 +795,7 @@ export class FixedWidthTextVisitor extends NodeVisitor {
780
795
  }
781
796
  }
782
797
  }
798
+ this.afterBlock();
783
799
  }
784
800
  counterToDepth(counter) {
785
801
  const num = this.state.numericDepth % 3;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "module": "./esm/main.js",
3
3
  "main": "./script/main.js",
4
4
  "name": "text-doc-ir",
5
- "version": "0.0.13",
5
+ "version": "0.0.14",
6
6
  "description": "Transforms a document intermediate representation into plain text with formatting",
7
7
  "license": "MIT",
8
8
  "repository": {
package/script/main.js CHANGED
@@ -738,9 +738,18 @@ class FixedWidthTextVisitor extends deps_js_1.NodeVisitor {
738
738
  { type: "horizontal-rule" },
739
739
  ],
740
740
  });
741
- super.document(node);
741
+ this.beforeBlock();
742
+ this.chooseChildren(node.content);
743
+ this.afterBlock();
742
744
  this.horizontalRule({ type: "horizontal-rule" });
745
+ this.beforeBlock();
746
+ if (node.definitions) {
747
+ this.chooseChildren(node.definitions);
748
+ }
749
+ this.afterBlock();
750
+ this.pushLine();
743
751
  if (this.state.linkCount > 0) {
752
+ this.beforeBlock();
744
753
  const max = this.state.linkCount;
745
754
  const length = Math.max(7, `[L${max}]: `.length);
746
755
  for (let i = 1; i <= max; i++) {
@@ -761,8 +770,14 @@ class FixedWidthTextVisitor extends deps_js_1.NodeVisitor {
761
770
  }
762
771
  }
763
772
  }
773
+ if (this.state.imageCount == 0) {
774
+ this.afterBlock();
775
+ }
764
776
  }
765
777
  if (this.state.imageCount > 0) {
778
+ if (this.state.linkCount == 0) {
779
+ this.beforeBlock();
780
+ }
766
781
  const length = Math.max(7, `[L${this.state.imageCount}]: `.length);
767
782
  for (let i = 1; i <= this.state.imageCount; i++) {
768
783
  const label = `[I${i}]: `;
@@ -783,6 +798,7 @@ class FixedWidthTextVisitor extends deps_js_1.NodeVisitor {
783
798
  }
784
799
  }
785
800
  }
801
+ this.afterBlock();
786
802
  }
787
803
  counterToDepth(counter) {
788
804
  const num = this.state.numericDepth % 3;