# HG changeset patch # User Adam Chlipala # Date 1239897644 14400 # Node ID 12ec14a6be0ba9b97c79e9a8987fd7583bb7d2fb # Parent 311ca1ae715d0a67f5de147aeb2a1eae6c0e3e6e diff -r 311ca1ae715d -r 12ec14a6be0b lib/ur/basis.urs --- a/lib/ur/basis.urs Mon Apr 13 08:44:32 2009 -0400 +++ b/lib/ur/basis.urs Thu Apr 16 12:00:44 2009 -0400 @@ -452,11 +452,15 @@ con tabl = [Body, Table] con tr = [Body, Tr] +type url +val bless : string -> url + val dyn : use ::: {Type} -> bind ::: {Type} -> unit -> tag [Signal = signal (xml body use bind)] body [] use bind val head : unit -> tag [] html head [] [] val title : unit -> tag [] head [] [] [] +val link : unit -> tag [Rel = string, Typ = string, Href = url, Media = string] head [] [] [] val body : unit -> tag [Onload = transaction unit] html body [] [] con bodyTag = fn (attrs :: {Type}) => @@ -489,8 +493,6 @@ val hr : bodyTag [] -type url -val bless : string -> url val a : bodyTag [Link = transaction page, Href = url, Onclick = transaction unit] val img : bodyTag [Src = url] diff -r 311ca1ae715d -r 12ec14a6be0b src/monoize.sml --- a/src/monoize.sml Mon Apr 13 08:44:32 2009 -0400 +++ b/src/monoize.sml Thu Apr 16 12:00:44 2009 -0400 @@ -2168,6 +2168,10 @@ | "Action" => urlifyExp | _ => attrifyExp + val x = + case x of + "Typ" => "Type" + | _ => x val xp = " " ^ lowercaseFirst x ^ "=\"" val (e, fm) = fooify env fm (e, t) diff -r 311ca1ae715d -r 12ec14a6be0b src/urweb.grm --- a/src/urweb.grm Mon Apr 13 08:44:32 2009 -0400 +++ b/src/urweb.grm Thu Apr 16 12:00:44 2009 -0400 @@ -1308,19 +1308,26 @@ attr : SYMBOL EQ attrv (if SYMBOL = "class" then Class attrv else - Normal ((CName (capitalize SYMBOL), s (SYMBOLleft, SYMBOLright)), - if (SYMBOL = "href" orelse SYMBOL = "src") - andalso (case #1 attrv of - EPrim _ => true - | _ => false) then - let - val loc = s (attrvleft, attrvright) - in - (EApp ((EVar (["Basis"], "bless", Infer), loc), - attrv), loc) - end - else - attrv)) + let + val sym = + case SYMBOL of + "type" => "Typ" + | x => capitalize x + in + Normal ((CName sym, s (SYMBOLleft, SYMBOLright)), + if (sym = "Href" orelse sym = "Src") + andalso (case #1 attrv of + EPrim _ => true + | _ => false) then + let + val loc = s (attrvleft, attrvright) + in + (EApp ((EVar (["Basis"], "bless", Infer), loc), + attrv), loc) + end + else + attrv) + end) attrv : INT (EPrim (Prim.Int INT), s (INTleft, INTright)) | FLOAT (EPrim (Prim.Float FLOAT), s (FLOATleft, FLOATright)) diff -r 311ca1ae715d -r 12ec14a6be0b tests/style.ur --- a/tests/style.ur Mon Apr 13 08:44:32 2009 -0400 +++ b/tests/style.ur Thu Apr 16 12:00:44 2009 -0400 @@ -1,6 +1,11 @@ style q style r -fun main () : transaction page = return - Hi. And hi again! - +fun main () : transaction page = return + + + + + Hi. And hi again! + +