summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2012-10-08 14:20:56 +0200
committerNicolas Goaziou <n.goaziou@gmail.com>2012-10-08 14:27:08 +0200
commit9109dc13ea692e9d89e72bdde4280f6342397079 (patch)
tree3dd12bb4a98ed54bb535ff06fe10300e8636bd3b
parent19a28c552894e1cd83af10a0ccbbe021e339954a (diff)
downloadorg-mode-9109dc13ea692e9d89e72bdde4280f6342397079.tar.gz
org-e-publish: Move publishing functions into back-end libraries
* contrib/lisp/org-e-ascii.el (org-e-ascii-publish-to-ascii, org-e-ascii-publish-to-latin1, org-e-ascii-publish-to-utf8): New functions. * contrib/lisp/org-e-html.el (org-e-html-publish-to-html): New function. * contrib/lisp/org-e-latex.el (org-e-latex-publish-to-latex, org-e-latex-publish-to-pdf): New functions. * contrib/lisp/org-e-publish.el (org-e-publish-org-to-latex, org-e-publish-org-to-pdf, org-e-publish-org-to-ascii, org-e-publish-org-to-latin1, org-e-publish-org-to-utf8, org-e-publish-org-to-html): Remove functions. Each back-end can define its own publishing functions. This patch avoids to clutter org-e-publish.el.
-rw-r--r--contrib/lisp/org-e-ascii.el39
-rw-r--r--contrib/lisp/org-e-html.el14
-rw-r--r--contrib/lisp/org-e-latex.el30
-rw-r--r--contrib/lisp/org-e-publish.el84
4 files changed, 81 insertions, 86 deletions
diff --git a/contrib/lisp/org-e-ascii.el b/contrib/lisp/org-e-ascii.el
index 5ebd3b0..c5759b7 100644
--- a/contrib/lisp/org-e-ascii.el
+++ b/contrib/lisp/org-e-ascii.el
@@ -37,6 +37,7 @@
(eval-when-compile (require 'cl))
(require 'org-export)
+(require 'org-e-publish)
(declare-function aa2u "ext:ascii-art-to-unicode" ())
@@ -1794,7 +1795,7 @@ This function only applies to `e-ascii' back-end. See
-;;; Interactive function
+;;; End-user functions
;;;###autoload
(defun org-e-ascii-export-as-ascii
@@ -1864,6 +1865,42 @@ Return output file's name."
(org-export-to-file
'e-ascii outfile subtreep visible-only body-only ext-plist)))
+;;;###autoload
+(defun org-e-ascii-publish-to-ascii (plist filename pub-dir)
+ "Publish an Org file to ASCII.
+
+FILENAME is the filename of the Org file to be published. PLIST
+is the property list for the given project. PUB-DIR is the
+publishing directory.
+
+Return output file name."
+ (org-e-publish-org-to
+ 'e-ascii filename ".txt" `(:ascii-charset ascii ,@plist) pub-dir))
+
+;;;###autoload
+(defun org-e-ascii-publish-to-latin1 (plist filename pub-dir)
+ "Publish an Org file to Latin-1.
+
+FILENAME is the filename of the Org file to be published. PLIST
+is the property list for the given project. PUB-DIR is the
+publishing directory.
+
+Return output file name."
+ (org-e-publish-org-to
+ 'e-ascii filename ".txt" `(:ascii-charset latin1 ,@plist) pub-dir))
+
+;;;###autoload
+(defun org-e-ascii-publish-to-utf8 (plist filename pub-dir)
+ "Publish an org file to UTF-8.
+
+FILENAME is the filename of the Org file to be published. PLIST
+is the property list for the given project. PUB-DIR is the
+publishing directory.
+
+Return output file name."
+ (org-e-publish-org-to
+ 'e-ascii filename ".txt" `(:ascii-charset utf-8 ,@plist) pub-dir))
+
(provide 'org-e-ascii)
;;; org-e-ascii.el ends here
diff --git a/contrib/lisp/org-e-html.el b/contrib/lisp/org-e-html.el
index 87741b0..fcdf006 100644
--- a/contrib/lisp/org-e-html.el
+++ b/contrib/lisp/org-e-html.el
@@ -36,6 +36,7 @@
;;; Dependencies
(require 'org-export)
+(require 'org-e-publish)
(require 'format-spec)
(eval-when-compile (require 'cl) (require 'table))
@@ -2806,7 +2807,7 @@ contextual information."
(buffer-substring-no-properties (point-min) (point-max)))))
-;;; Interactive functions
+;;; End-user functions
;;;###autoload
(defun org-e-html-export-as-html
@@ -2880,6 +2881,17 @@ Return output file's name."
(org-export-to-file
'e-html file subtreep visible-only body-only ext-plist)))
+;;;###autoload
+(defun org-e-html-publish-to-html (plist filename pub-dir)
+ "Publish an org file to HTML.
+
+FILENAME is the filename of the Org file to be published. PLIST
+is the property list for the given project. PUB-DIR is the
+publishing directory.
+
+Return output file name."
+ (org-e-publish-org-to 'e-html filename ".html" plist pub-dir))
+
;;; FIXME
diff --git a/contrib/lisp/org-e-latex.el b/contrib/lisp/org-e-latex.el
index b90a097..80b8ddb 100644
--- a/contrib/lisp/org-e-latex.el
+++ b/contrib/lisp/org-e-latex.el
@@ -37,6 +37,7 @@
(eval-when-compile (require 'cl))
(require 'org-export)
+(require 'org-e-publish)
(defvar org-export-latex-default-packages-alist)
(defvar org-export-latex-packages-alist)
@@ -2556,7 +2557,7 @@ contextual information."
-;;; Interactive functions
+;;; End-user functions
;;;###autoload
(defun org-e-latex-export-as-latex
@@ -2734,6 +2735,33 @@ none."
(setq errors (concat errors " " (cdr latex-error)))))
(and (org-string-nw-p errors) (org-trim errors)))))))
+;;;###autoload
+(defun org-e-latex-publish-to-latex (plist filename pub-dir)
+ "Publish an Org file to LaTeX.
+
+FILENAME is the filename of the Org file to be published. PLIST
+is the property list for the given project. PUB-DIR is the
+publishing directory.
+
+Return output file name."
+ (org-e-publish-org-to 'e-latex filename ".tex" plist pub-dir))
+
+;;;###autoload
+(defun org-e-latex-publish-to-pdf (plist filename pub-dir)
+ "Publish an Org file to PDF (via LaTeX).
+
+FILENAME is the filename of the Org file to be published. PLIST
+is the property list for the given project. PUB-DIR is the
+publishing directory.
+
+Return output file name."
+ ;; Unlike to `org-e-latex-publish-to-latex', PDF file is generated
+ ;; in working directory and then moved to publishing directory.
+ (org-e-publish-attachment
+ plist
+ (org-e-latex-compile (org-e-publish-org-to 'e-latex filename ".tex" plist))
+ pub-dir))
+
(provide 'org-e-latex)
;;; org-e-latex.el ends here
diff --git a/contrib/lisp/org-e-publish.el b/contrib/lisp/org-e-publish.el
index 49e3551..efe2073 100644
--- a/contrib/lisp/org-e-publish.el
+++ b/contrib/lisp/org-e-publish.el
@@ -538,7 +538,7 @@ matching filenames."
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; Pluggable publishing back-end functions
+;;; Tools for publishing functions in back-ends
(defun org-e-publish-org-to (backend filename extension plist &optional pub-dir)
"Publish an Org file to a specified back-end.
@@ -574,88 +574,6 @@ Return output file name."
(unless visitingp (kill-buffer work-buffer)))))
(defvar project-plist)
-(defun org-e-publish-org-to-latex (plist filename pub-dir)
- "Publish an Org file to LaTeX.
-
-FILENAME is the filename of the Org file to be published. PLIST
-is the property list for the given project. PUB-DIR is the
-publishing directory.
-
-Return output file name."
- (require 'org-e-latex nil t)
- (org-e-publish-org-to 'e-latex filename ".tex" plist pub-dir))
-
-(defun org-e-publish-org-to-pdf (plist filename pub-dir)
- "Publish an Org file to PDF \(via LaTeX).
-
-FILENAME is the filename of the Org file to be published. PLIST
-is the property list for the given project. PUB-DIR is the
-publishing directory.
-
-Return output file name."
- (require 'org-e-latex nil t)
- ;; Unlike to `org-e-publish-org-to-latex', PDF file is generated in
- ;; working directory and then moved to publishing directory.
- (org-e-publish-attachment
- plist
- (org-e-latex-compile (org-e-publish-org-to 'e-latex filename ".tex" plist))
- pub-dir))
-
-(defun org-e-publish-org-to-html (plist filename pub-dir)
- "Publish an org file to HTML.
-
-FILENAME is the filename of the Org file to be published. PLIST
-is the property list for the given project. PUB-DIR is the
-publishing directory.
-
-Return output file name."
- (require 'org-e-html nil t)
- (org-e-publish-org-to 'e-html filename ".html" plist pub-dir))
-
-;; TODO: Not implemented yet.
-;; (defun org-e-publish-org-to-org (plist filename pub-dir)
-;; "Publish an org file to HTML.
-;;
-;; FILENAME is the filename of the Org file to be published. PLIST
-;; is the property list for the given project. PUB-DIR is the
-;; publishing directory.
-;;
-;; Return output file name."
-;; (org-e-publish-org-to "org" plist filename pub-dir))
-
-(defun org-e-publish-org-to-ascii (plist filename pub-dir)
- "Publish an Org file to ASCII.
-
-FILENAME is the filename of the Org file to be published. PLIST
-is the property list for the given project. PUB-DIR is the
-publishing directory.
-
-Return output file name."
- (require 'org-e-ascii nil t)
- (org-e-publish-org-to
- 'e-ascii filename ".txt" `(:ascii-charset ascii ,@plist) pub-dir))
-
-(defun org-e-publish-org-to-latin1 (plist filename pub-dir)
- "Publish an Org file to Latin-1.
-
-FILENAME is the filename of the Org file to be published. PLIST
-is the property list for the given project. PUB-DIR is the
-publishing directory.
-
-Return output file name."
- (org-e-publish-org-to
- 'e-ascii filename ".txt" `(:ascii-charset latin1 ,@plist) pub-dir))
-
-(defun org-e-publish-org-to-utf8 (plist filename pub-dir)
- "Publish an org file to UTF-8.
-
-FILENAME is the filename of the Org file to be published. PLIST
-is the property list for the given project. PUB-DIR is the
-publishing directory.
-
-Return output file name."
- (org-e-publish-org-to
- 'e-ascii filename ".txt" `(:ascii-charset utf-8 ,@plist) pub-dir))
(defun org-e-publish-attachment (plist filename pub-dir)
"Publish a file with no transformation of any kind.