Revision: 3883
Author: hans
URL: http://bknr.net/trac/changeset/3883
Implement :catch-all template handler option. If it is set, the
default-template is used for all requests that do not match a
specific template. It obviously needs to be put at the end of the
handler list.
U trunk/bknr/web/src/web/template-handler.lisp
Modified: trunk/bknr/web/src/web/template-handler.lisp
===================================================================
--- trunk/bknr/web/src/web/template-handler.lisp 2008-09-10 15:55:20 UTC (rev 3882)
+++ trunk/bknr/web/src/web/template-handler.lisp 2008-09-10 15:59:45 UTC (rev 3883)
@@ -43,7 +43,11 @@
:reader template-expander-default-template
:documentation
"Name of the default template to use when no path
-name has been specified.")))
+name has been specified.")
+ (catch-all :initarg :catch-all :initform nil
+ :reader template-expander-catch-all
+ :documentation "If non-NIL, direct all requests to the
+ default template.")))
(defmethod find-tag-function ((expander template-expander) name ns)
(let ((package-name (cdr (find ns (template-expander-command-packages expander)
@@ -226,11 +230,15 @@
(remove "" (split "/" path) :test #'equal))
(defmethod find-template-pathname ((expander template-expander) template-name)
- (let ((components (or (split-path template-name)
- (and (template-expander-default-template expander)
- (split-path (template-expander-default-template expander))))))
+ (let* ((default-template-components (and (template-expander-default-template expander)
+ (split-path (template-expander-default-template expander))))
+ (components (or (split-path template-name) default-template-components)))
(multiple-value-bind (pathname ret-components)
- (find-template (template-expander-destination expander) components)
+ (find-template (template-expander-destination expander) components)
+ (when (and (not pathname)
+ (template-expander-catch-all expander))
+ (multiple-value-setq (pathname ret-components)
+ (find-template (template-expander-destination expander) default-template-components)))
(unless pathname
(template-not-found template-name))
(values pathname
Revision: 3881
Author: hans
URL: http://bknr.net/trac/changeset/3881
Consolidate all HTML into one template. Remove template names from URL.
Improve Javascript-less mode.
_U trunk/projects/quickhoney/src/
U trunk/projects/quickhoney/src/config.lisp
U trunk/projects/quickhoney/src/init.lisp
U trunk/projects/quickhoney/src/tags.lisp
U trunk/projects/quickhoney/src/webserver.lisp
D trunk/projects/quickhoney/website/static/frontpage.css
D trunk/projects/quickhoney/website/static/image-browse.css
U trunk/projects/quickhoney/website/static/index.css
U trunk/projects/quickhoney/website/static/javascript.js
D trunk/projects/quickhoney/website/templates/frontpage.xml
D trunk/projects/quickhoney/website/templates/image-browse.xml
U trunk/projects/quickhoney/website/templates/index.xml
Change set too large, please see URL above