Coverage report: /home/ellis/comp/core/lib/organ/document.lisp

KindCoveredAll%
expression040 0.0
branch04 0.0
Key
Not instrumented
Conditionalized out
Executed
Not executed
 
Both branches taken
One branch taken
Neither branch taken
1
 ;;; lib/organ/document.lisp --- Org Document API
2
 
3
 ;; Top-level file object
4
 
5
 ;;; Commentary:
6
 
7
 ;; ORG-DOCUMENT is the top-level Lisp representation of a complete Org-mode
8
 ;; file.
9
 
10
 ;;; Code:
11
 (in-package :organ)
12
 
13
 (defclass org-document ()
14
   ((meta :initform nil :initarg :meta :type (or null org-zeroth-section) :accessor doc-meta)
15
    (tree :initform nil :initarg :tree :type (or (vector org-heading) null) :accessor doc-tree)))
16
 
17
 (defaccessor ast ((self org-document)) (doc-tree self))
18
 
19
 (defmethod org-create ((type (eql :document)) &rest initargs)
20
   (apply #'make-instance (sym-to-org-class-name type) initargs))
21
 
22
 (defmethod org-parse ((type (eql :document)) (input pathname))
23
   (if (probe-file input)
24
       (let ((res (org-create type)))
25
         (with-open-file (fstream input)
26
           (setf (doc-meta res) (org-parse :meta fstream)
27
                 (doc-tree res)
28
                 (coerce
29
                  (loop for c = (peek-char nil fstream nil nil)
30
                        while (and c (char= c #\*))
31
                        collect (org-parse :heading fstream))
32
                  '(vector org-heading)))
33
           res))
34
       (org-file-missing input)))