Mercurial > core / lisp/lib/organ/element/greater/drawer.lisp
changeset 698: |
96958d3eb5b0 |
parent: |
7ca4cdbd52c2
|
author: |
Richard Westhaver <ellis@rwest.io> |
date: |
Fri, 04 Oct 2024 22:04:59 -0400 |
permissions: |
-rw-r--r-- |
description: |
fixes |
1 ;;; lib/organ/element/greater/drawer.lisp --- Org Drawer Elements 3 ;; Drawers match the pattern: 11 ;; Drawers can't be nested. 16 (define-org-element drawer (name contents) :greater t) 18 (define-org-element property-drawer 19 ((contents :initform (make-array 0 :element-type 'org-node-property :adjustable t :fill-pointer 0) 20 :accessor org-contents :type (vector 'org-node-property))) 22 :documentation "A special type of ORG-DRAWER with a names of 23 'PROPERTIES'. This class is built into the slot of ORG-HEADING, 24 ORG-DOCUMENT, and ORG-INLINETASK objects.") 26 (define-org-parser (property-drawer :from stream) 27 (let ((l (read-line input nil))) 28 (unless (or (not l) (not (typep l 'string))) 29 (if (scan org-property-start-rx l) 30 (let ((drawer (org-create :property-drawer))) 31 (loop for p = (read-line input nil) 32 until (or (not p) (scan org-end-rx p)) 33 do (vector-push-extend (org-parse :node-property p) (org-contents drawer))) 36 (define-org-parser (property-drawer :from string) 37 (with-input-from-string (s input) 38 (org-parse :property-drawer s)))