Skip to content

Commit

Permalink
fix(framework): handle interpolation with single quotes override (pre…
Browse files Browse the repository at this point in the history
  • Loading branch information
qnp committed Mar 17, 2022
1 parent 40bd270 commit 4db7f59
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/printer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,12 @@ export class PugPrinter {
}

private frameworkFormat(code: string): string {
const options: Options = { ...this.codeInterpolationOptions };
const options: Options = {
...this.codeInterpolationOptions,
// we need to keep the original singleQuote option
// see https://github.com/prettier/plugin-pug/issues/339
singleQuote: this.options.singleQuote,
};
switch (this.framework) {
case 'angular':
options.parser = '__ng_interpolation';
Expand All @@ -461,7 +466,6 @@ export class PugPrinter {
options.parser = 'babel';
options.semi = false;
}

let result: string = format(code, options);
if (result[0] === ';') {
result = result.slice(1);
Expand Down

0 comments on commit 4db7f59

Please sign in to comment.