1. Phil Hargett
  2. hh-web-tags


Phil Hargett  committed 081cdb7

Removed concept of keyword arguments to templates (not used, and fragile if used); made templates functions instead of macros

  • Participants
  • Parent commits f695e70
  • Branches default

Comments (0)

Files changed (1)

File templates.lisp

View file
 (defmacro deftemplate (name
-		       ((:args template-args) nil)
-		       ((:kwargs template-keyword-args) nil))
+		       ((:args template-args) nil))
      ;; pre-load -- note that this will likely create definitions in error, because a template cannot be found
      ;; doing this so that a "reload" later can find all the templates to reload
-	 (load-template ,path (quote ,template-args) (quote ,template-keyword-args))
+	 (load-template ,path (quote ,template-args))
        ;; we want to catch this error and continue, in case the template will be
        ;; available later
        (template-not-found-error (c) (format *standard-output* "Delaying load of ~s: ~s~%" ',name c))) 
      ;; create a macro to invoke the template
-     (defmacro ,name (,@template-args ,@(if template-keyword-args `(&key ,@template-keyword-args)) )
-       (let ((path (quote ,path))
-	     (template-args (quote ,template-args) )
-	     (template-arg-values (list ,@template-args) )
-	     (template-keyword-args (quote ,template-keyword-args)))
-	 `(let* ((*tag-library-provider-registry* (or *tag-library-provider-registry* ,(local-template-provider-registry-symbol)))
+     (defun ,name (,@template-args)
+       (let* ((*tag-library-provider-registry* (or *tag-library-provider-registry* ,(local-template-provider-registry-symbol)))
 		 (*template-provider-registry* (or *template-provider-registry* ,(local-template-provider-registry-symbol)))
 		 (tmpl (or (find-cached-template ,path) 
-			  (load-template ,path (quote ,template-args) (quote ,template-keyword-args)))))
+			  (load-template ,path (quote ,template-args)))))
 	    (when tmpl
 	      (let ((*template* tmpl)
 		    (*package* (template-package tmpl)))
-		(funcall (definition-of tmpl) ,@template-arg-values ,@template-keyword-args))))))))
+		(funcall (definition-of tmpl) ,@template-args)))))))
 (defun local-template-provider-registry-symbol () 
   "Returns a symbol in the current package for storing the template provider registry expected by the package"