X-Git-Url: https://git.hcoop.net/clinton/lisp-on-lines.git/blobdiff_plain/91b9f259d38073a9847ede172cdda1218f2c35fb..1cc831d4c7b9ecba47578b8a85ea046ef4e3915a:/src/attributes/standard-attributes.lisp diff --git a/src/attributes/standard-attributes.lisp b/src/attributes/standard-attributes.lisp index 53022aa..bdf3c80 100644 --- a/src/attributes/standard-attributes.lisp +++ b/src/attributes/standard-attributes.lisp @@ -1,5 +1,11 @@ (in-package :lisp-on-lines) + +;TODO: get rid of this. +(defun attribute.name (attribute) + (attribute-name attribute)) + + ;;;; A few layers related to attributes (deflayer omit-nil-attributes) @@ -8,18 +14,30 @@ (when (attribute-value object attribute) (call-next-method))) +;;;; Labels (deflayer show-attribute-labels) +(defattribute attribute-label (attribute) + () + (:default-properties + :attribute nil)) + +(defdisplay + ((label attribute-label) object) + (<:label + :class "lol-label" + (<:as-html (or (label (attribute label)) + (attribute-name (attribute label)) " ") + " "))) + +(defvar *attribute-label-attribute* + (make-instance 'attribute-label)) + (defdisplay :in-layer show-attribute-labels - :around ((attribute standard-attribute) object) - - (<:span - :class "lol-label" - (<:as-html (or (label attribute) (attribute.name attribute)) " ")) - (<:span - :class "lol-attribute" - (call-next-method))) + :around ((attribute standard-attribute) object) + (display-attribute *attribute-label-attribute* object :attribute attribute) + (call-next-method)) (deflayer use-pretty-labels) @@ -31,66 +49,123 @@ (string-capitalize (substitute #\Space #\- label))))) -(defattribute display () - () +(deflayer inspect-attributes) + +(defdisplay :in-layer inspect-attributes + :around ((attribute standard-attribute) object) + (call-next-method) + (