diff src/cjr_print.sml @ 643:aa2290c32ce2

Avoid any JavaScript when pages don't need it; update demo prose
author Adam Chlipala <adamc@hcoop.net>
date Tue, 10 Mar 2009 10:44:26 -0400
parents b98f547a6a45
children 1b571a05874c
line wrap: on
line diff
--- a/src/cjr_print.sml	Sun Mar 08 20:34:21 2009 -0400
+++ b/src/cjr_print.sml	Tue Mar 10 10:44:26 2009 -0400
@@ -1,4 +1,4 @@
-(* Copyright (c) 2008, Adam Chlipala
+(* Copyright (c) 2008-2009, Adam Chlipala
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -2130,7 +2130,7 @@
                                                 E.declBinds env d))
                              env ds
 
-        val fields = foldl (fn ((ek, _, _, ts, _), fields) =>
+        val fields = foldl (fn ((ek, _, _, ts, _, _), fields) =>
                                case ek of
                                    Core.Link => fields
                                  | Core.Rpc => fields
@@ -2251,7 +2251,7 @@
                              string "}"]
                 end
 
-        fun p_page (ek, s, n, ts, ran) =
+        fun p_page (ek, s, n, ts, ran, side) =
             let
                 val (ts, defInputs, inputsVar) =
                     case ek of
@@ -2346,6 +2346,12 @@
                                     string "uw_write_header(ctx, \"Content-script-type: text/javascript\\r\\n\");",
                                     newline,
                                     string "uw_write(ctx, \"<html>\");",
+                                    newline,
+                                    string "uw_set_script_header(ctx, \"",
+                                    string (case side of
+                                                ServerAndClient => "<script src=\\\"/app.js\\\"></script>\\n"
+                                              | ServerOnly => ""),
+                                    string "\");",
                                     newline]),
                      box [string "{",
                           newline,