summaryrefslogtreecommitdiff
path: root/src/monoize.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-04-12 14:19:15 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-04-12 14:19:15 -0400
commit18614e3602ef4b45deaef419bb6716d1af4c9881 (patch)
tree09447cbf30adcc3cc79bc4ebe766f74d8a60a4a9 /src/monoize.sml
parent4cefbfc84784d48531587e1b2687348d6f6b3700 (diff)
Classes as optional arguments to Basis.tag
Diffstat (limited to 'src/monoize.sml')
-rw-r--r--src/monoize.sml24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/monoize.sml b/src/monoize.sml
index f14b6021..51fae113 100644
--- a/src/monoize.sml
+++ b/src/monoize.sml
@@ -131,6 +131,7 @@ fun monoType env =
(L'.TFfi ("Basis", "string"), loc)
| L.CApp ((L.CApp ((L.CFfi ("Basis", "xhtml"), _), _), _), _) =>
(L'.TFfi ("Basis", "string"), loc)
+ | L.CFfi ("Basis", "css_class") => (L'.TFfi ("Basis", "string"), loc)
| L.CApp ((L.CFfi ("Basis", "transaction"), _), t) =>
(L'.TFun ((L'.TRecord [], loc), mt env dtmap t), loc)
@@ -2035,7 +2036,7 @@ fun monoExp (env, st, fm) (all as (e, loc)) =
| L.EApp (
(L.EApp (
(L.EApp (
- (L.ECApp (
+ (L.EApp (
(L.ECApp (
(L.ECApp (
(L.ECApp (
@@ -2043,8 +2044,10 @@ fun monoExp (env, st, fm) (all as (e, loc)) =
(L.ECApp (
(L.ECApp (
(L.ECApp (
- (L.EFfi ("Basis", "tag"),
- _), _), _), _), _), _), _), _), _), _), _), _), _), _), _), _), _),
+ (L.ECApp (
+ (L.EFfi ("Basis", "tag"),
+ _), _), _), _), _), _), _), _), _), _), _), _), _), _), _), _), _),
+ class), _),
attrs), _),
tag), _),
xml) =>
@@ -2096,9 +2099,24 @@ fun monoExp (env, st, fm) (all as (e, loc)) =
| lowercaseFirst s = String.str (Char.toLower (String.sub (s, 0)))
^ String.extract (s, 1, NONE)
+ val (class, fm) = monoExp (env, st, fm) class
+
fun tagStart tag =
let
+ val t = (L'.TFfi ("Basis", "string"), loc)
val s = (L'.EPrim (Prim.String (String.concat ["<", tag])), loc)
+
+ val s = (L'.ECase (class,
+ [((L'.PNone t, loc),
+ s),
+ ((L'.PSome (t, (L'.PVar ("x", t), loc)), loc),
+ (L'.EStrcat (s,
+ (L'.EStrcat ((L'.EPrim (Prim.String " class=\""), loc),
+ (L'.EStrcat ((L'.ERel 0, loc),
+ (L'.EPrim (Prim.String "\""), loc)),
+ loc)), loc)), loc))],
+ {disc = (L'.TOption t, loc),
+ result = t}), loc)
in
foldl (fn (("Action", _, _), acc) => acc
| (("Source", _, _), acc) => acc