Coverage report: /home/ellis/comp/core/lib/organ/element/lesser/keyword.lisp

KindCoveredAll%
expression052 0.0
branch00nil
Key
Not instrumented
Conditionalized out
Executed
Not executed
 
Both branches taken
One branch taken
Neither branch taken
1
 ;;; lib/organ/element/lesser/keyword.lisp --- Org Keyword Element
2
 
3
 ;; Keywords match the pattern '#+KEY: VALUE'
4
 
5
 ;; VALUE can be any of the standard-set of objects.
6
 
7
 ;; Affiliated keywords match the patterns:
8
 
9
 #|
10
 #+KEY: VALUE
11
 #+KEY[OPTVAL]: VALUE
12
 #+attr_BACKEND: VALUE
13
 |#
14
 
15
 ;;; Code:
16
 (in-package :organ)
17
 
18
 (define-org-element keyword
19
     ((key :accessor keyword-key :initarg :key :type string)
20
      (val :accessor keyword-val :initarg :val))
21
   :lesser t)
22
 
23
 (define-org-parser (keyword :from string)
24
   (multiple-value-bind (match-start match-end start end) (scan org-file-property-rx input)
25
     (declare (ignore match-end))
26
     (when match-start
27
       (let ((key (subseq input (aref start 0) (aref end 0)))
28
             (val (subseq input (aref start 1) (aref end 1))))
29
         ;; handle comments
30
         (string-case ((string-upcase key) :default (org-create :keyword :key key :val val))
31
           ("COMMENT" (org-create :comment :contents val))
32
           ("BEGIN" 
33
            (with-input-from-string (s val)
34
              (let ((name (read s))
35
                    (params (read-lisp-until-end s)))
36
                (org-create :dynamic-block :name name :parameters params)))))))))
37
 
38
 (define-org-element affiliated-keyword (key opt value) :lesser t)
39
 
40
 (define-org-parser (affiliated-keyword :from string))