X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=lml.cl;h=4f73fdb071206b0b592053669da37c8f35f64ca5;hb=ce89c31a4ce6e52280e1a1f32ec9192c8b2bc9a2;hp=b273b2c3f16f5702ad49bc5f33ec195faaff837d;hpb=f212998e69e8b67604a1f96faaf1ecacf693c5c3;p=lml.git
diff --git a/lml.cl b/lml.cl
index b273b2c..4f73fdb 100644
--- a/lml.cl
+++ b/lml.cl
@@ -7,7 +7,7 @@
;;;; Programmer: Kevin M. Rosenberg
;;;; Date Started: Aug 2002
;;;;
-;;;; $Id: lml.cl,v 1.1 2002/09/16 01:13:49 kevin Exp $
+;;;; $Id: lml.cl,v 1.6 2002/09/16 09:36:27 kevin Exp $
;;;;
;;;; This file, part of LML, is Copyright (c) 2002 by Kevin M. Rosenberg
;;;;
@@ -19,17 +19,14 @@
(declaim (optimize (debug 3) (speed 3) (safety 1) (compilation-speed 0)))
(in-package :lml)
-(defconstant +html4-prologue-string+
- (format nil
- "~%"))
+(defun html4-prologue-string ()
+ "")
-(defconstant +xml-prologue-string+
- (format nil
- "~%"))
+(defun xml-prologue-string ()
+ "version=\"1.0\" encoding=\"iso-8859-1\" standalone=\"yes\"?>")
-(defconstant +xhtml-prologue-string+
- (format nil
- "~%"))
+(defun xhtml-prologue-string ()
+ "")
(defvar *print-spaces* nil)
(defvar *indent* 0)
@@ -130,8 +127,8 @@
(defmacro xhtml-prologue ()
`(progn
- (lml-print +xml-prologue-string+)
- (lml-print +xhtml-prologue-string+)))
+ (lml-print "~A~%" (xml-prologue-string))
+ (lml-print "~A~%" (xhtml-prologue-string))))
(defmacro link (dest &body body)
`(with a :href ,dest ,@body))
@@ -161,6 +158,9 @@
(defmacro br ()
`(lml-print "
"))
+(defmacro hr ()
+ `(lml-print "
"))
+
(defmacro lml-tag-macro (tag)
`(progn
(defmacro ,tag (&body body)
@@ -178,7 +178,7 @@
(defparameter *macro-list*
'(a div span h1 h2 h3 h4 h5 h6 i b p li ul ol table tbody td tr body head
html title pre tt u dl dt dd kbd code form))
- (export '(link link-c br img input meta meta-key))
+ (export '(link link-c br hr img input meta meta-key))
(export *macro-list*))
(loop for i in *macro-list*
@@ -200,3 +200,44 @@
(xhtml-prologue)
(html :xmlns "http://www.w3.org/1999/xhtml"
,@body)))
+
+(set-macro-character #\[
+ #'(lambda (stream char)
+ (declare (ignore char))
+ (let ((curr-string (make-array 1024 :fill-pointer 0 :adjustable t :element-type 'character))
+ (got-comma nil))
+ (do ((ch (read-char stream t nil t) (read-char stream t nil t)))
+ ((eql ch #\]))
+ (if got-comma
+ (if (eql ch #\()
+ ;; Starting top-level ,(
+ (progn
+ (princ curr-string)
+ (setf (fill-pointer curr-string) 0)
+ (setq got-comma nil)
+ (vector-push #\( curr-string)
+ (do ((ch (read-char stream t nil t) (Read-char stream t nil t)))
+ ((eql ch #\)))
+ (when (eql ch #\])
+ (format *trace-output* "Syntax error reading #\]")
+ (return nil))
+ (vector-push-extend ch curr-string))
+ (vector-push-extend #\) curr-string)
+ (princ (eval (read-from-string curr-string)))
+ (setf (fill-pointer curr-string) 0))
+ ;; read comma, then non #\( char
+ (progn
+ (unless (eql ch #\,)
+ (setq got-comma nil))
+ (vector-push-extend #\, curr-string) ;; push previous command
+ (vector-push-extend ch curr-string)))
+ ;; previous character is not a comma
+ (if (eql ch #\,)
+ (setq got-comma t)
+ (progn
+ (setq got-comma nil)
+ (vector-push-extend ch curr-string)))))
+ (princ curr-string))
+ t))
+
+