text-doc-ir 0.0.9 → 0.0.11

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
@@ -206,6 +206,10 @@ export class FixedWidthTextVisitor extends NodeVisitor {
206
206
  this.state.linksReverse.set(key, node.url);
207
207
  }
208
208
  this.spaceLazy = true;
209
+ if (this.spaceLazy && this.lines.length > 0 &&
210
+ this.lines[this.lines.length - 1].match(/[{\(\[]$/)) {
211
+ this.spaceLazy = false;
212
+ }
209
213
  this.pushText(`[${key}]`);
210
214
  this.spaceLazy = true;
211
215
  }
@@ -754,6 +758,9 @@ export class FixedWidthTextVisitor extends NodeVisitor {
754
758
  return this.lines[this.lines.length - 1];
755
759
  }
756
760
  pushText(text) {
761
+ if (this.spaceLazy && text.match(/^[\.,}\)\]]/)) {
762
+ this.spaceLazy = false;
763
+ }
757
764
  this.pushLazyLines();
758
765
  let index = this.lines.length - 1;
759
766
  let line;
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.9",
5
+ "version": "0.0.11",
6
6
  "description": "Transforms a document intermediate representation into plain text with formatting",
7
7
  "license": "MIT",
8
8
  "repository": {
@@ -19,7 +19,7 @@
19
19
  }
20
20
  },
21
21
  "dependencies": {
22
- "document-ir": "0.0.13"
22
+ "document-ir": "0.0.14"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/node": "^18.11.9"
package/script/main.js CHANGED
@@ -209,6 +209,10 @@ class FixedWidthTextVisitor extends deps_js_1.NodeVisitor {
209
209
  this.state.linksReverse.set(key, node.url);
210
210
  }
211
211
  this.spaceLazy = true;
212
+ if (this.spaceLazy && this.lines.length > 0 &&
213
+ this.lines[this.lines.length - 1].match(/[{\(\[]$/)) {
214
+ this.spaceLazy = false;
215
+ }
212
216
  this.pushText(`[${key}]`);
213
217
  this.spaceLazy = true;
214
218
  }
@@ -757,6 +761,9 @@ class FixedWidthTextVisitor extends deps_js_1.NodeVisitor {
757
761
  return this.lines[this.lines.length - 1];
758
762
  }
759
763
  pushText(text) {
764
+ if (this.spaceLazy && text.match(/^[\.,}\)\]]/)) {
765
+ this.spaceLazy = false;
766
+ }
760
767
  this.pushLazyLines();
761
768
  let index = this.lines.length - 1;
762
769
  let line;