diff options
author | Nicolas Goaziou <n.goaziou@gmail.com> | 2012-01-22 09:44:52 +0100 |
---|---|---|
committer | Nicolas Goaziou <n.goaziou@gmail.com> | 2012-01-22 10:37:28 +0100 |
commit | f694c3d996bfd5d7a853751f08eda5ea70ea0d6f (patch) | |
tree | 530a2b35089c8edf81114ab72c62e1481d14ae76 | |
parent | fc93b6f34071703d5a154a51540f3f4e3f15b8a2 (diff) | |
download | org-mode-f694c3d996bfd5d7a853751f08eda5ea70ea0d6f.tar.gz |
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.
-rw-r--r-- | contrib/lisp/org-export.el | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/contrib/lisp/org-export.el b/contrib/lisp/org-export.el index 42fe808..bb3b297 100644 --- a/contrib/lisp/org-export.el +++ b/contrib/lisp/org-export.el @@ -986,12 +986,24 @@ dependencies." ((string= key "OPTIONS") (org-export-parse-option-keyword val backend)) ((string= key "MACRO") - (string-match "^\\([-a-zA-Z0-9_]+\\)[ \t]+\\(.*?[ \t]*$\\)" - val) - (plist-put nil - (intern (concat ":macro-" - (downcase (match-string 1 val)))) - (match-string 2 val)))) + (when (string-match + "^\\([-a-zA-Z0-9_]+\\)\\(?:[ \t]+\\(.*?\\)[ \t]*$\\)?" + val) + (let ((key (intern + (concat ":macro-" + (downcase (match-string 1 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))))) ;; 2. Standard options, as in `org-export-option-alist'. (let* ((all (append org-export-option-alist |