Mercurial > urweb
changeset 1292:a671c986f517
Support multiple CSS classes for a single tag
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Sun, 05 Sep 2010 12:50:06 -0400 |
parents | be6e2cd8d9a9 |
children | acabf3935060 |
files | lib/ur/basis.urs src/monoize.sml tests/css.ur tests/css.urp tests/css.urs |
diffstat | 5 files changed, 20 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/ur/basis.urs Sat Sep 04 14:12:02 2010 -0400 +++ b/lib/ur/basis.urs Sun Sep 05 12:50:06 2010 -0400 @@ -563,6 +563,9 @@ (** XML *) type css_class +val classes : css_class -> css_class -> css_class +(* The equivalent of writing one class after the other, separated by a space, in + * an HTML 'class' attribute *) con tag :: {Type} -> {Unit} -> {Unit} -> {Type} -> {Type} -> Type
--- a/src/monoize.sml Sat Sep 04 14:12:02 2010 -0400 +++ b/src/monoize.sml Sun Sep 05 12:50:06 2010 -0400 @@ -2806,6 +2806,15 @@ ((L'.ESetval (e1, e2), loc), fm) end + | L.EFfiApp ("Basis", "classes", [s1, s2]) => + let + val (s1, fm) = monoExp (env, st, fm) s1 + val (s2, fm) = monoExp (env, st, fm) s2 + in + ((L'.EStrcat (s1, (L'.EStrcat ((L'.EPrim (Prim.String " "), loc), s2), loc)), loc), + fm) + end + | L.EApp ( (L.ECApp ( (L.ECApp ((L.EFfi ("Basis", "cdata"), _), _), _),
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/css.ur Sun Sep 05 12:50:06 2010 -0400 @@ -0,0 +1,6 @@ +style st1 +style st2 + +fun main () = return <xml><body> + <span title="Whoa" class={classes st1 st2}>Hi!</span> +</body></xml>