diff --git a/asset.lisp b/asset.lisp
index 670bb72..33b0968 100644
--- a/asset.lisp
+++ b/asset.lisp
@@ -24,14 +24,14 @@
(defclass asset ()
((name :initarg :name
- :reader asset-name
- :type string)
+ :reader asset-name
+ :type string)
(source-dir :initarg :source-dir
- :accessor asset-source-dir
- :type string)
+ :accessor asset-source-dir
+ :type string)
(source-ext :initarg :source-ext
- :reader asset-source-ext
- :type extension)
+ :reader asset-source-ext
+ :type extension)
(sources :type list)
(path :type string)
(source-path :type string)
@@ -93,7 +93,7 @@
(if (slot-boundp asset 'source-path)
#1=(slot-value asset 'source-path)
(setf #1# (with-slots (name source-dir source-ext) asset
- (str source-dir name source-ext)))))
+ (str source-dir name source-ext)))))
(defmethod print-object ((asset asset) stream)
(print-unreadable-object (asset stream :type t)
@@ -112,17 +112,17 @@
(defmethod asset-sources ((asset asset))
(flet ((miss ()
- (let ((sources (asset-sources% asset)))
- (setf (slot-value asset 'sources)
- (cons (asset-write-date sources) sources))
- sources)))
+ (let ((sources (asset-sources% asset)))
+ (setf (slot-value asset 'sources)
+ (cons (asset-write-date sources) sources))
+ sources)))
(if (slot-boundp asset 'sources)
- (destructuring-bind (cached-date &rest cached-sources)
- (slot-value asset 'sources)
- (if (= cached-date (asset-write-date cached-sources))
- cached-sources
- (miss)))
- (miss))))
+ (destructuring-bind (cached-date &rest cached-sources)
+ (slot-value asset 'sources)
+ (if (= cached-date (asset-write-date cached-sources))
+ cached-sources
+ (miss)))
+ (miss))))
(defmethod asset-write-date ((asset asset))
(asset-write-date (asset-sources asset)))
@@ -142,9 +142,9 @@
nil)
(defmethod asset-include ((output null)
- context
- asset
- &rest args &key &allow-other-keys)
+ context
+ asset
+ &rest args &key &allow-other-keys)
(with-output-to-string (stream)
(apply #'asset-include stream context asset args)))
@@ -164,17 +164,17 @@
;; Extension -> asset classes
(defun extension-asset-classes (extension
- &optional (class (find-class 'asset)))
+ &optional (class (find-class 'asset)))
(declare (type extension extension)
- (type class class))
+ (type class class))
(when extension
(labels ((add (classes a)
- (reduce #'add (closer-mop:class-direct-subclasses a)
- :initial-value (cons a classes)))
- (matching-class (a)
- (if (find extension (asset-class-extensions a))
- (add nil a)
- (some #'matching-class
- (closer-mop:class-direct-subclasses a)))))
+ (reduce #'add (closer-mop:class-direct-subclasses a)
+ :initial-value (cons a classes)))
+ (matching-class (a)
+ (if (find extension (asset-class-extensions a))
+ (add nil a)
+ (some #'matching-class
+ (closer-mop:class-direct-subclasses a)))))
(or (matching-class class)
- `(,class)))))
+ `(,class)))))
diff --git a/coffeescript.lisp b/coffeescript.lisp
index 527dfb9..87e4956 100644
--- a/coffeescript.lisp
+++ b/coffeescript.lisp
@@ -30,15 +30,15 @@
(defun coffeescript (in out)
(let ((err (make-string-output-stream)))
(unwind-protect
- (sb-ext:run-program "coffee -cs" '()
- :input in
- :output out
- :error err
- :search t)
+ (sb-ext:run-program "coffee -cs" '()
+ :input in
+ :output out
+ :error err
+ :search t)
(close err))))
(defmethod process-asset ((asset coffeescript-asset)
- (output stream))
+ (output stream))
(with-input-from-file/utf-8 (in (asset-source-path asset))
(coffeescript in output))
(force-output output)
diff --git a/config.lisp b/config.lisp
index 50275e9..dab9ad3 100644
--- a/config.lisp
+++ b/config.lisp
@@ -51,9 +51,9 @@
(defun assets-dir (pathspec)
(let* ((namestring (enough-namestring pathspec))
- (path (if (char= #\/ (last-elt namestring))
- namestring
- (str namestring "/"))))
+ (path (if (char= #\/ (last-elt namestring))
+ namestring
+ (str namestring "/"))))
(pushnew path *assets-dirs* :test #'string=)))
(defun precompiled-asset (asset-name)
diff --git a/css.lisp b/css.lisp
index 503ace5..ec1d740 100644
--- a/css.lisp
+++ b/css.lisp
@@ -31,9 +31,9 @@
'(.css))
(defmethod asset-include ((output stream)
- (context (eql :html))
- (asset css-asset)
- &key &allow-other-keys)
+ (context (eql :html))
+ (asset css-asset)
+ &key &allow-other-keys)
(write-string "<link rel=\"stylesheet\" href=\"" output)
(write-string (quote-html (asset-url asset)) output)
(write-string "\" type=\"text/css\" />
@@ -41,7 +41,7 @@
(values))
(defmethod include-asset ((asset css-asset)
- (output stream))
+ (output stream))
(format output "@import url('~A');~%" (asset-url asset)))
(defmethod process-asset :around ((asset css-asset) (output stream))
diff --git a/extensions.lisp b/extensions.lisp
index e3edbf5..997cedf 100644
--- a/extensions.lisp
+++ b/extensions.lisp
@@ -22,9 +22,9 @@
(defun intern-extension (name)
(let ((sym (intern (string-upcase (if (char= #\. (char name 0))
- name
- (concatenate 'string "." name)))
- :RoL-extensions)))
+ name
+ (concatenate 'string "." name)))
+ :RoL-extensions)))
(export sym :RoL-extensions)
sym))
diff --git a/find.lisp b/find.lisp
index ed50e02..3a8f4bf 100644
--- a/find.lisp
+++ b/find.lisp
@@ -25,12 +25,12 @@
(defun find-in-assets (type dir name ext assets)
(find-if (lambda (asset)
- (declare (type asset asset))
- (and (typep asset type)
- (string= name (asset-name asset))
- (or (not (string= dir (asset-source-dir asset)))
- (string= ext (asset-source-ext asset)))))
- assets))
+ (declare (type asset asset))
+ (and (typep asset type)
+ (string= name (asset-name asset))
+ (or (not (string= dir (asset-source-dir asset)))
+ (string= ext (asset-source-ext asset)))))
+ assets))
#+nil
(fmakunbound 'find-assets)
@@ -40,60 +40,60 @@
;; Resolve name, possibly wild
(defmethod find-assets ((type class)
- (dir string)
- (name string)
- (ext symbol)
- assets)
+ (dir string)
+ (name string)
+ (ext symbol)
+ assets)
(let ((absolute-dir (truename dir))
- (assets assets))
+ (assets assets))
(dolist (path (reverse (directory (str dir name ext))))
(unless (char= #\. (char (pathname-name path) 0))
- (let* ((name.ext (enough-namestring (truename path) absolute-dir))
- (name (if ext
- (subseq name.ext 0 (- (length name.ext)
- (length (string ext))))
- name.ext)))
- (unless (find-in-assets type dir name ext assets)
- (push (make-instance type
- :name name
- :source-dir dir
- :source-ext ext)
- assets)))))
+ (let* ((name.ext (enough-namestring (truename path) absolute-dir))
+ (name (if ext
+ (subseq name.ext 0 (- (length name.ext)
+ (length (string ext))))
+ name.ext)))
+ (unless (find-in-assets type dir name ext assets)
+ (push (make-instance type
+ :name name
+ :source-dir dir
+ :source-ext ext)
+ assets)))))
assets))
;; Loop through extensions
(defmethod find-assets ((type class)
- (dir string)
- (name string)
- (extensions cons)
- assets)
+ (dir string)
+ (name string)
+ (extensions cons)
+ assets)
(reduce (lambda (assets ext)
- (declare (type symbol ext))
- (find-assets type dir name ext assets))
- extensions
- :initial-value assets))
+ (declare (type symbol ext))
+ (find-assets type dir name ext assets))
+ extensions
+ :initial-value assets))
(defmethod find-assets ((type class)
- (dir string)
- (name string)
- (ext null)
- assets)
+ (dir string)
+ (name string)
+ (ext null)
+ assets)
(when (setq ext (asset-class-extensions type))
(find-assets type dir name ext assets)))
;; Loop through dirs
(defmethod find-assets ((type class)
- (directories cons)
- (name string)
- ext
- assets)
+ (directories cons)
+ (name string)
+ ext
+ assets)
(reduce (lambda (assets dir)
- (declare (type string dir))
- (find-assets type dir name ext assets))
- directories
- :initial-value assets))
+ (declare (type string dir))
+ (find-assets type dir name ext assets))
+ directories
+ :initial-value assets))
(defmethod find-assets (type (dir null) name ext assets)
(let ((dir (assets-dirs)))
@@ -104,8 +104,8 @@
(defmethod find-assets ((type symbol) dir name ext assets)
(let ((class (if (keywordp type)
- (find-class (find-symbol (str type "-ASSET")))
- (find-class type))))
+ (find-class (find-symbol (str type "-ASSET")))
+ (find-class type))))
(unless class
(error "Unknown asset type : ~S" type))
(find-assets (the class class) dir name ext assets)))
@@ -115,35 +115,35 @@
(defmacro with-asset-spec (spec (name ext) &body body)
`(let (,name ,ext)
(cl-ppcre:register-groups-bind (n e)
- ("^\\s*(.*?)(?:\\.([^./]+))?\\s*$" ,spec)
+ ("^\\s*(.*?)(?:\\.([^./]+))?\\s*$" ,spec)
(setf ,name n ,ext (when e (intern-extension e))))
(let ((,name ,name) (,ext ,ext))
,@body)))
(defun find-assets-from-spec (spec &optional class assets)
(labels ((assets-matching (class name ext)
- (if class
- (let ((new (find-assets class nil name
- (asset-class-extensions class)
- assets)))
- (unless (eq new assets)
- new))
- (when ext
- (some (lambda (class) (assets-matching class name ext))
- (extension-asset-classes ext))))))
+ (if class
+ (let ((new (find-assets class nil name
+ (asset-class-extensions class)
+ assets)))
+ (unless (eq new assets)
+ new))
+ (when ext
+ (some (lambda (class) (assets-matching class name ext))
+ (extension-asset-classes ext))))))
(or (assets-matching class spec nil)
- (with-asset-spec spec (name ext)
- (when (if class
- (find ext (asset-class-extensions class))
- ext)
- (assets-matching class name ext)))
- assets)))
+ (with-asset-spec spec (name ext)
+ (when (if class
+ (find ext (asset-class-extensions class))
+ ext)
+ (assets-matching class name ext)))
+ assets)))
(defun find-assets-from-specs (specs &optional class assets)
(reduce (lambda (assets spec)
- (find-assets-from-spec spec class assets))
- specs
- :initial-value assets))
+ (find-assets-from-spec spec class assets))
+ specs
+ :initial-value assets))
;; Asset cache
@@ -158,10 +158,10 @@
(defun find-asset (spec &optional class)
(or #1=(asset-cache-get `(find-asset ,spec ,class))
(setf #1# (let ((ext (when-let ((type (pathname-type spec)))
- (intern-extension type)))
- (assets (find-assets-from-spec spec class)))
- (or (find ext assets :key #'asset-source-ext :test #'eq)
- (first assets))))))
+ (intern-extension type)))
+ (assets (find-assets-from-spec spec class)))
+ (or (find ext assets :key #'asset-source-ext :test #'eq)
+ (first assets))))))
;; Now that we can find an asset from a string spec we can also
;; add some sugar coating to asset methods.
@@ -185,9 +185,9 @@
(asset-sources (find-asset spec)))
(defmethod asset-include (output
- context
- (spec string)
- &rest args &key &allow-other-keys)
+ context
+ (spec string)
+ &rest args &key &allow-other-keys)
(apply #'asset-include output context (find-asset spec) args))
(defmethod compile-asset ((spec string) output)
diff --git a/generate.lisp b/generate.lisp
index 03a715a..bcb8fad 100644
--- a/generate.lisp
+++ b/generate.lisp
@@ -28,9 +28,9 @@
(defun generate/file (path)
(let (*generator*
- (dir (enough-namestring
- (truename
- (merge-pathnames "../" (make-pathname :name nil :type nil
+ (dir (enough-namestring
+ (truename
+ (merge-pathnames "../" (make-pathname :name nil :type nil
:defaults path))))))
(when (zerop (length dir))
(setq dir "./"))
diff --git a/html.lisp b/html.lisp
index 6f329bd..8ac9457 100644
--- a/html.lisp
+++ b/html.lisp
@@ -24,67 +24,67 @@
(defvar *html-entities*
(make-entity-table "&<>\"'"
- (the (simple-array simple-base-string)
- #("&" "<" ">" """ "'"))))
+ (the (simple-array simple-base-string)
+ #("&" "<" ">" """ "'"))))
(defun char-entity (char &optional (table *html-entities*))
(with-slots (chars entities) table
(let ((i (position char chars)))
(when i
- (svref entities i)))))
+ (svref entities i)))))
(defun quote-html (string &key stream (start 0) (end (length string)))
(declare (optimize (safety 0) (debug 0) (speed 3))
- (type fixnum start end)
- (type string string))
+ (type fixnum start end)
+ (type string string))
(if (emptyp string)
""
(labels ((print-raw (raw i)
- (declare (type fixnum raw i))
- (when (< raw i)
- (write-string string stream :start raw :end i)))
- (chr (i)
- (typecase string
- (simple-array (char string i))
- (simple-string (char string i))
- (string (char string i))))
- (skip (raw i)
- (declare (type fixnum raw i))
- (cond ((= i end) (print-raw raw i))
- (t (let* ((char (chr i))
- (entity (char-entity char)))
- (cond (entity (print-raw raw i)
- (write-string entity stream)
- (incf i)
- (skip i i))
- (t (skip raw (1+ i))))))))
- (stream-or-string (i)
- (declare (type fixnum i))
- (cond ((= i end) (if (and (= 0 start)
- (= end (length string)))
- string
- (subseq string start end)))
- (t (let* ((char (chr i))
- (entity (char-entity char)))
- (cond (entity (with-output-to-string (out)
- (setq stream out)
- (print-raw start i)
- (write-string entity stream)
- (incf i)
- (skip i i)))
- (t (stream-or-string (1+ i)))))))))
- (if stream
- (skip start start)
- (stream-or-string start)))))
+ (declare (type fixnum raw i))
+ (when (< raw i)
+ (write-string string stream :start raw :end i)))
+ (chr (i)
+ (typecase string
+ (simple-array (char string i))
+ (simple-string (char string i))
+ (string (char string i))))
+ (skip (raw i)
+ (declare (type fixnum raw i))
+ (cond ((= i end) (print-raw raw i))
+ (t (let* ((char (chr i))
+ (entity (char-entity char)))
+ (cond (entity (print-raw raw i)
+ (write-string entity stream)
+ (incf i)
+ (skip i i))
+ (t (skip raw (1+ i))))))))
+ (stream-or-string (i)
+ (declare (type fixnum i))
+ (cond ((= i end) (if (and (= 0 start)
+ (= end (length string)))
+ string
+ (subseq string start end)))
+ (t (let* ((char (chr i))
+ (entity (char-entity char)))
+ (cond (entity (with-output-to-string (out)
+ (setq stream out)
+ (print-raw start i)
+ (write-string entity stream)
+ (incf i)
+ (skip i i)))
+ (t (stream-or-string (1+ i)))))))))
+ (if stream
+ (skip start start)
+ (stream-or-string start)))))
(define-compiler-macro quote-html (&whole whole string &key stream
- (start 0)
- (end nil end-p))
+ (start 0)
+ (end nil end-p))
(if (and (null stream)
- (stringp string)
- (or (not end-p)
- (integerp end)))
+ (stringp string)
+ (or (not end-p)
+ (integerp end)))
(quote-html string
- :start start
- :end (if end-p end (length string)))
+ :start start
+ :end (if end-p end (length string)))
whole))
diff --git a/image.lisp b/image.lisp
index fee892e..ede2e96 100644
--- a/image.lisp
+++ b/image.lisp
@@ -26,9 +26,9 @@
'(.gif .ico .jpeg .jpg .png .svg .svgz .wbmp))
(defmethod asset-include ((output stream)
- (context (eql :html))
- (asset image-asset)
- &key alt &allow-other-keys)
+ (context (eql :html))
+ (asset image-asset)
+ &key alt &allow-other-keys)
(write-string "<img src=\"" output)
(write-string (quote-html (asset-url asset)) output)
(write-string "\" alt=\"" output)
diff --git a/js.lisp b/js.lisp
index 489bed4..0dd8bef 100644
--- a/js.lisp
+++ b/js.lisp
@@ -29,9 +29,9 @@
'(.js))
(defmethod asset-include ((output stream)
- (context (eql :html))
- (asset js-asset)
- &key &allow-other-keys)
+ (context (eql :html))
+ (asset js-asset)
+ &key &allow-other-keys)
(write-string "<script src=\"" output)
(write-string (quote-html (asset-url asset)) output)
(write-string "\" type=\"text/javascript\"></script>
@@ -52,15 +52,15 @@
(defun jsmin (in out)
(let ((err (make-string-output-stream)))
(unwind-protect
- (sb-ext:run-program "jsmin" '()
- :input in
- :output out
- :error err
- :search t)
+ (sb-ext:run-program "jsmin" '()
+ :input in
+ :output out
+ :error err
+ :search t)
(close err))))
(defmethod process-asset ((asset js-asset)
- (output stream))
+ (output stream))
(with-input-from-file/utf-8 (js (asset-source-path asset))
(copy-stream js output))
(force-output output)
diff --git a/less.js b/less.js
index 808f581..6f375f9 100644
--- a/less.js
+++ b/less.js
@@ -15,8 +15,8 @@ try {
print_error(e);
else {
less.render(data, opt.parser, function (e, output) {
- console.log(output);
- rw.writeFileSync('/dev/stdout', output.css, 'utf8');
+ console.log(output);
+ rw.writeFileSync('/dev/stdout', output.css, 'utf8');
});
}
};
diff --git a/less.lisp b/less.lisp
index 8bc617d..20e3b3f 100644
--- a/less.lisp
+++ b/less.lisp
@@ -25,11 +25,11 @@
(defun less-js (src-path options &optional out)
(let ((opt (json:make-object `((src . ,src-path)
- (parser . ,(plist-alist options)))
- nil)))
+ (parser . ,(plist-alist options)))
+ nil)))
(with-input-from-string (in (json:encode-json-to-string opt))
(exec-js:from-file #P"lib/rol/assets/less.js"
- :safely nil :in in :out out))))
+ :safely nil :in in :out out))))
(defun less-path (path)
(format nil "--include-path=~{~A~^:~}" path))
@@ -44,7 +44,7 @@
(when path
(push (less-path path) args))
(external-program:run "lessc" args :output out)))
-
+
;; LESS
(defclass less-asset (css-asset)
@@ -59,37 +59,37 @@
(defmethod less-imports% ((asset less-asset))
(let* ((head (cons nil nil))
- (tail head))
+ (tail head))
(regex-lines "(?:^|\\b)@import\\s+\"([^\"]+)\"\\s*;"
- (pathname (asset-source-path asset))
- :match (lambda (whole i)
- (declare (ignore whole))
- (when-let ((a (find-asset i 'less-asset)))
- (unless (find (asset-path a) (cdr head)
- :test #'string=
- :key #'asset-path)
- (setf tail (setf (cdr tail)
- (cons a nil)))))))
+ (pathname (asset-source-path asset))
+ :match (lambda (whole i)
+ (declare (ignore whole))
+ (when-let ((a (find-asset i 'less-asset)))
+ (unless (find (asset-path a) (cdr head)
+ :test #'string=
+ :key #'asset-path)
+ (setf tail (setf (cdr tail)
+ (cons a nil)))))))
(cdr head)))
(defmethod less-imports ((asset less-asset))
(let* ((source-path (pathname (asset-source-path asset)))
- (write-date (file-write-date source-path))
- (imports (when (slot-boundp asset 'less-imports)
- (slot-value asset 'less-imports))))
+ (write-date (file-write-date source-path))
+ (imports (when (slot-boundp asset 'less-imports)
+ (slot-value asset 'less-imports))))
(if (and imports (= write-date (car imports)))
- (cdr imports)
- (cdr (setf (slot-value asset 'less-imports)
- (cons write-date (less-imports% asset)))))))
+ (cdr imports)
+ (cdr (setf (slot-value asset 'less-imports)
+ (cons write-date (less-imports% asset)))))))
(defmethod less-sources ((asset less-asset))
(let* ((head (cons nil nil))
- (tail head))
+ (tail head))
(labels ((iter (a)
- (unless (find (asset-path a) (cdr head)
- :test #'string= :key #'asset-path)
- (setf tail (setf (cdr tail) (cons a nil)))
- (mapc #'iter (less-imports a)))))
+ (unless (find (asset-path a) (cdr head)
+ :test #'string= :key #'asset-path)
+ (setf tail (setf (cdr tail) (cons a nil)))
+ (mapc #'iter (less-imports a)))))
(iter asset))
(cdr head)))
@@ -98,36 +98,36 @@
(if (slot-boundp asset 'less-sources)
#1=(slot-value asset 'less-sources)
(setf #1#
- (let* ((head (cons asset nil))
- (tail head))
- (labels ((collect (item)
- (setf tail (setf (cdr tail) (cons item nil))))
- (have (item)
- (find item head :test #'string= :key #'asset-path))
- (match (whole i)
- (declare (ignore whole))
- (unless (have i)
- (when-let ((a (find-asset i 'less-asset)))
- (collect a)
- (parse a))))
- (parse (a)
- (regex-lines "(?:^|\\b)@import\\s+\"([^\"]+)\"\\s*;"
- (pathname (asset-source-path a))
- :match #'match)))
- (parse asset)
- head)))))
+ (let* ((head (cons asset nil))
+ (tail head))
+ (labels ((collect (item)
+ (setf tail (setf (cdr tail) (cons item nil))))
+ (have (item)
+ (find item head :test #'string= :key #'asset-path))
+ (match (whole i)
+ (declare (ignore whole))
+ (unless (have i)
+ (when-let ((a (find-asset i 'less-asset)))
+ (collect a)
+ (parse a))))
+ (parse (a)
+ (regex-lines "(?:^|\\b)@import\\s+\"([^\"]+)\"\\s*;"
+ (pathname (asset-source-path a))
+ :match #'match)))
+ (parse asset)
+ head)))))
(defmethod asset-write-date ((asset less-asset))
(loop for a in (less-sources asset)
maximize (file-write-date (asset-source-path a))))
(defmethod process-asset ((asset less-asset)
- (output stream))
+ (output stream))
(let ((true-assets-dirs (cache-1 (eq *assets-dirs*)
- (mapcar #'truename (assets-dirs))))
- (path (truename (asset-source-path asset))))
+ (mapcar #'truename (assets-dirs))))
+ (path (truename (asset-source-path asset))))
(less path
- :clean (not (debug-p (or :css :less :assets)))
- :path true-assets-dirs
- :out output))
+ :clean (not (debug-p (or :css :less :assets)))
+ :path true-assets-dirs
+ :out output))
(values))
diff --git a/lib.lisp b/lib.lisp
index df8a298..4c6fdd5 100644
--- a/lib.lisp
+++ b/lib.lisp
@@ -30,11 +30,11 @@
(defmacro cache-1 ((test key) &body body)
"Cache one value of BODY. TEST identifies KEY is cached."
(let ((cache (gensym "CACHE-")))
- `(let ((,cache (load-time-value (cons ',cache-nil nil))))
- (if (,test (car ,cache) ,key)
- (cdr ,cache)
- (setf (car ,cache) ,key
- (cdr ,cache) (progn ,@body))))))))
+ `(let ((,cache (load-time-value (cons ',cache-nil nil))))
+ (if (,test (car ,cache) ,key)
+ (cdr ,cache)
+ (setf (car ,cache) ,key
+ (cdr ,cache) (progn ,@body))))))))
;; Log messages
diff --git a/mime-types.lisp b/mime-types.lisp
index cbbadd7..d427c3c 100644
--- a/mime-types.lisp
+++ b/mime-types.lisp
@@ -44,21 +44,21 @@
(defun read-mime.types (input)
(regex-lines "^\\s*([a-zA-Z0-9_.+-]+/[-a-zA-Z0-9_.+]+)\\s+([\\sa-zA-Z0-9]+)"
- input
- :match (lambda (match type extensions)
- (declare (ignorable match))
- (setq type (intern (string-upcase type) :keyword))
- (dolist (ext (cl-ppcre:split "\\s+" extensions))
- (unless (emptyp ext)
- (setf (mime-type (intern-extension ext)) type))))))
+ input
+ :match (lambda (match type extensions)
+ (declare (ignorable match))
+ (setq type (intern (string-upcase type) :keyword))
+ (dolist (ext (cl-ppcre:split "\\s+" extensions))
+ (unless (emptyp ext)
+ (setf (mime-type (intern-extension ext)) type))))))
(find-if (lambda (path)
- (when (probe-file path)
- (read-mime.types path)
- t))
- '(#P"mime.types"
- #P"conf/mime.types"
- #P"/etc/mime.types"
- #P"/etc/nginx/mime.types"
- #P"/var/www/conf/mime.types"
- #P"/etc/apache/mime.types"))
+ (when (probe-file path)
+ (read-mime.types path)
+ t))
+ '(#P"mime.types"
+ #P"conf/mime.types"
+ #P"/etc/mime.types"
+ #P"/etc/nginx/mime.types"
+ #P"/var/www/conf/mime.types"
+ #P"/etc/apache/mime.types"))
diff --git a/package.lisp b/package.lisp
index 70a9e23..6b69bac 100644
--- a/package.lisp
+++ b/package.lisp
@@ -22,11 +22,11 @@
(let (symbols)
(when (find-package :RoL-extensions)
(do-external-symbols (s :RoL-extensions)
- (push s symbols)))
+ (push s symbols)))
`(defpackage :RoL-extensions
(:nicknames :RoL-ext :L>ext :lowh.triangle.extensions)
(:export ,@symbols
- #:.woff #:.woff2))))
+ #:.woff #:.woff2))))
(eval-when (:compile-toplevel :load-toplevel :execute)
(defpackage-rol-extensions))
diff --git a/precompile.lisp b/precompile.lisp
index fb66c48..032dd5f 100644
--- a/precompile.lisp
+++ b/precompile.lisp
@@ -29,7 +29,7 @@
(force-output)
(dolist (asset (locate-precompiled-assets))
(let ((output-path (asset-path asset)))
- (msg "~A" output-path)
+ (msg "~A" output-path)
(let ((pathname (pathname output-path)))
(with-msg-indent (1)
(compile-asset asset pathname))
diff --git a/preprocess.lisp b/preprocess.lisp
index 99764fb..86ca54a 100644
--- a/preprocess.lisp
+++ b/preprocess.lisp
@@ -29,60 +29,60 @@
(unless found
(error "Asset not found : ~S~&Required by ~S" specs asset))
(reduce (lambda (assets asset)
- (preprocess/asset asset assets))
- found
- :initial-value assets)))
+ (preprocess/asset asset assets))
+ found
+ :initial-value assets)))
(defun preprocess/comment (asset comment assets)
#+nil(debug-msg "Comment ~S" comment)
(or (cl-ppcre:register-groups-bind (command arguments)
- ("^\\W*=\\s*(\\w+)(\\s+\\S+)*\\s*$" comment)
- (let ((arg-list (rest (cl-ppcre:split "\\s+" arguments))))
- (cond ((string= "require" command)
- (setf assets (preprocess/require asset arg-list assets)))
- (t
- (warn "Unknown preprocessor command : ~A ~S"
- command arg-list)
- assets))))
+ ("^\\W*=\\s*(\\w+)(\\s+\\S+)*\\s*$" comment)
+ (let ((arg-list (rest (cl-ppcre:split "\\s+" arguments))))
+ (cond ((string= "require" command)
+ (setf assets (preprocess/require asset arg-list assets)))
+ (t
+ (warn "Unknown preprocessor command : ~A ~S"
+ command arg-list)
+ assets))))
assets))
(defun match-comment-start-and-end (start end)
(when (find-if (lambda (match)
- (and (string= start (car match))
- (string= end (cdr match))))
- '(("/*" . "*/")))
+ (and (string= start (car match))
+ (string= end (cdr match))))
+ '(("/*" . "*/")))
t))
(defun preprocess/stream (asset stream assets &optional stack)
(let ((line (read-line stream nil))
- start comment end)
+ start comment end)
(or (when line
- (cl-ppcre:register-groups-bind (s c e)
- ("^\\s*(/\\*|//)?(.*?)(?:(\\*/).*)?$" line)
- (setf start s comment c end e))
- (unless (empty-p start)
- (push start stack))
- (unless (empty-p comment)
- (if stack
- (setf assets (preprocess/comment asset comment assets))
- (setf line nil)))
- (when (string= "//" (first stack))
- (pop stack))
- (when (and stack end (match-comment-start-and-end
- (first stack) end))
- (pop stack)
- (unless stack
- (setf line nil)))
- (when line
- (preprocess/stream asset stream assets stack)))
- (cons asset assets))))
+ (cl-ppcre:register-groups-bind (s c e)
+ ("^\\s*(/\\*|//)?(.*?)(?:(\\*/).*)?$" line)
+ (setf start s comment c end e))
+ (unless (empty-p start)
+ (push start stack))
+ (unless (empty-p comment)
+ (if stack
+ (setf assets (preprocess/comment asset comment assets))
+ (setf line nil)))
+ (when (string= "//" (first stack))
+ (pop stack))
+ (when (and stack end (match-comment-start-and-end
+ (first stack) end))
+ (pop stack)
+ (unless stack
+ (setf line nil)))
+ (when line
+ (preprocess/stream asset stream assets stack)))
+ (cons asset assets))))
(defun preprocess/asset (asset assets)
(let ((path (asset-source-path asset)))
;;(msg "PP ~A" path)
(with-msg-indent (1)
(with-input-from-file/utf-8 (input path)
- (preprocess/stream asset input assets)))))
+ (preprocess/stream asset input assets)))))
(defmethod asset-sources% ((asset preprocessed-asset))
(nreverse (preprocess/asset asset nil)))
@@ -99,9 +99,9 @@
(ensure-directories-exist output)
(let ((assets (asset-sources asset)))
(when (or (not (file-exists-p output))
- (some (lambda (asset)
- (file-more-recent-p (asset-source-path asset)
- output))
- assets))
+ (some (lambda (asset)
+ (file-more-recent-p (asset-source-path asset)
+ output))
+ assets))
(with-output-to-file/utf-8 (stream output)
- (compile-asset asset stream)))))
+ (compile-asset asset stream)))))
diff --git a/rol-assets.asd b/rol-assets.asd
index bd1b611..fea16ad 100644
--- a/rol-assets.asd
+++ b/rol-assets.asd
@@ -31,18 +31,18 @@
:depends-on ("alexandria"
"cfg"
"cl-base64"
- "cl-debug"
- "cl-fad"
+ "cl-debug"
+ "cl-fad"
"cl-uglify-js"
- "closer-mop"
- "cl-json"
- "exec-js"
+ "closer-mop"
+ "cl-json"
+ "exec-js"
"external-program"
"ironclad"
"re"
- "rol-files"
- "rol-uri"
- "str")
+ "rol-files"
+ "rol-uri"
+ "str")
:components
((:file "package")
(:file "config" :depends-on ("package"))