Permalink
Browse files

seperated out into files baed on function

  • Loading branch information...
1 parent 94e1d84 commit 69aeb7876d134ab2128ab59a0456c4f297b7d205 Paddy Mullen committed Feb 7, 2010
Showing with 58 additions and 48 deletions.
  1. +5 −1 css-lite.asd
  2. +4 −47 css-lite.lisp
  3. +11 −0 lite-utility.lisp
  4. +1 −0 package.lisp
  5. +26 −0 paren-css-lite.lisp
  6. +11 −0 utility.lisp
View
@@ -4,5 +4,9 @@
:serial t
:version "0.01"
:components ((:file "package")
- (:file "css-lite")))
+
+ (:file "css-lite")
+ (:file "utility")
+ (:file "lite-utility")
+ (:file "paren-css-lite")))
View
@@ -7,38 +7,19 @@
(defmacro css (&body rules)
`(format *css-stream* "~@{~A~}" ,@(mapcan #'process-css-rule rules)))
-#+parenscript (ps:defpsmacro css (&body rules)
- (cons 'ps:+ (ps::concat-constant-strings (mapcan #'process-css-rule rules))))
-
(defmacro css-string (&body rules)
`(with-output-to-string (*css-stream*)
(css ,@rules)))
(defun inline-css (&rest properties)
(format nil "~{~A~}" (process-css-properties properties t :newlines nil)))
-#+parenscript (ps:defpsmacro inline-css (&rest properties)
- (cons 'ps:+ (ps::concat-constant-strings (process-css-properties properties nil :newlines nil))))
-
-;;; handy utility functions for writing css
-
-(defun px (val)
- (format nil "~apx" val))
-
-#+parenscript (ps:defpsmacro px (val)
- `(ps:+ ,val "px"))
-
-(defun % (val)
- (format nil "~a%" val))
-#+parenscript (ps:defpsmacro % (val)
- `(ps:+ ,val "%"))
-
-(defun pt (val)
- (format nil "~apt" val))
+(defmacro make-css-var (var-name var-val)
+ `(progn
+ (setq ,var-name ,var-val)
+ (setf (get ',var-name 'css-var) t)))
-#+parenscript (ps:defpsmacro pt (val)
- `(ps:+ ,val "pt"))
;;; implementation
@@ -60,16 +41,6 @@
(defvar +newline+ (format nil "~%"))
-(defun flatten (tree)
- (let ((result '()))
- (labels ((scan (item)
- (if (listp item)
- (map nil #'scan item)
- (push item result))))
- (scan tree))
- (nreverse result)))
-
-
(defun process-css-properties (properties eval-vals &key (newlines t))
(loop for (name val) on
(flatten (mapcar #'should-expand (flatten properties)))
@@ -120,9 +91,6 @@
#-parenscript (defun css-id-name (symbol)
(format nil "#~(~a~)" symbol))
-#+parenscript (defun css-id-name (symbol)
- (format nil "#~a" (ps:symbol-to-js-string symbol)))
-
(defun to-string (x)
(cond ((stringp x) x)
((symbolp x) (string-downcase (symbol-name x)))
@@ -135,14 +103,3 @@
(to-string val))
collect comma)))
(t (princ-to-string x))))
-
-#+parenscript (ps:defpsmacro to-string (x)
- (if (and (listp x) (eql 'quote (car x)))
- (ps:symbol-to-js-string (second x))
- x))
-
-
-(defmacro make-css-var (var-name var-val)
- `(progn
- (setq ,var-name ,var-val)
- (setf (get ',var-name 'css-var) t)))
View
@@ -0,0 +1,11 @@
+(in-package css-lite)
+;;; handy utility functions for writing css
+
+(defun px (val)
+ (format nil "~apx" val))
+
+(defun % (val)
+ (format nil "~a%" val))
+
+(defun pt (val)
+ (format nil "~apt" val))
View
@@ -6,4 +6,5 @@
#:inline-css
#:pt
#:px
+ #:make-css-var
#:%))
View
@@ -0,0 +1,26 @@
+
+#+parenscript (ps:defpsmacro px (val)
+ `(ps:+ ,val "px"))
+
+#+parenscript (ps:defpsmacro % (val)
+ `(ps:+ ,val "%"))
+
+#+parenscript (ps:defpsmacro pt (val)
+ `(ps:+ ,val "pt"))
+
+#+parenscript (ps:defpsmacro css (&body rules)
+ (cons 'ps:+ (ps::concat-constant-strings (mapcan #'process-css-rule rules))))
+
+
+#+parenscript (ps:defpsmacro inline-css (&rest properties)
+ (cons 'ps:+ (ps::concat-constant-strings (process-css-properties properties nil :newlines nil))))
+
+
+#+parenscript (ps:defpsmacro to-string (x)
+ (if (and (listp x) (eql 'quote (car x)))
+ (ps:symbol-to-js-string (second x))
+ x))
+
+
+#+parenscript (defun css-id-name (symbol)
+ (format nil "#~a" (ps:symbol-to-js-string symbol)))
View
@@ -0,0 +1,11 @@
+(in-package "CSS-LITE")
+
+(defun flatten (tree)
+ (let ((result '()))
+ (labels ((scan (item)
+ (if (listp item)
+ (map nil #'scan item)
+ (push item result))))
+ (scan tree))
+ (nreverse result)))
+

0 comments on commit 69aeb78

Please sign in to comment.