Skip to content

Commit 427c468

Browse files
Update dependency prettier to v3.4.2 (#529)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Shinigami92 <[email protected]>
1 parent 52344b6 commit 427c468

File tree

3 files changed

+19
-18
lines changed

3 files changed

+19
-18
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
"eslint-plugin-unicorn": "56.0.0",
8585
"jiti": "2.3.3",
8686
"npm-run-all2": "6.2.3",
87-
"prettier": "3.3.3",
87+
"prettier": "3.4.2",
8888
"prettier-plugin-organize-imports": "4.1.0",
8989
"prettier-plugin-packagejson": "2.5.3",
9090
"rimraf": "6.0.1",

pnpm-lock.yaml

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/printer.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ export class PugPrinter {
324324
*/
325325
public async build(): Promise<string> {
326326
if (logger.isDebugEnabled()) {
327-
logger.debug('[PugPrinter]:', JSON.stringify(this.tokens));
327+
logger.debug('[PugPrinter:build]:', JSON.stringify(this.tokens));
328328
}
329329

330330
const results: string[] = [];
@@ -336,7 +336,7 @@ export class PugPrinter {
336336

337337
let token: Token | null = this.getNextToken();
338338
while (token) {
339-
logger.debug('[PugPrinter]:', JSON.stringify(token));
339+
logger.debug('[PugPrinter:build]:', JSON.stringify(token));
340340
try {
341341
switch (token.type) {
342342
case 'attribute':
@@ -691,7 +691,8 @@ export class PugPrinter {
691691
val = await format(val, { parser, ...options });
692692
val =
693693
this.quotes === '"'
694-
? val.replaceAll('"', '\\"')
694+
? // Escape double quotes, but only if they are not already escaped
695+
val.replaceAll(/(?<!\\)((?:\\\\)*)"/g, '$1\\"')
695696
: val.replaceAll("'", "\\'");
696697
val = unwrapLineFeeds(val);
697698
if (trimTrailingSemicolon && val.at(-1) === ';') {

0 commit comments

Comments
 (0)