Skip to content

Commit

Permalink
Merge pull request #1 from vardario/sahin/fix-stripScriptTag
Browse files Browse the repository at this point in the history
fix: stripScriptTag
  • Loading branch information
sahinvardar authored May 30, 2023
2 parents b82c34d + 59734b4 commit 75a89c4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vardario/svelte-i18next",
"version": "0.1.0",
"version": "0.1.1",
"description": "",
"license": "MIT",
"author": "Sahin Vardar",
Expand Down
2 changes: 1 addition & 1 deletion src/i18n-preprocessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export const i18nProcessor = (options?: I18nProcessorOptions): PreprocessorGroup
adjustI18nKeys(ast, keyPath, callIdentifier);

const transformedCode = printHtml({ ast, indent: options?.indent });
const result = `${scriptTags.join('\n')}${scriptTags.length ? "'n" : ''}${transformedCode}`;
const result = `${scriptTags.join('\n')}${scriptTags.length ? '\n' : ''}${transformedCode}`;
return { code: result };
}
return {
Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export async function scanDir(dir: string, filter?: (file: string) => boolean) {
}

export function stripScriptTag(code: string) {
const scriptTagRegEx = /<.*?script.*?>(.*?)<\/.*?script.*?>/gi;
const scriptTagRegEx = /(<script[\s\S]*?[\s\S\]*?>[\s\S]*?<\/script>)/gi;
const scriptTags: string[] = [];

for (const match of code.matchAll(scriptTagRegEx)) {
Expand Down

0 comments on commit 75a89c4

Please sign in to comment.