summaryrefslogtreecommitdiff
path: root/src/hypnotisml.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'src/hypnotisml.lisp')
-rw-r--r--src/hypnotisml.lisp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/hypnotisml.lisp b/src/hypnotisml.lisp
index 13e4bab..adbb14d 100644
--- a/src/hypnotisml.lisp
+++ b/src/hypnotisml.lisp
@@ -4,9 +4,11 @@
;;; UTILITIES
+(def:var *noindent* :init nil :doc "Turns off indentation")
(def:var *indent* :doc "Current indentation" :init 0)
(defun indent (stream &optional (indent *indent*))
- (loop :repeat indent :do (write-char #\space stream)))
+ (unless *noindent*
+ (loop :repeat indent :do (write-char #\space stream))))
(let ((counter 0)
(hostid (sxhash (list (lisp-implementation-type)
@@ -263,6 +265,11 @@ already present in the element."
;;; RENDERING
+(defun html-string (elem &key (pretty t))
+ (let ((*noindent* (not pretty)))
+ (with-output-to-string (out)
+ (html elem out))))
+
(defgeneric html (elem stream)
(:documentation "Renders an element as HTML"))