Skip to content

Commit

Permalink
fix regex
Browse files Browse the repository at this point in the history
  • Loading branch information
ecmel committed Jan 20, 2024
1 parent 4b2bd66 commit 026df75
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/*
* Copyright (c) 1986-2023 Ecmel Ercan (https://ecmel.dev/)
* Copyright (c) 1986-2024 Ecmel Ercan (https://ecmel.dev/)
* Licensed under the MIT License
*/

const { parsers } = require("prettier/parser-html");

function parse(text, options, legacy) {
const find =
/(?:<(textarea|title|script).*?<\/\1|<\s*[a-zA-Z!].*?[^%/]>|<%([^>]*)%>)/gs;
/(?:<(textarea|title|script).*?<\/\1|<\s*[a-zA-Z!](?:".*?"|.*?)*?[^%]>|<%([^>]*)%>)/gs;
text = text.replace(find, (match, p1, p2) => (p2 ? `<!${p2}!>` : match));
return parsers.html.parse(text, options, legacy);
}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "prettier-plugin-ejs",
"displayName": "Prettier EJS Plugin",
"version": "1.0.2",
"version": "1.0.3",
"description": "A Prettier plugin for Embedded JavaScript Templating (EJS).",
"keywords": [
"prettier",
Expand Down

0 comments on commit 026df75

Please sign in to comment.