1. Phil Hargett
  2. hh-web-tags


Phil Hargett  committed 5aa4972

Strings can now have embedded expressions that will be expanded in the runtime rendering context: that is will cause the result of (foo) to be rendered inline with the rest of the text, rather than just as literal . Does not appear to cause a noticeable slowdown on large pages.

  • Participants
  • Parent commits 1e2020f
  • Branches default

Comments (0)

Files changed (1)

File tags.lisp

View file
  • Ignore whitespace
   (render-tag-content *current-tag* ))
+(defmethod render-as-html ( (some-expr string))
+  (hout "~a" 
+	(with-output-to-string (os)
+	  (with-input-from-string (is some-expr)
+	    (loop for c = (read-char is nil nil)
+	       while c
+	       do (cond ((and (equal c #\$)
+			      (peek-char nil is nil nil)
+			      (not (equal #\$ (peek-char nil is nil nil))))
+			 (format os "~a " (eval `(html ,(read is nil nil)))))
+			((and (equal c #\$)
+			      (equal #\$ (peek-char nil is nil nil)))
+			 (read-char is nil nil)
+			 (write-char c os))
+			(t  
+			 (write-char c os))))))))
 (defmethod render-as-html ( (some-expr t) )
   (hout "~a" some-expr))