diff src/monoize.sml @ 1173:983d9b38abc7

Fix parsing of space-free .urp directives; use 'class' for 'c*' tags
author Adam Chlipala <adamc@hcoop.net>
date Sun, 28 Feb 2010 15:46:41 -0500
parents 69f1d39d3f2d
children 51e596feec37
line wrap: on
line diff
--- a/src/monoize.sml	Sun Feb 28 13:06:10 2010 -0500
+++ b/src/monoize.sml	Sun Feb 28 15:46:41 2010 -0500
@@ -2787,12 +2787,28 @@
                                                        (L'.EJavaScript (L'.Script, e), loc),
                                                        str ");"]))
                                      attrs
+
+                        val t = (L'.TFfi ("Basis", "string"), loc)
+                        val setClass = (L'.ECase (class,
+                                                  [((L'.PNone t, loc),
+                                                    str ""),
+                                                   ((L'.PSome (t, (L'.PVar ("x", t), loc)), loc),
+                                                    (L'.EStrcat ((L'.EPrim (Prim.String "d.className=\""), loc),
+                                                                 (L'.EStrcat ((L'.ERel 0, loc),
+                                                                              (L'.EPrim (Prim.String "\";"), loc)), loc)),
+                                                     loc))],
+                                                  {disc = (L'.TOption t, loc),
+                                                   result = t}), loc)
                     in
                         case assgns of
-                            [] => jexp
+                            [] => strcat [str "var d=",
+                                          jexp,
+                                          str ";",
+                                          setClass]
                           | _ => strcat (str "var d="
                                          :: jexp
                                          :: str ";"
+                                         :: setClass
                                          :: assgns)
                     end