Mercurial > core / lisp/lib/organ/heading.lisp
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 |
1 ;;; lib/organ/obj.lisp --- Org Heading 7 (defun planning-line-p (l) (scan org-planning-rx l)) 8 (defun property-start-p (l) (scan org-property-start-rx l)) 10 (defun org-parse-planning-and-properties (input) 11 "Parse INPUT returning the following values: 13 (PLANNING PROPERTIES REST)" 14 (let ((planning) properties) 15 (loop for l = (read-line input) ;; FIXME: peek-line 17 when (planning-line-p l) 18 do (push (org-parse :planning-line (read-line input)) planning) 19 when (property-start-p l) 20 do (setf properties (org-parse :property-drawer input))) 21 (values planning properties (read-until-end input)))) 23 (defclass org-heading () 24 ((headline :initarg :headline :initform (org-create :headline) :type org-headline :accessor org-headline) 25 (planning :initarg :planning :initform nil :type (or null org-planning) :accessor org-planning) 26 (properties :initarg :properties :initform nil :type (or null org-property-drawer) :accessor org-properties) 27 (contents :initarg :contents :initform nil :type (or null (vector (or org-section org-heading))) 28 :accessor org-contents))) 30 (defmethod org-create ((type (eql :header)) &rest initargs &key &allow-other-keys) 31 (apply #'make-instance (sym-to-org-class-name type) initargs)) 33 ;; TODO 2024-03-17: fix org-parse-planning-properties -- hangs 34 (define-org-parser (heading :from stream) 35 (let ((headline (org-parse :headline (read-line input)))) 36 ;; (multiple-value-bind (planning properties rest) 37 ;; (org-parse-planning-and-properties input) 38 (make-instance 'org-heading 41 ;; :properties properties 42 ;; :contents (org-parse :section (read-until-end rest))) 45 (define-org-parser (heading :from string) 46 (with-input-from-string (s input) 47 (org-parse :heading s)))