Implicit then, between, starts/ends with — 339/831 (41%)
Biggest win: HS sources from upstream HTML had newlines replaced with spaces, losing command separation. Now multi-space sequences become 'then' keywords, matching _hyperscript's implicit newline-as-separator behavior. +42 tests passing. Parser: 'is between X and Y', 'is not between', 'starts with', 'ends with' comparison operators. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -431,7 +431,13 @@ def emit_element_setup(lines, elements, var_names):
|
||||
lines.append(f' (dom-add-class {var} "{cls}")')
|
||||
if el['hs']:
|
||||
hs_val = el['hs']
|
||||
hs_val = hs_val.replace('\\', '').replace('\n', ' ').replace('\t', ' ').strip()
|
||||
hs_val = hs_val.replace('\\', '')
|
||||
# Newlines in _hyperscript act as implicit 'then' separators
|
||||
hs_val = re.sub(r'\s*\n\s*', ' then ', hs_val)
|
||||
# Collapse multiple spaces (from HTML formatting)
|
||||
hs_val = re.sub(r'\s{2,}', ' then ', hs_val)
|
||||
hs_val = re.sub(r'(then\s*)+then', 'then', hs_val) # dedupe
|
||||
hs_val = hs_val.strip()
|
||||
if not hs_val:
|
||||
lines.append(f' (dom-append (dom-body) {var})')
|
||||
continue
|
||||
|
||||
@@ -323,9 +323,9 @@ test.describe('Hyperscript behavioral tests', () => {
|
||||
console.log(` [${info.count}x] ${e}`);
|
||||
}
|
||||
// Show samples of "bar" error specifically
|
||||
const barSamples = results.filter(r => !r.p && (r.e||'').includes('Assertion failed')).slice(0, 20);
|
||||
const barSamples = results.filter(r => !r.p && (r.e||'').includes('Expected , got')).slice(0, 15);
|
||||
if (barSamples.length > 0) {
|
||||
console.log(` Assertion failures (${barSamples.length}):`);
|
||||
console.log(` Expected-got failures (${barSamples.length}):`);
|
||||
for (const s of barSamples) console.log(` ${s.s}/${s.n}`);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user