1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-29 07:58:21 +00:00

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.
This commit is contained in:
Eric Schulte 2011-02-10 09:59:34 -07:00
parent 840052b910
commit f9c833dad0

View File

@ -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