X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=2%2Fbase.lisp;h=233d6ee685bb71ee6306f7fd5c01b074f13f6362;hb=5c3f1fed1ccdfa43f677c59b6c2f3fbeb610a1a5;hp=944df66f5e8369b74fea4daf89356af6c24a46c0;hpb=096b456fe920373f3b54fbe47f10f3e41c4fe925;p=lml.git diff --git a/2/base.lisp b/2/base.lisp index 944df66..233d6ee 100644 --- a/2/base.lisp +++ b/2/base.lisp @@ -7,7 +7,7 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: Aug 2002 ;;;; -;;;; $Id: base.lisp,v 1.1 2003/06/20 04:12:29 kevin Exp $ +;;;; $Id: base.lisp,v 1.3 2003/06/23 20:37:43 kevin Exp $ ;;;; ;;;; This file, part of LML, is Copyright (c) 2002 by Kevin M. Rosenberg ;;;; @@ -45,27 +45,42 @@ (defun lml-print-date (date) (lml-write-string (date-string date))) -(defmacro xhtml-prologue () - `(progn - (lml-write-string (xml-prologue-string)) - (lml-write-char #\newline) - (lml-write-string (xhtml-prologue-string)) +(defun html-prologue (&optional (format :xhtml11)) + (case format + ((:xhtml :xhtml11 :xhtml10-strict :xhtml10-transitional :xhtml10-frameset) + (lml-write-string +xml-prologue-string+) (lml-write-char #\newline))) + (ecase format + ((:xhtml11 :xhtml) + (lml-write-string +xhtml11-dtd-string+)) + (:xhtml10-strict + (lml-write-string +xhtml10-strict-dtd-string+)) + (:xhtml10-transitional + (lml-write-string +xhtml10-transitional-dtd-string+)) + (:xhtml10-frameset + (lml-write-string +xhtml10-frameset-dtd-string+)) + (:html + (lml-write-string +html4-dtd-string+))) + (lml-write-char #\newline)) -(defmacro print-page (title &body body) - `(html - (:head - (:title (:princ ,title))) - (:body ,@body))) -(defmacro page (out-file &body body) +(defmacro page ((out-file &key (format :xhtml11)) + &body body) `(with-open-file (*html-stream* (lml-file-name ,out-file :output) :direction :output :if-exists :supersede) - (xhtml-prologue) + (html-prologue ,format) (html ((:html :xmlns "http://www.w3.org/1999/xhtml") ,@body)))) + +(defmacro alink (url desc) + `(html + ((:a :href ,url) ,desc))) + +(defmacro alink-c (class url desc) + `(html + ((:a :class ,class :href ,url) ,desc)))