瀏覽代碼

Remove text properties of body before calculating cache hash.

* org-exp-blocks.el (org-export-blocks-format-ditaa)
(org-export-blocks-format-dot): Remove text properties of body before
calculating cache hash.

Otherwise one and the same ditta/graphviz image has a different hash
depending on the text properties of the body.
E.g. `org-export-region-as-html' with target buffer 'string passed the
body of the block without possible indentation property `wrap-prefix'
while `org-export-as-html' does.
David Maus 14 年之前
父節點
當前提交
d044ad3f1c
共有 1 個文件被更改,包括 18 次插入14 次删除
  1. 18 14
      lisp/org-exp-blocks.el

+ 18 - 14
lisp/org-exp-blocks.el

@@ -227,13 +227,15 @@ passed to the ditaa utility as command line arguments."
   (message "ditaa-formatting...")
   (let* ((args (if (cdr headers) (mapconcat 'identity (cdr headers) " ")))
          (data-file (make-temp-file "org-ditaa"))
-         (hash (sha1 (prin1-to-string (list body args))))
-         (raw-out-file (if headers (car headers)))
-         (out-file-parts (if (string-match "\\(.+\\)\\.\\([^\\.]+\\)$" raw-out-file)
-                             (cons (match-string 1 raw-out-file)
-                                   (match-string 2 raw-out-file))
-                           (cons raw-out-file "png")))
-         (out-file (concat (car out-file-parts) "_" hash "." (cdr out-file-parts))))
+	 (hash (progn
+		 (set-text-properties 0 (length body) nil body)
+		 (sha1 (prin1-to-string (list body args)))))
+	 (raw-out-file (if headers (car headers)))
+	 (out-file-parts (if (string-match "\\(.+\\)\\.\\([^\\.]+\\)$" raw-out-file)
+			     (cons (match-string 1 raw-out-file)
+				   (match-string 2 raw-out-file))
+			   (cons raw-out-file "png")))
+	 (out-file (concat (car out-file-parts) "_" hash "." (cdr out-file-parts))))
     (unless (file-exists-p org-ditaa-jar-path)
       (error (format "Could not find ditaa.jar at %s" org-ditaa-jar-path)))
     (setq body (if (string-match "^\\([^:\\|:[^ ]\\)" body)
@@ -287,13 +289,15 @@ digraph data_relationships {
   (message "dot-formatting...")
   (let* ((args (if (cdr headers) (mapconcat 'identity (cdr headers) " ")))
          (data-file (make-temp-file "org-ditaa"))
-         (hash (sha1 (prin1-to-string (list body args))))
-         (raw-out-file (if headers (car headers)))
-         (out-file-parts (if (string-match "\\(.+\\)\\.\\([^\\.]+\\)$" raw-out-file)
-                             (cons (match-string 1 raw-out-file)
-                                   (match-string 2 raw-out-file))
-                           (cons raw-out-file "png")))
-         (out-file (concat (car out-file-parts) "_" hash "." (cdr out-file-parts))))
+	 (hash (progn
+		 (set-text-properties 0 (length body) nil body)
+		 (sha1 (prin1-to-string (list body args)))))
+	 (raw-out-file (if headers (car headers)))
+	 (out-file-parts (if (string-match "\\(.+\\)\\.\\([^\\.]+\\)$" raw-out-file)
+			     (cons (match-string 1 raw-out-file)
+				   (match-string 2 raw-out-file))
+			   (cons raw-out-file "png")))
+	 (out-file (concat (car out-file-parts) "_" hash "." (cdr out-file-parts))))
     (cond
      ((or htmlp latexp docbookp)
       (unless (file-exists-p out-file)