/
chtml.lisp
 1 (in-package #:oh-ducks)
 2 
 3 ;; avoid conflicting with 'sgml:pt
 4 (eval-when (:compile-toplevel :load-toplevel :execute)
 5   (import 'closure-html:pt))
 6 (eval-when (:compile-toplevel :load-toplevel :execute)
 7   (export 'pt)
 8   (export 'lhtml))
 9 
10 (defclass html-template (css-selector-template) ())
11 
12 (add-handler 'pt 'chtml:make-pt-builder)
13 (add-handler 'lhtml 'chtml:make-lhtml-builder)
14 
15 (unless *default-parser*
16   (setf *default-parser* (rcurry #'chtml:parse (get-handler-for-model 'pt))))
17 
18 (defmethod make-template ((kind (eql 'html)) (spec cons))
19   (destructuring-bind (&key parser model)
20       (append (when (%spec-includes-opts spec) (second spec))
21               (list :model 'pt))
22     (make-instance 'html-template
23                    :parser (or parser (rcurry #'chtml:parse (get-handler-for-model model)))
24                    :spec spec)))