diff src/urweb.grm @ 1412:5f4fee8a4dcd

Allow CSS class specification for <form>
author Adam Chlipala <adam@chlipala.net>
date Sun, 23 Jan 2011 11:18:24 -0500
parents af501150678a
children 146b69c53304
line wrap: on
line diff
--- a/src/urweb.grm	Sat Jan 22 12:55:48 2011 -0500
+++ b/src/urweb.grm	Sun Jan 23 11:18:24 2011 -0500
@@ -311,7 +311,7 @@
  | xml of exp
  | xmlOne of exp
  | xmlOpt of exp
- | tag of (string * exp) * exp
+ | tag of (string * exp) * exp option * exp
  | tagHead of string * exp
  | bind of string * con option * exp
  | edecl of edecl
@@ -1383,7 +1383,7 @@
                                                                 (EPrim (Prim.String ""), pos)),
                                                           pos)
                                          in
-                                             (EApp (#2 tag, cdata), pos)
+                                             (EApp (#3 tag, cdata), pos)
                                          end)
          
        | tag GT xmlOpt END_TAG          (let
@@ -1392,8 +1392,14 @@
                                          in
                                              if #1 (#1 tag) = et then
                                                  if et = "form" then
-                                                     (EApp ((EVar (["Basis"], "form", Infer), pos),
-                                                            xmlOpt), pos)
+                                                     let
+                                                         val e = (EVar (["Basis"], "form", Infer), pos)
+                                                         val e = (EApp (e, case #2 tag of
+                                                                               NONE => (EVar (["Basis"], "None", Infer), pos)
+                                                                             | SOME c => (EApp ((EVar (["Basis"], "Some", Infer), pos), c), pos)), pos)
+                                                     in
+                                                         (EApp (e, xmlOpt), pos)
+                                                     end
                                                  else if et = "subform" orelse et = "subforms" then
                                                      (EApp (#2 (#1 tag),
                                                             xmlOpt), pos)
@@ -1401,7 +1407,7 @@
                                                      (EApp ((EVar (["Basis"], "entry", Infer), pos),
                                                             xmlOpt), pos)
                                                  else
-                                                     (EApp (#2 tag, xmlOpt), pos)
+                                                     (EApp (#3 tag, xmlOpt), pos)
                                              else
                                                  (if ErrorMsg.anyErrors () then
                                                       ()
@@ -1434,7 +1440,7 @@
                                              val e = (EApp (e, (EApp (#2 tagHead,
                                                                       (ERecord [], pos)), pos)), pos)
                                          in
-                                             (tagHead, e)
+                                             (tagHead, #1 attrs, e)
                                          end)
 
 tagHead: BEGIN_TAG                      (let