forked from mirrors/org-mode
org-export: Allow "string with spaces" as #+OPTIONS: values
* lisp/ox.el (org-export--parse-option-keyword): Allow `read'ing the option value as far as needed. Do not restrict the value to the first whitespace only. This way, one can use Elisp strings with all the escaping options as values. * testing/lisp/test-ox.el (test-org-export/parse-option-keyword): Add test for option value with a space inside. Reported-by: Pierre Balayé <pierrebalaye@gmail.com> Link: https://list.orgmode.org/orgmode/CANpQAF-n+4xhNvL8aaP8j2gJ70vbu80wmh9a4Oj0BxNHA5-yDA@mail.gmail.com/
This commit is contained in:
parent
fe67cebb3a
commit
ad62379984
17
lisp/ox.el
17
lisp/ox.el
|
@ -1404,14 +1404,15 @@ Optional argument BACKEND is an export back-end, as returned by,
|
|||
e.g., `org-export-create-backend'. It specifies which back-end
|
||||
specific items to read, if any."
|
||||
(let ((line
|
||||
(let ((s 0) alist)
|
||||
(while (string-match "\\(.+?\\):\\((.*?)\\|\\S-+\\)?[ \t]*" options s)
|
||||
(setq s (match-end 0))
|
||||
(let ((value (match-string 2 options)))
|
||||
(when value
|
||||
(push (cons (match-string 1 options)
|
||||
(read value))
|
||||
alist))))
|
||||
(let (value alist)
|
||||
(with-temp-buffer
|
||||
(insert options)
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward "\\s-*\\(.+?\\):" nil t)
|
||||
(when (looking-at-p "\\S-")
|
||||
(push (cons (match-string 1)
|
||||
(read (current-buffer))) ; moves point
|
||||
alist))))
|
||||
alist))
|
||||
;; Priority is given to back-end specific options.
|
||||
(all (append (org-export-get-all-options backend)
|
||||
|
|
|
@ -198,7 +198,10 @@ num:2 <:active")))
|
|||
(should
|
||||
(let ((options (org-export--parse-option-keyword "H: num:t")))
|
||||
(and (not (plist-get options :headline-levels))
|
||||
(plist-get options :section-numbers)))))
|
||||
(plist-get options :section-numbers))))
|
||||
;; Parse spaces inside brackets.
|
||||
(let ((options (org-export--parse-option-keyword "html-postamble:\"test space\"" 'html)))
|
||||
(should (equal "test space" (plist-get options :html-postamble)))))
|
||||
|
||||
(ert-deftest test-org-export/get-inbuffer-options ()
|
||||
"Test reading all standard export keywords."
|
||||
|
|
Loading…
Reference in New Issue