Skip to content

Commit e579428

Browse files
committed
✨ fix(core): correct regex for closing tags in blade-foreach handling
- Update regex patterns for `<blade-foreach-auto>` and `<blade-foreach>` to ensure proper matching of closing tags.
1 parent 28d00a7 commit e579428

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

scripts/react-email-renderer.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ function postProcessBlade(html: string): string {
114114
// ---- 1. blade-foreach-auto (from smart-proxy .map()) ----
115115
// These contain $$arrayName__ITEM__.prop$$ markers that need special handling.
116116
html = html.replace(
117-
/<blade-foreach-auto[\s\S]*?data-items="([^"]+)"[\s\S]*?>([\s\S]*?)<\/blade-foreach-auto>/g,
117+
/<blade-foreach-auto[\s\S]*?data-items="([^"]+)"[\s\S]*?>([\s\S]*?)<\/blade-foreach-auto\s*>/g,
118118
(_match, items: string, content: string) => {
119119
const foreachVar = varToBlade(items);
120120

@@ -137,7 +137,7 @@ function postProcessBlade(html: string): string {
137137

138138
// ---- 2. blade-foreach (from BladeForEach component) ----
139139
html = html.replace(
140-
/<blade-foreach[\s\S]*?data-items="([^"]+)"[\s\S]*?>([\s\S]*?)<\/blade-foreach>/g,
140+
/<blade-foreach[\s\S]*?data-items="([^"]+)"[\s\S]*?>([\s\S]*?)<\/blade-foreach\s*>/g,
141141
(_match, items: string, content: string) => {
142142
const foreachVar = varToBlade(items);
143143
return `@foreach(${foreachVar} as $item)\n${content}\n@endforeach`;
@@ -146,7 +146,7 @@ function postProcessBlade(html: string): string {
146146

147147
// ---- 3. blade-if (from BladeIf component) ----
148148
html = html.replace(
149-
/<blade-if[\s\S]*?data-condition="([^"]+)"[\s\S]*?>([\s\S]*?)<\/blade-if>/g,
149+
/<blade-if[\s\S]*?data-condition="([^"]+)"[\s\S]*?>([\s\S]*?)<\/blade-if\s*>/g,
150150
(_match, condition: string, content: string) => {
151151
const bladeCondition = convertConditionToBlade(condition);
152152
return `@if(${bladeCondition})\n${content}\n@endif`;

0 commit comments

Comments
 (0)