Commits

Anonymous committed 5d63527

Adding more code. Mostly expanded service definition code, including
generation of client-side javascript for calling services.

Comments (0)

Files changed (2)

                (:file "tags")
 	       (:file "taglibraries")
 	       (:file "cookies")
+	       (:file "services")
 	       (:file "templates")
 	       (:file "patterns")
 	       (:file "web")
   :depends-on (
 	       ; external packages
 	       "hunchentoot"
+	       "parenscript"
 	       "cl-ppcre"
 
 	       ; project packages
     :initarg :body
     :accessor body-of
     )
+   (class ;; corresponds to class attribute for CSS style information
+    :initform nil
+    :initarg :class
+    :accessor css-class-of
+    )
    )
   )
 
 		  )
   )
 
+(defgeneric tag-has-body-p (somet-tag-symbol)
+  (:documentation "Return t (the default) if a tag expects to 
+   have a tag body; nil otherwise.  If no body, that implies
+   the tag treats the raw body as an initializer for the tag,
+   and that a custom html method will then use the tag's
+   slots to render appropriate html."
+		  )
+  )
+
+(defgeneric tag-separate-initializer-and-body (some-tag-symbol raw-body)
+  (:documentation "Return 2 values (nil if the value is not applicable):
+   the first is the tag initializer, the 2nd is the tag's computed body.
+   Default behavior takes the first list starting ith +@ and uses the
+   cdr of that list as the arguments to a make-instance call for that
+   tag class.  All other items in the list will be returned in the 2nd
+   value for the body of the tag"
+		  )
+)
+
 (defgeneric tag-attributes (*current-tag*)
   (:documentation "Return a list of attribute names for the tag")
   )
 	  (let (
 		(name (quote ,name))
 		)
-	    (multiple-value-bind (initializer body) (separate-initializer-and-body content)
+	    (multiple-value-bind (initializer body) (tag-separate-initializer-and-body (quote ,name) content)
 	      `(let (
 		     (*current-tag* (make-instance (quote ,name)
 						   ,@initializer
 	  )
   )
 
+(defmethod tag-has-body-p ( (some-tag-symbol symbol) )
+  t
+  )
+
+(defmethod tag-separate-initializer-and-body ( (some-tag-symbol symbol) raw-body)
+  (if (tag-has-body-p some-tag-symbol)
+      (let (
+	    (body (select raw-body
+			  (lambda (b) 
+			    (if (and (listp b) (equal '+@ (car b)))
+				nil
+				t
+				)
+			    )
+			  )
+	      )
+	    (initializer (cdr (car (select raw-body
+					   (lambda (b) 
+					     (and (listp b) (equal '+@ (car b)))
+					     )
+					   )
+				   )
+			      )
+	      )
+	    )
+	(values initializer body)
+	)  
+      (values raw-body nil)
+      )
+  )
+
 (defmethod render-as-html ( (*current-tag* htmltag) )
   ;; Render shared aspects first, which may result in no-op if not
   ;; being captured
 		      &key
 		      ((:bases bases) nil) ; other base classes here
 		      ((:attributes attributes) nil)
+		      ((:hasbody hasbody) t)
 		      ((:html as-html) nil)
 		      ((:script script) nil)
 		      ((:ready ready) nil)
        (quote ,name)
        )
 
+     ,(unless hasbody
+	      `(defmethod tag-has-body-p ( (some-tag-symbol (eql (quote ,name) ) ) )
+		 nil
+		 )
+	      )
+
      ,(when script
 	    `(defmethod shared-scripts ( (*current-tag* ,name) )
 	       (list ,script)
 (defmacro page (&rest raw-body)
   "Interpret the raw body as html markup, and return a complete HTML page"
   `(multiple-value-bind (page-attributes body) (separate-initializer-and-body (quote ,raw-body))
+     (declare (ignorable page-attributes) )
      (multiple-value-bind (page-content *page-style-sheets* *page-styles* *page-script-libraries* *page-scripts* *page-ready-scripts*) 
 	   (html (list ,@raw-body) )
 					; now render the page
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.