summaryrefslogtreecommitdiff
path: root/src/monoize.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-01-27 09:53:51 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-01-27 09:53:51 -0500
commitf75d359eeaaca5884d515380b735826532fad15c (patch)
tree7baa355a0b01c717860e5324b8376d52a3a26180 /src/monoize.sml
parent9d4b65c06d1277c74e0c6f782f0e2b93d7919da2 (diff)
Use normal fields of ctextboxes
Diffstat (limited to 'src/monoize.sml')
-rw-r--r--src/monoize.sml45
1 files changed, 35 insertions, 10 deletions
diff --git a/src/monoize.sml b/src/monoize.sml
index 8d5ed36c..80661d03 100644
--- a/src/monoize.sml
+++ b/src/monoize.sml
@@ -1777,12 +1777,12 @@ fun monoExp (env, st, fm) (all as (e, loc)) =
L'.ERecord xes => xes
| _ => raise Fail "Non-record attributes!"
+ fun lowercaseFirst "" = ""
+ | lowercaseFirst s = String.str (Char.toLower (String.sub (s, 0)))
+ ^ String.extract (s, 1, NONE)
+
fun tagStart tag =
let
- fun lowercaseFirst "" = ""
- | lowercaseFirst s = String.str (Char.toLower (String.sub (s, 0)))
- ^ String.extract (s, 1, NONE)
-
val s = (L'.EPrim (Prim.String (String.concat ["<", tag])), loc)
in
foldl (fn (("Action", _, _), acc) => acc
@@ -1897,6 +1897,26 @@ fun monoExp (env, st, fm) (all as (e, loc)) =
normal ()
| _ => normal ()
end
+
+ fun setAttrs jexp =
+ let
+ val s = (L'.EPrim (Prim.String (String.concat ["<", tag])), loc)
+
+ val assgns = List.mapPartial
+ (fn ("Source", _, _) => NONE
+ | (x, e, _) =>
+ SOME (strcat [str ("d." ^ lowercaseFirst x ^ "="),
+ (L'.EJavaScript (L'.Script, e, NONE), loc),
+ str ";"]))
+ attrs
+ in
+ case assgns of
+ [] => jexp
+ | _ => strcat (str "var d="
+ :: jexp
+ :: str ";"
+ :: assgns)
+ end
in
case tag of
"body" => normal ("body", NONE,
@@ -2002,12 +2022,17 @@ fun monoExp (env, st, fm) (all as (e, loc)) =
loc), fm)
end
| SOME (_, src, _) =>
- (strcat [str "<script type=\"text/javascript\">inp(\"input\",",
- (L'.EJavaScript (L'.Script, src, NONE), loc),
- str ")</script>"],
- fm))
-
- | "option" => normal ("option", NONE, NONE)
+ let
+ val sc = strcat [str "inp(\"input\",",
+ (L'.EJavaScript (L'.Script, src, NONE), loc),
+ str ")"]
+ val sc = setAttrs sc
+ in
+ (strcat [str "<script type=\"text/javascript\">",
+ sc,
+ str "</script>"],
+ fm)
+ end)
| "tabl" => normal ("table", NONE, NONE)
| _ => normal (tag, NONE, NONE)