Browse Source

Fix HTML export bug for empty headlines when `org-export-with-priority' is nil

* org-html.el (org-export-as-html): Make sure we always
process a string.

* org-exp.el (org-export-cleanup-toc-line): Always return a
string.

Thanks to Friedrich Delgado for reporting this.
Bastien Guerry 12 years ago
parent
commit
56b731087e
2 changed files with 14 additions and 12 deletions
  1. 13 11
      lisp/org-exp.el
  2. 1 1
      lisp/org-html.el

+ 13 - 11
lisp/org-exp.el

@@ -3300,18 +3300,20 @@ If yes remove the column and the special lines."
 
 (defun org-export-cleanup-toc-line (s)
   "Remove tags and timestamps from lines going into the toc."
-  (when (memq org-export-with-tags '(not-in-toc nil))
-    (if (string-match (org-re " +:[[:alnum:]_@#%:]+: *$") s)
+  (if (not s)
+      "" ; Return a string when argument is nil
+    (when (memq org-export-with-tags '(not-in-toc nil))
+      (if (string-match (org-re " +:[[:alnum:]_@#%:]+: *$") s)
+	  (setq s (replace-match "" t t s))))
+    (when org-export-remove-timestamps-from-toc
+      (while (string-match org-maybe-keyword-time-regexp s)
 	(setq s (replace-match "" t t s))))
-  (when org-export-remove-timestamps-from-toc
-    (while (string-match org-maybe-keyword-time-regexp s)
-      (setq s (replace-match "" t t s))))
-  (while (string-match org-bracket-link-regexp s)
-    (setq s (replace-match (match-string (if (match-end 3) 3 1) s)
-			   t t s)))
-  (while (string-match "\\[\\([0-9]\\|fn:[^]]*\\)\\]" s)
-    (setq s (replace-match "" t t s)))
-  s)
+    (while (string-match org-bracket-link-regexp s)
+      (setq s (replace-match (match-string (if (match-end 3) 3 1) s)
+			     t t s)))
+    (while (string-match "\\[\\([0-9]\\|fn:[^]]*\\)\\]" s)
+      (setq s (replace-match "" t t s)))
+    s))
 
 
 (defun org-get-text-property-any (pos prop &optional object)

+ 1 - 1
lisp/org-html.el

@@ -1704,7 +1704,7 @@ PUB-DIR is set, use this as the publishing directory."
 	    ;; This is a headline
 	    (setq level (org-tr-level (- (match-end 1) (match-beginning 1)
 					 level-offset))
-		  txt (match-string 2 org-line))
+		  txt (or (match-string 2 org-line) ""))
 	    (if (string-match quote-re0 txt)
 		(setq txt (replace-match "" t t txt)))
 	    (if (<= level (max umax umax-toc))