changeset 775:a8bdd5a0d9b0

css demo
author Adam Chlipala <adamc@hcoop.net>
date Sun, 03 May 2009 12:36:25 -0400
parents 412ccd97ab71
children 9f2555f06901
files demo/css.ur demo/css.urp demo/css.urs demo/prose lib/ur/basis.urs src/monoize.sml
diffstat 6 files changed, 23 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/demo/css.ur	Sun May 03 12:36:25 2009 -0400
@@ -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>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/demo/css.urp	Sun May 03 12:36:25 2009 -0400
@@ -0,0 +1,4 @@
+allow url http://adam.chlipala.net/style.css
+rewrite style Css/quote quote
+
+css
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/demo/css.urs	Sun May 03 12:36:25 2009 -0400
@@ -0,0 +1,1 @@
+val main : unit -> transaction page
--- a/demo/prose	Sun May 03 12:24:39 2009 -0400
+++ b/demo/prose	Sun May 03 12:36:25 2009 -0400
@@ -70,6 +70,10 @@
 
 <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>
--- a/lib/ur/basis.urs	Sun May 03 12:24:39 2009 -0400
+++ b/lib/ur/basis.urs	Sun May 03 12:36:25 2009 -0400
@@ -31,7 +31,7 @@
 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 @@
 val br : bodyTagStandalone []
 
 val span : bodyTag []
+val div : bodyTag []
 
 val p : bodyTag []
 val b : bodyTag []
--- a/src/monoize.sml	Sun May 03 12:24:39 2009 -0400
+++ b/src/monoize.sml	Sun May 03 12:36:25 2009 -0400
@@ -811,7 +811,7 @@
                 ((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