1 ;;; -*- Mode: lisp; outline-regexp: ";;;;;*"; indent-tabs-mode: nil -*-;;;
3 ;;; file: smarkup-asdf.cl
4 ;;; author: cyrus harmon
8 ;;; smarkup ASDF classes and methods for various component types
9 ;;; and operations on them
13 (defclass filtered-object
(ch-asdf:object-from-variable
)
14 ((filters :accessor object-filters
:initarg
:filters
)))
16 (defmethod perform ((op compile-op
) (c filtered-object
))
18 (setf (symbol-value (ch-asdf::object-symbol c
))
20 (symbol-value (ch-asdf::object-symbol c
))
23 (defmethod component-relative-pathname ((component filtered-object
)))
25 (defmethod component-pathname ((component filtered-object
)))
27 (defparameter *pdflatex-program
* "pdflatex")
28 (defparameter *pdflatex-program-path
*
29 (let ((found (sb-ext:find-executable-in-search-path
33 #+darwin
"/opt/local/bin/pdflatex"
34 #-darwin
"/usr/local/bin/pdflatex"))
37 (defclass object-latex-file
(ch-asdf:object-from-variable generated-file
) ())
39 (defmethod perform ((op ch-asdf
::generate-op
) (c object-latex-file
))
42 (symbol-value (ch-asdf::object-symbol c
))
43 (component-pathname c
)))
45 (defmethod perform ((operation compile-op
) (c object-latex-file
))
46 (with-component-directory (c)
47 (let ((unix-path (ch-util::unix-name
(component-pathname c
))))
48 (ch-util::run-program
*pdflatex-program-path
*
50 ;; we have to do this twice to get the references right!
52 (ch-util::run-program
*pdflatex-program-path
*
55 (defmethod operation-done-p ((o ch-asdf
::generate-op
) (c object-latex-file
))
56 (declare (optimize (debug 3)))
58 (file-write-date (component-pathname c
)))
59 (obj (asdf::find-component
60 (asdf::component-parent c
)
61 (asdf::coerce-name
(ch-asdf::object-input-object c
)))))
63 (let ((obj-date (asdf::component-property obj
'ch-asdf
::last-loaded
)))
66 (>= on-disk-time obj-date
)))))
68 (defclass object-xhtml-file
(ch-asdf:object-from-variable source-file
) ())
70 (defmethod perform ((op compile-op
) (c object-xhtml-file
))
72 (let ((sexp (symbol-value (ch-asdf::object-symbol c
)))
73 (file (component-pathname c
)))
74 (render-as :xhtml sexp file
)))
76 (defmethod perform ((op load-op
) (c object-xhtml-file
))
78 (ch-util::firefox-open
(ch-util::unix-name
(component-pathname c
))))
80 (defclass object-cl-pdf-file
(ch-asdf:object-from-variable pdf-file
) ())
82 (defmethod perform ((op compile-op
) (c object-cl-pdf-file
))
84 (let ((sexp (symbol-value (ch-asdf::object-symbol c
)))
85 (file (component-pathname c
)))
86 (render-as :cl-pdf sexp file
)))
88 (defmethod perform ((op load-op
) (c object-cl-pdf-file
))
90 (ch-util::app-open
(unix-name (component-pathname c
))))