diff options
author | Sergey Mironov <grrwlf@gmail.com> | 2013-12-06 13:59:39 +0400 |
---|---|---|
committer | Sergey Mironov <grrwlf@gmail.com> | 2013-12-06 13:59:39 +0400 |
commit | eb64746b388cd3a3864e70039a0c04929b6bbd61 (patch) | |
tree | 0327311311073a9c0a5c7b6e5fd835d66c6f61a1 | |
parent | d89fd37a66ab73ea7eba5e2574c4e679c4026f0b (diff) |
Add activeHead tag.
activeHead is similar to active but produces xhead instead of xbody
-rw-r--r-- | lib/ur/basis.urs | 3 | ||||
-rw-r--r-- | src/monoize.sml | 12 |
2 files changed, 14 insertions, 1 deletions
diff --git a/lib/ur/basis.urs b/lib/ur/basis.urs index 4931c97a..7637f8fa 100644 --- a/lib/ur/basis.urs +++ b/lib/ur/basis.urs @@ -782,6 +782,9 @@ val dyn : ctx ::: {Unit} -> use ::: {Type} -> bind ::: {Type} -> [ctx ~ [Dyn]] = val active : unit -> tag [Code = transaction xbody] body [] [] [] +val activeHead : unit + -> tag [Code = transaction xhead] head [] [] [] + val head : unit -> tag [] html head [] [] val title : unit -> tag [] head [] [] [] val link : unit -> tag [Id = id, Rel = string, Typ = string, Href = url, Media = string] head [] [] [] diff --git a/src/monoize.sml b/src/monoize.sml index 3df6ec92..8889937e 100644 --- a/src/monoize.sml +++ b/src/monoize.sml @@ -3264,7 +3264,7 @@ fun monoExp (env, st, fm) (all as (e, loc)) = val (style, fm) = monoExp (env, st, fm) style val (dynStyle, fm) = monoExp (env, st, fm) dynStyle - val dynamics = ["dyn", "ctextbox", "ccheckbox", "cselect", "coption", "ctextarea", "active"] + val dynamics = ["dyn", "ctextbox", "ccheckbox", "cselect", "coption", "ctextarea", "active", "activeHead"] fun isSome (e, _) = case e of @@ -3600,6 +3600,16 @@ fun monoExp (env, st, fm) (all as (e, loc)) = fm) | _ => raise Fail "Monoize: Bad <active> attributes") + | "activeHead" => + (case attrs of + [("Code", e, _)] => + ((L'.EStrcat + ((L'.EPrim (Prim.String ("<script type=\"text/javascript\">active(execD(")), loc), + (L'.EStrcat ((L'.EJavaScript (L'.Script, e), loc), + (L'.EPrim (Prim.String ("))</script>")), loc)), loc)), loc), + fm) + | _ => raise Fail "Monoize: Bad <activeHead> attributes") + | "submit" => normal ("input type=\"submit\"", NONE) | "image" => normal ("input type=\"image\"", NONE) | "button" => normal ("input type=\"submit\"", NONE) |