Skip to content

Commit

Permalink
revert: greedy template directives
Browse files Browse the repository at this point in the history
  • Loading branch information
dominiq007 committed Nov 24, 2023
1 parent 71583ea commit 44fecb1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/templates/template_compiler.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ export class TemplateCompiler {

private async parseEachDirectives(): Promise<void> {
const matches = this.template.matchAll(
/@for\s*\((.*?)\s+(?:in|of)\s+([^\n]*)\)(.*)@\/for/gsm,
/@for\s*\((.*?)\s+(?:in|of)\s+([^\n]*)\)(.*?)@\/for/gsm,
) ?? [];

for (const [wholeMatch, variableName, iterableValue, block] of matches) {
Expand Down Expand Up @@ -647,7 +647,7 @@ export class TemplateCompiler {
const pattern = directive.type === 'single'
? new RegExp(`@${directive.name}\s*(\\((.*?)\\))?`, 'g')
: new RegExp(
`@${directive.name}\\s*(\\(([^\\n]*)\\))?(.*)@\\/${directive.name}`,
`@${directive.name}\\s*(\\(([^\\n]*)\\))?(.*?)@\\/${directive.name}`,
'gsm',
);

Expand Down

0 comments on commit 44fecb1

Please sign in to comment.