fix
Browse files- backend_parsers.py +4 -4
backend_parsers.py
CHANGED
|
@@ -130,10 +130,10 @@ def parse_transformers_js_output(code: str) -> Dict[str, str]:
|
|
| 130 |
# Fallback: support === index.html === format if any file is missing
|
| 131 |
if not (files['index.html'] and files['index.js'] and files['style.css']):
|
| 132 |
# Use regex to extract sections - match === markers with optional whitespace and newlines
|
| 133 |
-
#
|
| 134 |
-
html_fallback = re.search(r'===\s*index\.html\s*===\s*[\r\n]*([\s\S]+?)(?=\
|
| 135 |
-
js_fallback = re.search(r'===\s*index\.js\s*===\s*[\r\n]*([\s\S]+?)(?=\
|
| 136 |
-
css_fallback = re.search(r'===\s*style\.css\s*===\s*[\r\n]*([\s\S]+?)
|
| 137 |
|
| 138 |
print(f"[Parser] Fallback extraction - HTML found: {bool(html_fallback)}, JS found: {bool(js_fallback)}, CSS found: {bool(css_fallback)}")
|
| 139 |
|
|
|
|
| 130 |
# Fallback: support === index.html === format if any file is missing
|
| 131 |
if not (files['index.html'] and files['index.js'] and files['style.css']):
|
| 132 |
# Use regex to extract sections - match === markers with optional whitespace and newlines
|
| 133 |
+
# Fixed lookahead to allow any whitespace (not just \n) before next === marker
|
| 134 |
+
html_fallback = re.search(r'===\s*index\.html\s*===\s*[\r\n]*([\s\S]+?)(?=\s*===\s*index\.js\s*===|$)', code, re.IGNORECASE)
|
| 135 |
+
js_fallback = re.search(r'===\s*index\.js\s*===\s*[\r\n]*([\s\S]+?)(?=\s*===\s*style\.css\s*===|$)', code, re.IGNORECASE)
|
| 136 |
+
css_fallback = re.search(r'===\s*style\.css\s*===\s*[\r\n]*([\s\S]+?)$', code, re.IGNORECASE)
|
| 137 |
|
| 138 |
print(f"[Parser] Fallback extraction - HTML found: {bool(html_fallback)}, JS found: {bool(js_fallback)}, CSS found: {bool(css_fallback)}")
|
| 139 |
|