1 ;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
6 ;;;; Purpose: Lisp Markup Language functions
7 ;;;; Programmer: Kevin M. Rosenberg
8 ;;;; Date Started: Aug 2002
10 ;;;; $Id: base.lisp,v 1.7 2003/07/12 17:54:05 kevin Exp $
12 ;;;; This file, part of LML2, is Copyright (c) 2000-2003 by Kevin Rosenberg.
13 ;;;; Rights of modification and redistribution are in the LICENSE file.
15 ;;;; *************************************************************************
20 (defun lml-format (str &rest args)
21 (when (streamp *html-stream*)
23 (apply #'format *html-stream* str args)
24 (write-string str *html-stream*))))
27 (princ s *html-stream*))
30 (format *html-stream* "~A~%" s))
32 (defun lml-write-char (char)
33 (write-char char *html-stream*))
35 (defun lml-write-string (str)
36 (write-string str *html-stream*))
38 (defun lml-print-date (date)
39 (lml-write-string (date-string date)))
41 (defun dtd-prologue (&optional (format :xhtml11))
43 ((:xhtml :xhtml11 :xhtml10-strict :xhtml10-transitional :xhtml10-frameset :xml)
44 (lml-write-string +xml-prologue-string+)
45 (lml-write-char #\newline)))
48 (lml-write-string +xhtml11-dtd-string+))
50 (lml-write-string +xhtml10-strict-dtd-string+))
51 (:xhtml10-transitional
52 (lml-write-string +xhtml10-transitional-dtd-string+))
54 (lml-write-string +xhtml10-frameset-dtd-string+))
56 (lml-write-string +html4-dtd-string+)))
57 (lml-write-char #\newline))
60 (defmacro html-file-page ((out-file &key (format :xhtml11))
62 `(with-open-file (*html-stream*
63 (lml-file-name ,out-file :output)
65 :if-exists :supersede)
66 (dtd-prologue ,format)
68 ((:html :xmlns "http://www.w3.org/1999/xhtml")
72 (defmacro alink (url desc)
74 ((:a :href ,url) ,desc)))
76 (defmacro alink-c (class url desc)
78 ((:a :class ,class :href ,url) ,desc)))