diff --git a/hosts/ocaml/bin/sx_server.ml b/hosts/ocaml/bin/sx_server.ml index 9f3ec4a..4c56206 100644 --- a/hosts/ocaml/bin/sx_server.ml +++ b/hosts/ocaml/bin/sx_server.ml @@ -565,8 +565,21 @@ let make_server_env () = | [Component c] -> Env c.c_closure | [Island i] -> Env i.i_closure | _ -> Dict (Hashtbl.create 0)); - bind "spread?" (fun _args -> Bool false); - bind "spread-attrs" (fun _args -> Dict (Hashtbl.create 0)); + bind "spread?" (fun args -> + match args with [Spread _] -> Bool true | _ -> Bool false); + bind "spread-attrs" (fun args -> + match args with + | [Spread pairs] -> + let d = Hashtbl.create 4 in + List.iter (fun (k, v) -> Hashtbl.replace d k v) pairs; + Dict d + | _ -> Dict (Hashtbl.create 0)); + bind "make-spread" (fun args -> + match args with + | [Dict d] -> + let pairs = Hashtbl.fold (fun k v acc -> (k, v) :: acc) d [] in + Spread pairs + | _ -> Nil); bind "is-html-tag?" (fun args -> match args with | [String s] -> Bool (Sx_render.is_html_tag s)