Fix examples.sx: paren balance + dict eval crash at startup
1. Extra closing paren in ex-tabs handler 2. tab-content dict values contained (div ...) HTML tags which crash during register_components since HTML primitives aren't in env Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -561,3 +561,15 @@ def prim_into(target: Any, coll: Any) -> Any:
|
||||
return result
|
||||
raise ValueError(f"into: unsupported target type {type(target).__name__}")
|
||||
|
||||
|
||||
@register_primitive("random-int")
|
||||
def prim_random_int(low: int, high: int) -> int:
|
||||
import random
|
||||
return random.randint(int(low), int(high))
|
||||
|
||||
|
||||
@register_primitive("json-encode")
|
||||
def prim_json_encode(value) -> str:
|
||||
import json
|
||||
return json.dumps(value, indent=2)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user