From 2285ea3e498f710c714aef5b715766142a7b65d3 Mon Sep 17 00:00:00 2001 From: giles Date: Thu, 16 Apr 2026 17:26:43 +0000 Subject: [PATCH] HS: return via raise/guard, def param fix, script block extraction - Compiler: return compiles to (raise (list "hs-return" value)) - Compiler: def wraps body in guard to catch hs-return exceptions - Compiler: def params extract name from (ref name) nodes - Test generator: extract content blocks.""" + scripts = [] + for m in re.finditer( + r"(.*?)", + html, re.DOTALL + ): + scripts.append(m.group(1).strip()) + return scripts + + def parse_html(html): """Parse HTML into list of element dicts with parent-child relationships. Uses Python's html.parser for reliability with same-tag siblings.""" from html.parser import HTMLParser + # Remove script tags before parsing elements (they're handled separately) + html = re.sub(r".*?", '', html, flags=re.DOTALL) + # Remove | separators html = html.replace(' | ', '') @@ -588,10 +602,20 @@ def generate_test_chai(test, elements, var_names, idx): actions = parse_action(test['action'], ref) checks = parse_checks(test['check']) + # Extract