diff options
author | Adam Chlipala <adamc@hcoop.net> | 2009-05-03 12:36:25 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2009-05-03 12:36:25 -0400 |
commit | 4be41963bba445bb3bb26d5e05883f7eb72a9a22 (patch) | |
tree | fc89f9e8ddc1f6bba852276509eca2f74195c996 | |
parent | d8de44ce7c70fc8ce462e764223e413a9a6ea6b6 (diff) |
css demo
-rw-r--r-- | demo/css.ur | 11 | ||||
-rw-r--r-- | demo/css.urp | 4 | ||||
-rw-r--r-- | demo/css.urs | 1 | ||||
-rw-r--r-- | demo/prose | 4 | ||||
-rw-r--r-- | lib/ur/basis.urs | 3 | ||||
-rw-r--r-- | src/monoize.sml | 2 |
6 files changed, 23 insertions, 2 deletions
diff --git a/demo/css.ur b/demo/css.ur new file mode 100644 index 00000000..0c1d8f70 --- /dev/null +++ b/demo/css.ur @@ -0,0 +1,11 @@ +style quote + +fun main () = return <xml> + <head> + <link rel="stylesheet" type="text/css" href="http://adam.chlipala.net/style.css"/> + </head> + + <body> + <div class={quote}>Here's a quote.</div> + </body> +</xml> diff --git a/demo/css.urp b/demo/css.urp new file mode 100644 index 00000000..150808de --- /dev/null +++ b/demo/css.urp @@ -0,0 +1,4 @@ +allow url http://adam.chlipala.net/style.css +rewrite style Css/quote quote + +css diff --git a/demo/css.urs b/demo/css.urs new file mode 100644 index 00000000..6ac44e0b --- /dev/null +++ b/demo/css.urs @@ -0,0 +1 @@ +val main : unit -> transaction page @@ -70,6 +70,10 @@ url.urp <p>Further, each Ur/Web application enforces a global condition on which strings are allowed as URLs. The <tt>.urp</tt> file for this demo shows an example that specifies particular rules about which URLs are allowed. You can try entering a variety of URLs on the form on the front page. Only those satisfying the <tt>allow url</tt>/<tt>deny url</tt> conditions should be permitted.</p> +css.urp + +<p>Ur/Web supports a structured approach to Cascading Style Sheets, where each style is a first-class value within a module. This demo shows the importing of an external style sheet with one style. By default, like other Ur/Web entities, the name of the style would be <tt>Css_quote</tt>. We use the <tt>rewrite</tt> directive in the <tt>.urp</tt> file to specify an alternate name for a particular canonical module path. The external style sheet contains a definition of a style with the alternate name that we give.</p> + listShop.urp <p>This example shows off algebraic datatypes, parametric polymorphism, and functors.</p> diff --git a/lib/ur/basis.urs b/lib/ur/basis.urs index 25ad2786..ea4432cd 100644 --- a/lib/ur/basis.urs +++ b/lib/ur/basis.urs @@ -31,7 +31,7 @@ val neg : t ::: Type -> num t -> t -> t val plus : t ::: Type -> num t -> t -> t -> t val minus : t ::: Type -> num t -> t -> t -> t val times : t ::: Type -> num t -> t -> t -> t -val div : t ::: Type -> num t -> t -> t -> t +val divide : t ::: Type -> num t -> t -> t -> t val mod : t ::: Type -> num t -> t -> t -> t val num_int : num int val num_float : num float @@ -536,6 +536,7 @@ con bodyTagStandalone = fn (attrs :: {Type}) => val br : bodyTagStandalone [] val span : bodyTag [] +val div : bodyTag [] val p : bodyTag [] val b : bodyTag [] diff --git a/src/monoize.sml b/src/monoize.sml index 877e1a2c..4b6b3c5f 100644 --- a/src/monoize.sml +++ b/src/monoize.sml @@ -811,7 +811,7 @@ fun monoExp (env, st, fm) (all as (e, loc)) = ((L'.EAbs ("r", numTy t, (L'.TFun (t, (L'.TFun (t, t), loc)), loc), (L'.EField ((L'.ERel 0, loc), "Times"), loc)), loc), fm) end - | L.ECApp ((L.EFfi ("Basis", "div"), _), t) => + | L.ECApp ((L.EFfi ("Basis", "divide"), _), t) => let val t = monoType env t in |