Skip to content

Commit

Permalink
fixes issue #3
Browse files Browse the repository at this point in the history
  • Loading branch information
ecmel committed Sep 12, 2023
1 parent 78b0720 commit bf2ff3f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Please check [Prettier Docs](https://prettier.io/docs/en/plugins.html) for other

<div class="<%= red %>"><%= 1 > 0 %></div>

<textarea><%= text %></textarea>
<textarea><!= text !></textarea>
<code><%= text %></code>
<pre><%= text %></pre>
</div>
Expand All @@ -62,7 +62,7 @@ Please check [Prettier Docs](https://prettier.io/docs/en/plugins.html) for other

<div class="<%= red %>"><%= 1 > 0 %></div>

<textarea><%= text %></textarea>
<textarea><!= text !></textarea>
<code><%= text %></code>
<pre><%= text %></pre>
</div>
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { parsers } = require("prettier/parser-html");

const regex =
/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|<(?:title|textarea).*?<\/|(<%([^>]*?)%>)/gs;
/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|<title\s*>.*?<\/title|<textarea\s*>.*?<\/textarea|(<%([^>]*?)%>)/gs;

const replacer = (m, t, c) => (!t ? m : `<!${c}!>`);

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": "0.0.15",
"version": "0.0.16",
"description": "A Prettier plugin for Embedded JavaScript Templating (EJS).",
"keywords": [
"prettier",
Expand Down
12 changes: 11 additions & 1 deletion test.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title><%= text %></title>
<title><!= text !></title>
</head>
<body>
<div>
Expand All @@ -26,6 +26,16 @@
<td><%= text %></td>
</tr>
</table>

<textarea>
<div></div>
<%- include("../_partials/teaser-animation.html", { page }) %>
</textarea>

<textarea>
<%= text %>
<%- include("../_partials/teaser-animation.html", { page }) %>
</textarea>
</div>
</body>
</html>

0 comments on commit bf2ff3f

Please sign in to comment.