text-doc-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.
- package/esm/main.js +7 -10
- package/package.json +1 -1
- package/script/main.js +7 -10
package/esm/main.js
CHANGED
|
@@ -650,6 +650,11 @@ export class FixedWidthTextVisitor extends NodeVisitor {
|
|
|
650
650
|
});
|
|
651
651
|
visitor.spaceLazy = true;
|
|
652
652
|
}
|
|
653
|
+
visitor.restoreState(this);
|
|
654
|
+
visitor.visit({
|
|
655
|
+
type: "array",
|
|
656
|
+
content: node.children,
|
|
657
|
+
});
|
|
653
658
|
let counter = 0;
|
|
654
659
|
for (const line of visitor.getLines()) {
|
|
655
660
|
this.pushEndOfLineIfAnyContent();
|
|
@@ -663,15 +668,6 @@ export class FixedWidthTextVisitor extends NodeVisitor {
|
|
|
663
668
|
counter++;
|
|
664
669
|
}
|
|
665
670
|
visitor.restoreState(this);
|
|
666
|
-
visitor.visit({
|
|
667
|
-
type: "array",
|
|
668
|
-
content: node.children,
|
|
669
|
-
});
|
|
670
|
-
for (const line of visitor.getLines()) {
|
|
671
|
-
this.pushEndOfLineIfAnyContent();
|
|
672
|
-
this.lines[Math.max(0, this.lines.length - 1)] = " " + line;
|
|
673
|
-
}
|
|
674
|
-
visitor.restoreState(this);
|
|
675
671
|
}
|
|
676
672
|
else {
|
|
677
673
|
const visitor = new FixedWidthTextVisitor(this.width - 4);
|
|
@@ -702,11 +698,12 @@ export class FixedWidthTextVisitor extends NodeVisitor {
|
|
|
702
698
|
this.pushBlockContentBegin();
|
|
703
699
|
this.lines[Math.max(0, this.lines.length - 1)] = "/" + "-".repeat(left) +
|
|
704
700
|
" Table of contents " + "-".repeat(right) + "\\";
|
|
705
|
-
for (const line of
|
|
701
|
+
for (const line of lines) {
|
|
706
702
|
this.pushEndOfLineIfAnyContent();
|
|
707
703
|
this.lines[Math.max(0, this.lines.length - 1)] = "| " + line +
|
|
708
704
|
" ".repeat(maxLength - line.length) + "|";
|
|
709
705
|
}
|
|
706
|
+
this.pushEndOfLineIfAnyContent();
|
|
710
707
|
this.lines[Math.max(0, this.lines.length - 1)] = "\\" +
|
|
711
708
|
"-".repeat(maxLength + 1) + "/";
|
|
712
709
|
visitor.restoreState(this);
|
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.
|
|
5
|
+
"version": "0.0.13",
|
|
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
|
@@ -653,6 +653,11 @@ class FixedWidthTextVisitor extends deps_js_1.NodeVisitor {
|
|
|
653
653
|
});
|
|
654
654
|
visitor.spaceLazy = true;
|
|
655
655
|
}
|
|
656
|
+
visitor.restoreState(this);
|
|
657
|
+
visitor.visit({
|
|
658
|
+
type: "array",
|
|
659
|
+
content: node.children,
|
|
660
|
+
});
|
|
656
661
|
let counter = 0;
|
|
657
662
|
for (const line of visitor.getLines()) {
|
|
658
663
|
this.pushEndOfLineIfAnyContent();
|
|
@@ -666,15 +671,6 @@ class FixedWidthTextVisitor extends deps_js_1.NodeVisitor {
|
|
|
666
671
|
counter++;
|
|
667
672
|
}
|
|
668
673
|
visitor.restoreState(this);
|
|
669
|
-
visitor.visit({
|
|
670
|
-
type: "array",
|
|
671
|
-
content: node.children,
|
|
672
|
-
});
|
|
673
|
-
for (const line of visitor.getLines()) {
|
|
674
|
-
this.pushEndOfLineIfAnyContent();
|
|
675
|
-
this.lines[Math.max(0, this.lines.length - 1)] = " " + line;
|
|
676
|
-
}
|
|
677
|
-
visitor.restoreState(this);
|
|
678
674
|
}
|
|
679
675
|
else {
|
|
680
676
|
const visitor = new FixedWidthTextVisitor(this.width - 4);
|
|
@@ -705,11 +701,12 @@ class FixedWidthTextVisitor extends deps_js_1.NodeVisitor {
|
|
|
705
701
|
this.pushBlockContentBegin();
|
|
706
702
|
this.lines[Math.max(0, this.lines.length - 1)] = "/" + "-".repeat(left) +
|
|
707
703
|
" Table of contents " + "-".repeat(right) + "\\";
|
|
708
|
-
for (const line of
|
|
704
|
+
for (const line of lines) {
|
|
709
705
|
this.pushEndOfLineIfAnyContent();
|
|
710
706
|
this.lines[Math.max(0, this.lines.length - 1)] = "| " + line +
|
|
711
707
|
" ".repeat(maxLength - line.length) + "|";
|
|
712
708
|
}
|
|
709
|
+
this.pushEndOfLineIfAnyContent();
|
|
713
710
|
this.lines[Math.max(0, this.lines.length - 1)] = "\\" +
|
|
714
711
|
"-".repeat(maxLength + 1) + "/";
|
|
715
712
|
visitor.restoreState(this);
|