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.3 2003/06/23 20:37:43 kevin Exp $
12 ;;;; This file, part of LML, is Copyright (c) 2002 by Kevin M. Rosenberg
14 ;;;; LML users are granted the rights to distribute and use this software
15 ;;;; as governed by the terms of the GNU General Public License v2
16 ;;;; (http://www.gnu.org/licenses/gpl.html)
17 ;;;; *************************************************************************
22 (defun reset-indent ()
25 (defun lml-format (str &rest args)
26 (when (streamp *html-stream*)
27 (when *print-spaces* (indent-spaces *indent* *html-stream*))
29 (apply #'format *html-stream* str args)
30 (write-string str *html-stream*))
31 (when *print-spaces* (write-char #\newline *html-stream*))))
34 (princ s *html-stream*))
37 (format *html-stream* "~A~%" s))
39 (defun lml-write-char (char)
40 (write-char char *html-stream*))
42 (defun lml-write-string (str)
43 (write-string str *html-stream*))
45 (defun lml-print-date (date)
46 (lml-write-string (date-string date)))
48 (defun html-prologue (&optional (format :xhtml11))
50 ((:xhtml :xhtml11 :xhtml10-strict :xhtml10-transitional :xhtml10-frameset)
51 (lml-write-string +xml-prologue-string+)
52 (lml-write-char #\newline)))
55 (lml-write-string +xhtml11-dtd-string+))
57 (lml-write-string +xhtml10-strict-dtd-string+))
58 (:xhtml10-transitional
59 (lml-write-string +xhtml10-transitional-dtd-string+))
61 (lml-write-string +xhtml10-frameset-dtd-string+))
63 (lml-write-string +html4-dtd-string+)))
64 (lml-write-char #\newline))
67 (defmacro page ((out-file &key (format :xhtml11))
69 `(with-open-file (*html-stream*
70 (lml-file-name ,out-file :output)
72 :if-exists :supersede)
73 (html-prologue ,format)
75 ((:html :xmlns "http://www.w3.org/1999/xhtml")
80 (defmacro alink (url desc)
82 ((:a :href ,url) ,desc)))
84 (defmacro alink-c (class url desc)
86 ((:a :class ,class :href ,url) ,desc)))