Skip to content

Commit

Permalink
fix: remove template placeholders (#471)
Browse files Browse the repository at this point in the history
  • Loading branch information
akosbalasko authored May 9, 2023
1 parent 62d4e19 commit 55d0aa7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/utils/templates/match-all.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const MATCH_ALL = '(.|\r?\n)*';
export const MATCH_LF = '\r?\n';
export const MATCH_LF = '\r?\n?';
3 changes: 1 addition & 2 deletions src/utils/templates/remove-functions/remove-placeholder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import * as M from '../match-all';

export const removePlaceholder = (text: string, P: any): string => {
return text.replace(
new RegExp(
`${P.START_BLOCK}([\\D\\d])(?:.|\n)*?(?=${P.END_BLOCK})${P.END_BLOCK}${M.MATCH_LF}`,
new RegExp(`${P.START_BLOCK}(?<=${P.START_BLOCK})(.*)(?=${P.END_BLOCK})${P.END_BLOCK}${M.MATCH_LF}`,
'g',
),
'',
Expand Down
1 change: 1 addition & 0 deletions test/data/template_tags_bottom.templ
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{metadata-block}
{created-at-block}_Created at {created-at}._{end-created-at-block}
{updated-at-block}_Last updated at {updated-at}._{end-updated-at-block}
{source-url-block}_Source Url[] {source-url}._{end-source-url-block}
{end-metadata-block}


Expand Down

0 comments on commit 55d0aa7

Please sign in to comment.