Browse Source

ox-publish: Fix small bug

* lisp/ox-publish.el (org-publish-cache-file-needs-publishing): Find
  included file even if keyword is indented.
Nicolas Goaziou 11 years ago
parent
commit
6062f9ea72
1 changed files with 11 additions and 7 deletions
  1. 11 7
      lisp/ox-publish.el

+ 11 - 7
lisp/ox-publish.el

@@ -1161,22 +1161,26 @@ the file including them will be republished as well."
 	 (org-inhibit-startup t)
 	 (visiting (find-buffer-visiting filename))
 	 included-files-ctime buf)
-
     (when (equal (file-name-extension filename) "org")
       (setq buf (find-file (expand-file-name filename)))
       (with-current-buffer buf
 	(goto-char (point-min))
-	(while (re-search-forward
-		"^#\\+INCLUDE:[ \t]+\"\\([^\t\n\r\"]*\\)\"[ \t]*.*$" nil t)
-	  (let* ((included-file (expand-file-name (match-string 1))))
-	    (add-to-list 'included-files-ctime
-			 (org-publish-cache-ctime-of-src included-file) t))))
+	(while (re-search-forward "^[ \t]*#\\+INCLUDE:" nil t)
+	  (let* ((element (org-element-at-point))
+		 (included-file
+		  (and (eq (org-element-type element) 'keyword)
+		       (org-string-nw-p (org-element-property :value element)))))
+	    (when included-file
+	      (add-to-list 'included-files-ctime
+			   (org-publish-cache-ctime-of-src
+			    (expand-file-name included-file))
+			   t)))))
       (unless visiting (kill-buffer buf)))
     (if (null pstamp) t
       (let ((ctime (org-publish-cache-ctime-of-src filename)))
 	(or (< pstamp ctime)
 	    (when included-files-ctime
-	      (not (null (delq nil (mapcar (lambda(ct) (< ctime ct))
+	      (not (null (delq nil (mapcar (lambda (ct) (< ctime ct))
 					   included-files-ctime))))))))))
 
 (defun org-publish-cache-set-file-property