Browse Source

Merge branch 'maint'

Nicolas Goaziou 3 years ago
parent
commit
85a25e3169
2 changed files with 12 additions and 5 deletions
  1. 6 4
      lisp/ox.el
  2. 6 1
      testing/lisp/test-ox.el

+ 6 - 4
lisp/ox.el

@@ -1386,11 +1386,13 @@ 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)
+	   (while (string-match "\\(.+?\\):\\((.*?)\\|\\S-+\\)?[ \t]*" options s)
 	     (setq s (match-end 0))
-	     (push (cons (match-string 1 options)
-			 (read (match-string 2 options)))
-		   alist))
+	     (let ((value (match-string 2 options)))
+               (when value
+                 (push (cons (match-string 1 options)
+                             (read value))
+		       alist))))
 	   alist))
 	;; Priority is given to back-end specific options.
 	(all (append (org-export-get-all-options backend)

+ 6 - 1
testing/lisp/test-ox.el

@@ -163,7 +163,12 @@ num:2 <:active")))
 	  (org-export--parse-option-keyword
 	   "opt:t"
 	   (org-export-create-backend
-	    :options '((:opt1 nil "opt") (:opt2 nil "opt")))))))
+	    :options '((:opt1 nil "opt") (:opt2 nil "opt"))))))
+  ;; Ignore options with a missing value.
+  (should
+   (let ((options (org-export--parse-option-keyword "H: num:t")))
+     (and (not (plist-get options :headline-levels))
+          (plist-get options :section-numbers)))))
 
 (ert-deftest test-org-export/get-inbuffer-options ()
   "Test reading all standard export keywords."