X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=web-utils-aserve.lisp;h=19ed28c5d92997bce5ada3f8d9df283a42e740d2;hb=3f50791d43f83b9141e4022ce1fd2460edf62436;hp=13782e36b02026f3b3f3cceab72daf75a2ab4e23;hpb=0e5343fda28c559f11e003805727f4c625d178f3;p=kmrcl.git diff --git a/web-utils-aserve.lisp b/web-utils-aserve.lisp index 13782e3..19ed28c 100644 --- a/web-utils-aserve.lisp +++ b/web-utils-aserve.lisp @@ -1,3 +1,4 @@ + ;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*- ;;;; ************************************************************************* ;;;; FILE IDENTIFICATION @@ -7,18 +8,18 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: Apr 2000 ;;;; -;;;; $Id: web-utils-aserve.lisp,v 1.2 2002/10/06 13:30:17 kevin Exp $ +;;;; $Id: web-utils-aserve.lisp,v 1.7 2002/10/16 22:56:07 kevin Exp $ ;;;; -;;;; This file, part of Kmrcl, is Copyright (c) 2002 by Kevin M. Rosenberg +;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg ;;;; -;;;; Kmrcl users are granted the rights to distribute and use this software -;;;; as governed by the terms of the GNU General Public License. +;;;; KMRCL users are granted the rights to distribute and use this software +;;;; as governed by the terms of the Lisp Lesser GNU Public License +;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. ;;;; ************************************************************************* - (in-package :kmrcl) -(declaim (optimize (speed 3) (safety 1))) +(declaim (optimize (speed 3) (safety 1) (compilation-speed 0) (debug 3))) ;;; AllegroServe interaction functions @@ -84,40 +85,50 @@ (princ-http "Browser Home")) (princ-http "

")) -(defun head (title-str) +(defun head (title-str &key css) + (unless css + (setq css "http://b9.com/main.css")) (net.html.generator:html - (:head - "" + (:head + (princ-http (format nil "" css)) (:title (:princ-safe title-str))))) ;;; Page wrappers -(defmacro with-xml-page (title &rest body) - `(prog1 - (progn - (net.html.generator:html - (princ-http (std-xml-header)) - (princ-http "")) - (with-tag "pagetitle" (princ-http ,title)) - ,@body) - (princ-http ""))) - -(defmacro with-trans-page (title &rest body) - `(prog1 - (progn - (print-http "") - (print-http "") - (print-http "") - (print-http "") - (head ,title) - (print-http "") - (prog1 - ,@body - (print-http ""))) - (print-http ""))) +(defmacro with-page ((title &key css (format :xhtml)) &rest body) + (case format + (:xhtml + `(prog1 + (progn + (net.html.generator:html + (print-http *standard-xhtml-header*) + (print-http "") + (head ,title :css ,css) + (print-http "") + (prog1 + ,@body + (print-http "")))))) + (:html + `(prog1 + (progn + (net.html.generator:html + (print-http *standard-html-header*) + (head ,title :css ,css) + (print-http "") + (prog1 + ,@body + (print-http "")))))) + (:xml + `(prog1 + (progn + (net.html.generator:html + (princ-http *standard-xml-header* + (princ-http "")) + (with-tag "pagetitle" (princ-http ,title)) + ,@body) + (princ-http ""))))) ;;; URL Encoding