@herb-tools/formatter 0.7.2 → 0.7.3

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/index.esm.js CHANGED
@@ -196,7 +196,7 @@ class Token {
196
196
  }
197
197
 
198
198
  // NOTE: This file is generated by the templates/template.rb script and should not
199
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.2/templates/javascript/packages/core/src/errors.ts.erb
199
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.3/templates/javascript/packages/core/src/errors.ts.erb
200
200
  class HerbError {
201
201
  type;
202
202
  message;
@@ -646,7 +646,7 @@ function convertToUTF8(string) {
646
646
  }
647
647
 
648
648
  // NOTE: This file is generated by the templates/template.rb script and should not
649
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.2/templates/javascript/packages/core/src/nodes.ts.erb
649
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.3/templates/javascript/packages/core/src/nodes.ts.erb
650
650
  class Node {
651
651
  type;
652
652
  location;
@@ -2880,7 +2880,7 @@ class ParseResult extends Result {
2880
2880
  }
2881
2881
 
2882
2882
  // NOTE: This file is generated by the templates/template.rb script and should not
2883
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.2/templates/javascript/packages/core/src/node-type-guards.ts.erb
2883
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.3/templates/javascript/packages/core/src/node-type-guards.ts.erb
2884
2884
  /**
2885
2885
  * Type guard functions for AST nodes.
2886
2886
  * These functions provide type checking by combining both instanceof
@@ -3367,7 +3367,7 @@ function getNodesAfterPosition(nodes, position, inclusive = true) {
3367
3367
  }
3368
3368
 
3369
3369
  // NOTE: This file is generated by the templates/template.rb script and should not
3370
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.2/templates/javascript/packages/core/src/visitor.ts.erb
3370
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.3/templates/javascript/packages/core/src/visitor.ts.erb
3371
3371
  class Visitor {
3372
3372
  visit(node) {
3373
3373
  if (!node)
@@ -4440,7 +4440,18 @@ class FormatPrinter extends Printer {
4440
4440
  }
4441
4441
  visitHTMLElementBody(body, element) {
4442
4442
  if (this.isContentPreserving(element)) {
4443
- element.body.map(child => this.pushToLastLine(IdentityPrinter.print(child)));
4443
+ element.body.map(child => {
4444
+ if (isNode(child, HTMLElementNode)) {
4445
+ const wasInlineMode = this.inlineMode;
4446
+ this.inlineMode = true;
4447
+ const formattedElement = this.capture(() => this.visit(child)).join("");
4448
+ this.pushToLastLine(formattedElement);
4449
+ this.inlineMode = wasInlineMode;
4450
+ }
4451
+ else {
4452
+ this.pushToLastLine(IdentityPrinter.print(child));
4453
+ }
4454
+ });
4444
4455
  return;
4445
4456
  }
4446
4457
  const analysis = this.elementFormattingAnalysis.get(element);
@@ -5103,7 +5114,7 @@ class FormatPrinter extends Printer {
5103
5114
  return child.content;
5104
5115
  }
5105
5116
  else if (isNode(child, ERBContentNode)) {
5106
- return IdentityPrinter.print(child);
5117
+ return this.reconstructERBNode(child, true);
5107
5118
  }
5108
5119
  else {
5109
5120
  const printed = IdentityPrinter.print(child);