org-export: Fix some errors and corner cases with macros
* contrib/lisp/org-export.el (org-export-get-inbuffer-options): Replace macro with an empty string when no value is provided. Ignore macros with an ill-formed key.
This commit is contained in:
parent
fc93b6f340
commit
f694c3d996
|
@ -986,12 +986,24 @@ dependencies."
|
||||||
((string= key "OPTIONS")
|
((string= key "OPTIONS")
|
||||||
(org-export-parse-option-keyword val backend))
|
(org-export-parse-option-keyword val backend))
|
||||||
((string= key "MACRO")
|
((string= key "MACRO")
|
||||||
(string-match "^\\([-a-zA-Z0-9_]+\\)[ \t]+\\(.*?[ \t]*$\\)"
|
(when (string-match
|
||||||
|
"^\\([-a-zA-Z0-9_]+\\)\\(?:[ \t]+\\(.*?\\)[ \t]*$\\)?"
|
||||||
val)
|
val)
|
||||||
(plist-put nil
|
(let ((key (intern
|
||||||
(intern (concat ":macro-"
|
(concat ":macro-"
|
||||||
(downcase (match-string 1 val))))
|
(downcase (match-string 1 val)))))
|
||||||
(match-string 2 val))))
|
(value (match-string 2 val)))
|
||||||
|
(cond
|
||||||
|
((not value) "")
|
||||||
|
((string-match "\\`(eval\\>" value) (list key value))
|
||||||
|
(t
|
||||||
|
(list
|
||||||
|
key
|
||||||
|
;; If user explicitly asks for a newline, be
|
||||||
|
;; sure to preserve it from further filling
|
||||||
|
;; with `hard-newline'.
|
||||||
|
(replace-regexp-in-string
|
||||||
|
"\\\\n" hard-newline value))))))))
|
||||||
plist)))))
|
plist)))))
|
||||||
;; 2. Standard options, as in `org-export-option-alist'.
|
;; 2. Standard options, as in `org-export-option-alist'.
|
||||||
(let* ((all (append org-export-option-alist
|
(let* ((all (append org-export-option-alist
|
||||||
|
|
Loading…
Reference in New Issue