Time-based checkin
Fri Nov 13 05:19:55 UTC 2009 pix@kepibu.org
* Time-based checkin
Renames some things, but mostly just doing this because it's a good time too.
diff -rN -u old-Oh, Ducks!/css-selector-unifier.asd new-Oh, Ducks!/css-selector-unifier.asd
--- old-Oh, Ducks!/css-selector-unifier.asd 1970-01-01 00:00:00.000000000 +0000
+++ new-Oh, Ducks!/css-selector-unifier.asd 2015-04-10 16:11:54.000000000 +0000
@@ -0,0 +1,19 @@
+
+(asdf:defsystem css-selector-unifier
+ :version "0"
+ :description "cl-unification templates using CSS-style selectors"
+ :maintainer " <pix@kepibu.org>"
+ :author " <pix@kepibu.org>"
+ :licence "BSD-style"
+ :depends-on (:closure-html :cxml :cl-ppcre :cl-unification :split-sequence)
+ :serial t
+ ;; components likely need manual reordering
+ :components ((:file "package")
+ (:file "regexp-template")
+ #+(or) (:file "tests")
+ (:module traversal
+ :components
+ ((:file "interface")
+ (:file "lhtml" :depends-on ("interface"))
+ (:file "pt" :depends-on ("interface"))))
+ (:file "unification-templates")))
diff -rN -u old-Oh, Ducks!/tests.lisp new-Oh, Ducks!/tests.lisp
--- old-Oh, Ducks!/tests.lisp 2015-04-10 16:11:53.000000000 +0000
+++ new-Oh, Ducks!/tests.lisp 2015-04-10 16:11:54.000000000 +0000
@@ -1,8 +1,8 @@
(in-package #:css-selector-unifier)
-(equalp '(:div ((:id "id")) "I " (:i () "like") " cheese.")
- (match (#T(lhtml ("#id" . ?div))
- "<div id=\"id\">I <i>like</i> cheese.</div>")
+(equalp '(:div ((:element-id "element-id")) "I " (:i () "like") " cheese.")
+ (match (#T(lhtml ("#element-id" . ?div))
+ "<div element-id=\"element-id\">I <i>like</i> cheese.</div>")
;; FIXME: learn to distinguish between when there should only be one
;; result and when there should be many?
(car div)))
diff -rN -u old-Oh, Ducks!/traversal/interface.lisp new-Oh, Ducks!/traversal/interface.lisp
--- old-Oh, Ducks!/traversal/interface.lisp 2015-04-10 16:11:53.000000000 +0000
+++ new-Oh, Ducks!/traversal/interface.lisp 2015-04-10 16:11:54.000000000 +0000
@@ -5,26 +5,26 @@
;;; general accessors
-(defgeneric children (element)
- (:documentation "Returns a sequence of element's children."))
-(defgeneric parent (element)
- (:documentation "Returns element's parent element."))
-(defgeneric attribute (attribute element)
- (:documentation "Returns the value of the attribute of element, or nil if no such attribute exists."))
-(defgeneric type (element)
- (:documentation "Returns the tag name (type) of element."))
+(defgeneric element-children (element)
+ (:documentation "Returns a sequence of element's element-children."))
+(defgeneric element-parent (element)
+ (:documentation "Returns element's element-parent element."))
+(defgeneric element-attribute (element-attribute element)
+ (:documentation "Returns the value of the element-attribute of element, or nil if no such element-attribute exists."))
+(defgeneric element-type (element)
+ (:documentation "Returns the tag name (element-type) of element."))
;;; special accessors in case something special needs to happen
-(defgeneric id (element)
- (:documentation "Equivalent in spirit to (attribute :id element).")
- (:method (element) (attribute :id element)))
+(defgeneric element-id (element)
+ (:documentation "Equivalent in spirit to (element-attribute :element-id element).")
+ (:method (element) (element-attribute :element-id element)))
-(defgeneric classes (element)
- (:documentation "Equivalent in spirit to (attribute :class element), except it returns a sequence of individual classes.")
+(defgeneric element-classes (element)
+ (:documentation "Equivalent in spirit to (element-attribute :class element), except it returns a sequence of individual element-classes.")
(:method (element)
- (split-sequence:split-sequence #\Space (attribute :class element) :remove-empty-subseqs t)))
+ (split-sequence:split-sequence #\Space (element-attribute :class element) :remove-empty-subseqs t)))
-(defgeneric type-equal (element type)
- (:documentation "Equivalent in spirit to (string-equal (type element) type), but not obligated to work under the assumption of string-designators.")
- (:method (element type) (string-equal type (type element))))
+(defgeneric element-type-equal (element type)
+ (:documentation "Equivalent in spirit to (string-equal (element-type element) element-type), but not obligated to work under the assumption of string-designators.")
+ (:method (element type) (string-equal type (element-type element))))
diff -rN -u old-Oh, Ducks!/traversal/lhtml.lisp new-Oh, Ducks!/traversal/lhtml.lisp
--- old-Oh, Ducks!/traversal/lhtml.lisp 2015-04-10 16:11:53.000000000 +0000
+++ new-Oh, Ducks!/traversal/lhtml.lisp 2015-04-10 16:11:54.000000000 +0000
@@ -5,19 +5,19 @@
;;; general accessors
-(defmethod children ((element list))
+(defmethod element-children ((element list))
(cddr element))
-(defmethod parent ((element list))
+(defmethod element-parent ((element list))
;; FIXME: figure out how to do this. Maybe we can do something involving
;; signals and restart-cases. Ask "are you my mother?" up the stack, and
;; only error if everybody says no.
- (error "Unable to locate parent or suitable guardian."))
+ (error "Unable to locate element-parent or suitable guardian."))
-(defmethod attribute ((attribute symbol) (element list))
- (cadr (assoc attribute (cadr element))))
-(defmethod attribute ((attribute string) (element list))
- (attribute (intern (string-upcase attribute) :keyword) element))
+(defmethod element-attribute ((element-attribute symbol) (element list))
+ (cadr (assoc element-attribute (cadr element))))
+(defmethod element-attribute ((element-attribute string) (element list))
+ (element-attribute (intern (string-upcase element-attribute) :keyword) element))
-(defmethod type ((element list))
+(defmethod element-type ((element list))
(car element))
diff -rN -u old-Oh, Ducks!/traversal/pt.lisp new-Oh, Ducks!/traversal/pt.lisp
--- old-Oh, Ducks!/traversal/pt.lisp 2015-04-10 16:11:53.000000000 +0000
+++ new-Oh, Ducks!/traversal/pt.lisp 2015-04-10 16:11:54.000000000 +0000
@@ -2,16 +2,16 @@
;;; general accessors
-(defmethod children ((element chtml:pt))
+(defmethod element-children ((element chtml:pt))
(chtml:pt-children element))
-(defmethod parent ((element chtml:pt))
+(defmethod element-parent ((element chtml:pt))
(chtml:pt-parent element))
-(defmethod attribute ((attribute symbol) (element chtml:pt))
- (getf (chtml:pt-attrs element) attribute))
-(defmethod attribute ((attribute string) (element chtml:pt))
- (attribute (intern (string-upcase attribute) :keyword) element))
+(defmethod element-attribute ((element-attribute symbol) (element chtml:pt))
+ (getf (chtml:pt-attrs element) element-attribute))
+(defmethod element-attribute ((element-attribute string) (element chtml:pt))
+ (element-attribute (intern (string-upcase element-attribute) :keyword) element))
-(defmethod type ((element chtml:pt))
+(defmethod element-type ((element chtml:pt))
(chtml:pt-name element))
diff -rN -u old-Oh, Ducks!/unification-templates.lisp new-Oh, Ducks!/unification-templates.lisp
--- old-Oh, Ducks!/unification-templates.lisp 2015-04-10 16:11:53.000000000 +0000
+++ new-Oh, Ducks!/unification-templates.lisp 2015-04-10 16:11:54.000000000 +0000
@@ -93,8 +93,8 @@
(#T(unify::regexp "^[ ]*[>][ ]*(.*)$" (?rest)) (list (make-instance 'css-descendant-selector :arg :direct :matcher (parse-css-specifier rest))))
(#T(unify::regexp "^[ ]+(.*)$" (?rest)) (list (make-instance 'css-descendant-selector :arg t :matcher (parse-css-specifier rest))))
;; simple selector sequence
- (#T(unify::regexp "^(\\w+)(.*)$" (?type ?rest)) (cons (make-instance 'css-type-selector :arg type) (parse-css-specifier rest)))
- (#T(unify::regexp "^[#](\\w+)(.*)$" (?id ?rest)) (cons (make-instance 'css-id-selector :arg id) (parse-css-specifier rest)))
+ (#T(unify::regexp "^(\\w+)(.*)$" (?element-type ?rest)) (cons (make-instance 'css-type-selector :arg element-type) (parse-css-specifier rest)))
+ (#T(unify::regexp "^[#](\\w+)(.*)$" (?element-id ?rest)) (cons (make-instance 'css-id-selector :arg element-id) (parse-css-specifier rest)))
(#T(unify::regexp "^[\\.](\\w+)(.*)$" (?class ?rest)) (cons (make-instance 'css-class-selector :arg class) (parse-css-specifier rest)))))
(defgeneric css-select (specifier document))
@@ -131,7 +131,7 @@
(cadr (assoc attr (cadr element))))
(defmethod css-select ((selector css-id-selector) (element cons))
- (when (string= (lhtml-attr :id element) (selector-arg selector))
+ (when (string= (lhtml-attr :element-id element) (selector-arg selector))
element))
(defmethod css-select ((selector css-class-selector) (element cons))
@@ -162,8 +162,8 @@
(defgeneric css-combinator:adjacent (a b))
(defgeneric css-combinator:sibling (a b))
-(defgeneric css-selector:type (element type))
+(defgeneric css-selector:element-type (element element-type))
(defgeneric css-selector:class (element class))
-(defgeneric css-selector:id (element id))
+(defgeneric css-selector:element-id (element element-id))