diff --git a/CHANGELOG.md b/CHANGELOG.md index ba77dbe..ccbe078 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # prettier-plugin-svelte changelog +## 3.2.4 + +- (fix) speed up regex + ## 3.2.3 - (fix) don't force-self-close `` tags diff --git a/src/lib/snipTagContent.ts b/src/lib/snipTagContent.ts index cb02d8d..89b0dc6 100644 --- a/src/lib/snipTagContent.ts +++ b/src/lib/snipTagContent.ts @@ -3,9 +3,9 @@ import { base64ToString, stringToBase64 } from '../base64-string'; export const snippedTagContentAttribute = '✂prettier:content✂'; const scriptRegex = - /|'"\/]+=(?:"[^"]*"|'[^']*'|[^>\s]+)|\s+[^=>'"\/]+)*\s*)>([^]*?)<\/script>/g; + /|'"\/\s]+=(?:"[^"]*"|'[^']*'|[^>\s]+)|\s+[^=>'"\/\s]+)*\s*)>([^]*?)<\/script>/g; const styleRegex = - /|'"\/]+=(?:"[^"]*"|'[^']*'|[^>\s]+)|\s+[^=>'"\/]+)*\s*)>([^]*?)<\/style>/g; + /|'"\/\s]+=(?:"[^"]*"|'[^']*'|[^>\s]+)|\s+[^=>'"\/\s]+)*\s*)>([^]*?)<\/style>/g; export function snipScriptAndStyleTagContent(source: string): string { let scriptMatchSpans = getMatchIndexes('script'); diff --git a/test/printer/samples/script-attributes-multiline.html b/test/printer/samples/script-attributes-multiline.html new file mode 100644 index 0000000..29a69ca --- /dev/null +++ b/test/printer/samples/script-attributes-multiline.html @@ -0,0 +1,14 @@ + + + + +