changeset 287: | 609931bd65ba |
parent: | b7183bfd7107 |
author: | Richard Westhaver <ellis@rwest.io> |
date: | Fri, 19 Apr 2024 21:54:00 -0400 |
permissions: | -rw-r--r-- |
description: | organ updates, readme.org |
127
960c010a23ce
replaced lalr parser with YACC, removed vcard and ical data formats (requires xpath), added org elements and objects
ellis <ellis@rwest.io>
parents:
diff
changeset
|
1 | ;;; lib/organ/obj.lisp --- Org Heading |
960c010a23ce
replaced lalr parser with YACC, removed vcard and ical data formats (requires xpath), added org elements and objects
ellis <ellis@rwest.io>
parents:
diff
changeset
|
2 | |
960c010a23ce
replaced lalr parser with YACC, removed vcard and ical data formats (requires xpath), added org elements and objects
ellis <ellis@rwest.io>
parents:
diff
changeset
|
3 | ;; |
960c010a23ce
replaced lalr parser with YACC, removed vcard and ical data formats (requires xpath), added org elements and objects
ellis <ellis@rwest.io>
parents:
diff
changeset
|
4 | |
960c010a23ce
replaced lalr parser with YACC, removed vcard and ical data formats (requires xpath), added org elements and objects
ellis <ellis@rwest.io>
parents:
diff
changeset
|
5 | ;;; Code: |
960c010a23ce
replaced lalr parser with YACC, removed vcard and ical data formats (requires xpath), added org elements and objects
ellis <ellis@rwest.io>
parents:
diff
changeset
|
6 | (in-package :organ) |
143 | 7 | (defun planning-line-p (l) (scan org-planning-rx l)) |
8 | (defun property-start-p (l) (scan org-property-start-rx l)) |
|
127
960c010a23ce
replaced lalr parser with YACC, removed vcard and ical data formats (requires xpath), added org elements and objects
ellis <ellis@rwest.io>
parents:
diff
changeset
|
9 | |
136
6ad95601645e
org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents:
134
diff
changeset
|
10 | (defun org-parse-planning-and-properties (input) |
6ad95601645e
org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents:
134
diff
changeset
|
11 | "Parse INPUT returning the following values: |
6ad95601645e
org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents:
134
diff
changeset
|
12 | |
143 | 13 | (PLANNING PROPERTIES REST)" |
14 | (let ((planning) properties) |
|
263
b7183bfd7107
add doc/readme.txt, more doc upgrades
Richard Westhaver <ellis@rwest.io>
parents:
229
diff
changeset
|
15 | (loop for l = (read-line input) ;; FIXME: peek-line |
143 | 16 | until (not l) |
229 | 17 | when (planning-line-p l) |
143 | 18 | do (push (org-parse :planning-line (read-line input)) planning) |
229 | 19 | when (property-start-p l) |
20 | do (setf properties (org-parse :property-drawer input))) |
|
143 | 21 | (values planning properties (read-until-end input)))) |
134 | 22 | |
128 | 23 | (defclass org-heading () |
136
6ad95601645e
org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents:
134
diff
changeset
|
24 | ((headline :initarg :headline :initform (org-create :headline) :type org-headline :accessor org-headline) |
6ad95601645e
org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents:
134
diff
changeset
|
25 | (planning :initarg :planning :initform nil :type (or null org-planning) :accessor org-planning) |
6ad95601645e
org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents:
134
diff
changeset
|
26 | (properties :initarg :properties :initform nil :type (or null org-property-drawer) :accessor org-properties) |
6ad95601645e
org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents:
134
diff
changeset
|
27 | (contents :initarg :contents :initform nil :type (or null (vector (or org-section org-heading))) |
6ad95601645e
org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents:
134
diff
changeset
|
28 | :accessor org-contents))) |
134 | 29 | |
30 | (defmethod org-create ((type (eql :header)) &rest initargs &key &allow-other-keys) |
|
31 | (apply #'make-instance (sym-to-org-class-name type) initargs)) |
|
32 | ||
229 | 33 | ;; TODO 2024-03-17: fix org-parse-planning-properties -- hangs |
136
6ad95601645e
org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents:
134
diff
changeset
|
34 | (define-org-parser (heading :from stream) |
143 | 35 | (let ((headline (org-parse :headline (read-line input)))) |
229 | 36 | ;; (multiple-value-bind (planning properties rest) |
37 | ;; (org-parse-planning-and-properties input) |
|
287
609931bd65ba
organ updates, readme.org
Richard Westhaver <ellis@rwest.io>
parents:
263
diff
changeset
|
38 | (make-instance 'org-heading |
609931bd65ba
organ updates, readme.org
Richard Westhaver <ellis@rwest.io>
parents:
263
diff
changeset
|
39 | :headline headline |
229 | 40 | ;; :planning planning |
41 | ;; :properties properties |
|
42 | ;; :contents (org-parse :section (read-until-end rest))) |
|
43 | ))) |
|
136
6ad95601645e
org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents:
134
diff
changeset
|
44 | |
134 | 45 | (define-org-parser (heading :from string) |
46 | (with-input-from-string (s input) |
|
136
6ad95601645e
org work, once we fix org-parse-planning-and-properties we ready to rumble
ellis <ellis@rwest.io>
parents:
134
diff
changeset
|
47 | (org-parse :heading s))) |