changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / lisp/lib/organ/element/lesser/keyword.lisp

changeset 698: 96958d3eb5b0
parent: 609931bd65ba
author: Richard Westhaver <ellis@rwest.io>
date: Fri, 04 Oct 2024 22:04:59 -0400
permissions: -rw-r--r--
description: fixes
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  (org-create :keyword :key key :val val)))))
30 
31 (define-org-element affiliated-keyword (key opt value) :lesser t)
32 
33 (define-org-parser (affiliated-keyword :from string))