Welcome to the CHICKEN Scheme pasting service

awful's literal-script/style? added by mario-goulart on Tue Nov 6 22:11:16 2012

diff --git a/awful.scm b/awful.scm
index 00e856b..2af9e26 100644
--- a/awful.scm
+++ b/awful.scm
@@ -14,7 +14,7 @@
    awful-response-headers development-mode? enable-web-repl-fancy-editor
    web-repl-fancy-editor-base-uri awful-listen awful-accept awful-backlog
    awful-listener javascript-position awful-resources-table sxml->html
-   enable-sxml
+   enable-sxml literal-script/style?
 
    ;; Procedures
    ++ concat include-javascript add-javascript debug debug-pp $session
@@ -95,6 +95,7 @@
                                  (set-cookie! (session-cookie-name) sid))))
 (define javascript-position (make-parameter 'top))
 (define enable-sxml (make-parameter #f))
+(define literal-script/style? (make-parameter #f))
 (define sxml->html
   (make-parameter
    (let ((rules `((literal *preorder* . ,(lambda (t b) b))
@@ -549,19 +550,26 @@
 (define (undefine-page path #!key vhost-root-path (method 'GET))
   (hash-table-delete! *resources* (list path (or vhost-root-path (root-path)) method)))
 
+(define (maybe-literal-javascript js)
+  (if (and (enable-sxml) (literal-script/style?))
+      `(literal ,js)
+      js))
+
 (define (include-page-javascript ajax? no-javascript-compression)
   (if ajax?
       (<script> type: "text/javascript"
-                (maybe-compress-javascript
-                 (++ "$(document).ready(function(){"
-                     (page-javascript) "});")
-                 no-javascript-compression))
+                (maybe-literal-javascript
+                 (maybe-compress-javascript
+                  (++ "$(document).ready(function(){"
+                      (page-javascript) "});")
+                  no-javascript-compression)))
       (if (string-null? (page-javascript))
           ""
-          (<script> type: "text/javascript"
-                    (maybe-compress-javascript
-                     (page-javascript)
-                     no-javascript-compression)))))
+          (maybe-literal-javascript
+           (<script> type: "text/javascript"
+                     (maybe-compress-javascript
+                      (page-javascript)
+                      no-javascript-compression))))))
 
 (define (page-path path #!optional namespace)
   (cond ((regexp? path) path)

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
What's the procedure that returns the car of a car?
Visually impaired? Let me spell it for you (wav file) download WAV