Remove css-selector-like annotation
This commit is contained in:
parent
3dd9c7cdf0
commit
979489c15b
3 changed files with 2 additions and 46 deletions
|
@ -1,6 +1,6 @@
|
|||
# piccolo
|
||||
|
||||
piccolo, a fork of [flute](https://github.com/ailisp/flute), is a beautiful, easilly composable DSL for writing HTML with Common Lisp.
|
||||
piccolo, a fork of [flute](https://github.com/ailisp/flute), is a beautiful, easily composable DSL for writing HTML with Common Lisp.
|
||||
|
||||
It's
|
||||
|
||||
|
@ -148,12 +148,6 @@ Then just wrap `h` for all html generation part. In the same examples above, it
|
|||
|
||||
(defparameter *dog2* (dog :id "dog2" :size 20 "some children"))
|
||||
```
|
||||
From version 0.2 (available in Aug 2018 Quicklisp), piccolo supports css style id and class attribute for builtin elements. For example `div#id-name.class1.class2`, So you can also write:
|
||||
```lisp
|
||||
(h (div#a.b "..."))
|
||||
;; Provide additional class and attributes
|
||||
(h (div#a.b :class "c" :onclick "fun()"))
|
||||
```
|
||||
|
||||
## Inline CSS and JavaScript
|
||||
With help of [cl-css](https://github.com/Inaimathi/cl-css) (available in Quicklisp), You can write inline CSS for the `style` attribute, in a similar syntax like piccolo:
|
||||
|
|
|
@ -180,29 +180,7 @@ When given :ASCII and :ATTR, it's possible to insert html text as a children, e.
|
|||
,@(tree-leaves
|
||||
body
|
||||
(html-element-p x)
|
||||
(multiple-value-bind (name id class) (collect-id-and-class x)
|
||||
(if (or id class)
|
||||
(make-!expanded :list (list (find-symbol (string-upcase name) :piccolo)
|
||||
(coerce (append (when id (list :id id))
|
||||
(when class (list :class class)))
|
||||
'vector)))
|
||||
(find-symbol (string-upcase name) :piccolo))))))
|
||||
|
||||
;;; Experimental
|
||||
;; (when (find :illusion *features*)
|
||||
;; (illusion:set-paren-reader
|
||||
;; :piccolo
|
||||
;; #'html-element-p
|
||||
;; (lambda (stream indicator)
|
||||
;; (multiple-value-bind (name id class) (collect-id-and-class indicator)
|
||||
;; (if (or id class)
|
||||
;; (list* (find-symbol (string-upcase name) :piccolo)
|
||||
;; (coerce (append (when id (list :id))
|
||||
;; (when class (list :class class)))
|
||||
;; 'vector)
|
||||
;; (illusion:cl-read-list stream))
|
||||
;; (cons (find-symbol (string-upcase name) :piccolo)
|
||||
;; (illusion:cl-read-list stream)))))))
|
||||
(find-symbol (string-upcase x) :piccolo))))
|
||||
|
||||
(defmethod element-string ((element element))
|
||||
(with-output-to-string (s)
|
||||
|
|
|
@ -126,19 +126,3 @@
|
|||
|
||||
(defun collect-name-as-keyword (symbol)
|
||||
(make-keyword (car (collect-until-dot-or-sharp (string symbol)))))
|
||||
|
||||
(defun collect-id-and-class (symbol)
|
||||
(let (name id class next-is)
|
||||
(do ((current-and-remains (collect-until-dot-or-sharp (string-downcase (string symbol)))
|
||||
(collect-until-dot-or-sharp (cdr current-and-remains))))
|
||||
((string= "" (car current-and-remains))
|
||||
(values name id (when class (format nil "~{~a~^ ~}" (nreverse class)))))
|
||||
(case next-is
|
||||
(:id (setf id (car current-and-remains)))
|
||||
(:class (push (car current-and-remains) class))
|
||||
(otherwise (setf name (car current-and-remains))))
|
||||
(unless (string= "" (cdr current-and-remains))
|
||||
(setf next-is (ecase (aref (cdr current-and-remains) 0)
|
||||
(#\# :id)
|
||||
(#\. :class))
|
||||
(cdr current-and-remains) (subseq (cdr current-and-remains) 1))))))
|
||||
|
|
Loading…
Reference in a new issue