From f9c833dad015b7847f659e06bac8690b9d7d3794 Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Thu, 10 Feb 2011 09:59:34 -0700 Subject: [PATCH] org-exp-blocks: deprecating begin_dot and begin_ditaa blocks, will be removed soon * lisp/org-exp-blocks.el (org-export-blocks-format-ditaa): This function is begin deprecated in favor of begin_src blocks. (org-export-blocks-format-dot): This function is begin deprecated in favor of begin_src blocks. --- lisp/org-exp-blocks.el | 56 +++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/lisp/org-exp-blocks.el b/lisp/org-exp-blocks.el index 57087e1df..498322769 100644 --- a/lisp/org-exp-blocks.el +++ b/lisp/org-exp-blocks.el @@ -48,13 +48,15 @@ ;; ;;; Currently Implemented Block Types ;; -;; ditaa :: Convert ascii pictures to actual images using ditaa +;; ditaa :: (DEPRECATED--use "#+begin_src ditaa" code blocks) Convert +;; ascii pictures to actual images using ditaa ;; http://ditaa.sourceforge.net/. To use this set ;; `org-ditaa-jar-path' to the path to ditaa.jar on your ;; system (should be set automatically in most cases) . ;; -;; dot :: Convert graphs defined using the dot graphing language to -;; images using the dot utility. For information on dot see +;; dot :: (DEPRECATED--use "#+begin_src dot" code blocks) Convert +;; graphs defined using the dot graphing language to images +;; using the dot utility. For information on dot see ;; http://www.graphviz.org/ ;; ;; comment :: Wrap comments with titles and author information, in @@ -218,11 +220,13 @@ which defaults to the value of `org-export-blocks-witheld'." "Path to the ditaa jar executable.") (defun org-export-blocks-format-ditaa (body &rest headers) - "Pass block BODY to the ditaa utility creating an image. + "DEPRECATED: use begin_src ditaa code blocks + +Pass block BODY to the ditaa utility creating an image. Specify the path at which the image should be saved as the first element of headers, any additional elements of headers will be passed to the ditaa utility as command line arguments." - (message "ditaa-formatting...") + (message "begin_ditaa blocks are DEPRECATED, use begin_src blocks") (let* ((args (if (cdr headers) (mapconcat 'identity (cdr headers) " "))) (data-file (make-temp-file "org-ditaa")) (hash (progn @@ -241,6 +245,7 @@ passed to the ditaa utility as command line arguments." (mapconcat (lambda (x) (substring x (if (> (length x) 1) 2 1))) (org-split-string body "\n") "\n"))) + (prog1 (cond ((or htmlp latexp docbookp) (unless (file-exists-p out-file) @@ -262,13 +267,16 @@ passed to the ditaa utility as command line arguments." (t (concat "\n#+BEGIN_EXAMPLE\n" body (if (string-match "\n$" body) "" "\n") - "#+END_EXAMPLE\n"))))) + "#+END_EXAMPLE\n"))) + (message "begin_ditaa blocks are DEPRECATED, use begin_src blocks")))) ;;-------------------------------------------------------------------------------- ;; dot: create graphs using the dot graphing language ;; (require the dot executable to be in your path) (defun org-export-blocks-format-dot (body &rest headers) - "Pass block BODY to the dot graphing utility creating an image. + "DEPRECATED: use \"#+begin_src dot\" code blocks + +Pass block BODY to the dot graphing utility creating an image. Specify the path at which the image should be saved as the first element of headers, any additional elements of headers will be passed to the dot utility as command line arguments. Don't @@ -284,7 +292,7 @@ digraph data_relationships { \"data_requirement\" -> \"data_product\" } #+end_dot" - (message "dot-formatting...") + (message "begin_dot blocks are DEPRECATED, use begin_src blocks") (let* ((args (if (cdr headers) (mapconcat 'identity (cdr headers) " "))) (data-file (make-temp-file "org-ditaa")) (hash (progn @@ -296,28 +304,30 @@ digraph data_relationships { (match-string 2 raw-out-file)) (cons raw-out-file "png"))) (out-file (concat (car out-file-parts) "_" hash "." (cdr out-file-parts)))) + (prog1 (cond ((or htmlp latexp docbookp) (unless (file-exists-p out-file) - (mapc ;; remove old hashed versions of this file - (lambda (file) - (when (and (string-match (concat (regexp-quote (car out-file-parts)) - "_\\([[:alnum:]]+\\)\\." - (regexp-quote (cdr out-file-parts))) - file) - (= (length (match-string 1 out-file)) 40)) - (delete-file (expand-file-name file - (file-name-directory out-file))))) - (directory-files (or (file-name-directory out-file) - default-directory))) - (with-temp-file data-file (insert body)) - (message (concat "dot " data-file " " args " -o " out-file)) - (shell-command (concat "dot " data-file " " args " -o " out-file))) + (mapc ;; remove old hashed versions of this file + (lambda (file) + (when (and (string-match (concat (regexp-quote (car out-file-parts)) + "_\\([[:alnum:]]+\\)\\." + (regexp-quote (cdr out-file-parts))) + file) + (= (length (match-string 1 out-file)) 40)) + (delete-file (expand-file-name file + (file-name-directory out-file))))) + (directory-files (or (file-name-directory out-file) + default-directory))) + (with-temp-file data-file (insert body)) + (message (concat "dot " data-file " " args " -o " out-file)) + (shell-command (concat "dot " data-file " " args " -o " out-file))) (format "\n[[file:%s]]\n" out-file)) (t (concat "\n#+BEGIN_EXAMPLE\n" body (if (string-match "\n$" body) "" "\n") - "#+END_EXAMPLE\n"))))) + "#+END_EXAMPLE\n"))) + (message "begin_dot blocks are DEPRECATED, use begin_src blocks")))) ;;-------------------------------------------------------------------------------- ;; comment: export comments in author-specific css-stylable divs