changelog shortlog graph tags branches changeset files file revisions raw help

Mercurial > core / annotate 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
133
a5ae5a58c4cd org element comments and type definitions
ellis <ellis@rwest.io>
parents: 128
diff changeset
1
 ;;; lib/organ/element/greater/drawer.lisp --- Org Drawer Elements
a5ae5a58c4cd org element comments and type definitions
ellis <ellis@rwest.io>
parents: 128
diff changeset
2
 
a5ae5a58c4cd org element comments and type definitions
ellis <ellis@rwest.io>
parents: 128
diff changeset
3
 ;; Drawers match the pattern:
a5ae5a58c4cd org element comments and type definitions
ellis <ellis@rwest.io>
parents: 128
diff changeset
4
 
a5ae5a58c4cd org element comments and type definitions
ellis <ellis@rwest.io>
parents: 128
diff changeset
5
 #|
a5ae5a58c4cd org element comments and type definitions
ellis <ellis@rwest.io>
parents: 128
diff changeset
6
 :NAME:
a5ae5a58c4cd org element comments and type definitions
ellis <ellis@rwest.io>
parents: 128
diff changeset
7
 CONTENTS
a5ae5a58c4cd org element comments and type definitions
ellis <ellis@rwest.io>
parents: 128
diff changeset
8
 :end:
a5ae5a58c4cd org element comments and type definitions
ellis <ellis@rwest.io>
parents: 128
diff changeset
9
 |#
a5ae5a58c4cd org element comments and type definitions
ellis <ellis@rwest.io>
parents: 128
diff changeset
10
 
a5ae5a58c4cd org element comments and type definitions
ellis <ellis@rwest.io>
parents: 128
diff changeset
11
 ;; Drawers can't be nested.
a5ae5a58c4cd org element comments and type definitions
ellis <ellis@rwest.io>
parents: 128
diff changeset
12
 
a5ae5a58c4cd org element comments and type definitions
ellis <ellis@rwest.io>
parents: 128
diff changeset
13
 ;;; Code:
128
99f2ab6bc8ba organ work
ellis <ellis@rwest.io>
parents:
diff changeset
14
 (in-package :organ)
133
a5ae5a58c4cd org element comments and type definitions
ellis <ellis@rwest.io>
parents: 128
diff changeset
15
 
a5ae5a58c4cd org element comments and type definitions
ellis <ellis@rwest.io>
parents: 128
diff changeset
16
 (define-org-element drawer (name contents) :greater t)
136
6ad95601645e org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents: 133
diff changeset
17
 
6ad95601645e org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents: 133
diff changeset
18
 (define-org-element property-drawer 
6ad95601645e org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents: 133
diff changeset
19
     ((contents :initform (make-array 0 :element-type 'org-node-property :adjustable t :fill-pointer 0)
6ad95601645e org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents: 133
diff changeset
20
                :accessor org-contents :type (vector 'org-node-property)))
6ad95601645e org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents: 133
diff changeset
21
   :greater t
6ad95601645e org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents: 133
diff changeset
22
   :documentation "A special type of ORG-DRAWER with a names of
6ad95601645e org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents: 133
diff changeset
23
   'PROPERTIES'. This class is built into the slot of ORG-HEADING,
6ad95601645e org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents: 133
diff changeset
24
   ORG-DOCUMENT, and ORG-INLINETASK objects.")
6ad95601645e org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents: 133
diff changeset
25
 
6ad95601645e org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents: 133
diff changeset
26
 (define-org-parser (property-drawer :from stream)
229
7ca4cdbd52c2 bug fixes
Richard Westhaver <ellis@rwest.io>
parents: 136
diff changeset
27
   (let ((l (read-line input nil)))
7ca4cdbd52c2 bug fixes
Richard Westhaver <ellis@rwest.io>
parents: 136
diff changeset
28
     (unless (or (not l) (not (typep l 'string)))
136
6ad95601645e org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents: 133
diff changeset
29
       (if (scan org-property-start-rx l)
6ad95601645e org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents: 133
diff changeset
30
           (let ((drawer (org-create :property-drawer)))
229
7ca4cdbd52c2 bug fixes
Richard Westhaver <ellis@rwest.io>
parents: 136
diff changeset
31
             (loop for p = (read-line input nil)
7ca4cdbd52c2 bug fixes
Richard Westhaver <ellis@rwest.io>
parents: 136
diff changeset
32
                   until (or (not p) (scan org-end-rx p))
136
6ad95601645e org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents: 133
diff changeset
33
                   do (vector-push-extend (org-parse :node-property p) (org-contents drawer)))
6ad95601645e org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents: 133
diff changeset
34
             drawer)))))
6ad95601645e org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents: 133
diff changeset
35
 
6ad95601645e org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents: 133
diff changeset
36
 (define-org-parser (property-drawer :from string)
6ad95601645e org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents: 133
diff changeset
37
   (with-input-from-string (s input)
6ad95601645e org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents: 133
diff changeset
38
     (org-parse :property-drawer s)))