* [PATCH] Allow passing post-process to org-publish-org-to for use by org-export-to
@ 2014-02-12 7:00 Erik Hetzner
2014-02-12 13:02 ` Nicolas Goaziou
0 siblings, 1 reply; 5+ messages in thread
From: Erik Hetzner @ 2014-02-12 7:00 UTC (permalink / raw)
To: Org Mode
Hi,
I have been looking at publishing to HTML using pandoc. Because pandoc
requires post-processing to transform the org-mode markdown output to
other formats, it is necessary to use the post-process parameter of
org-export-to-file. Unfortunately, it is not currently possible to
pass post-process through to org-export-to-file via
org-publish-org-to. The attached patch allows this.
I think this patch makes sense; let me know what you think.
best, Erik
---
lisp/ox-publish.el | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lisp/ox-publish.el b/lisp/ox-publish.el
index 9669bf0..9840bb6 100644
--- a/lisp/ox-publish.el
+++ b/lisp/ox-publish.el
@@ -558,7 +558,7 @@ matching filenames."
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Tools for publishing functions in back-ends
-(defun org-publish-org-to (backend filename extension plist &optional pub-dir)
+(defun org-publish-org-to (backend filename extension plist &optional pub-dir post-process)
"Publish an Org file to a specified back-end.
BACKEND is a symbol representing the back-end used for
@@ -592,7 +592,8 @@ Return output file name."
`(:filter-final-output
,(cons 'org-publish-collect-numbering
(cons 'org-publish-collect-index
- (plist-get plist :filter-final-output))))))))
+ (plist-get plist :filter-final-output)))))
+ post-process)))
;; Remove opened buffer in the process.
(unless visitingp (kill-buffer work-buffer)))))
--
1.8.3.2
--
Sent from my free software system <http://fsf.org/>.
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Allow passing post-process to org-publish-org-to for use by org-export-to
2014-02-12 7:00 [PATCH] Allow passing post-process to org-publish-org-to for use by org-export-to Erik Hetzner
@ 2014-02-12 13:02 ` Nicolas Goaziou
2014-02-12 15:23 ` Erik Hetzner
0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2014-02-12 13:02 UTC (permalink / raw)
To: Erik Hetzner; +Cc: Org Mode
Hello,
Erik Hetzner <egh@e6h.org> writes:
> I have been looking at publishing to HTML using pandoc. Because pandoc
> requires post-processing to transform the org-mode markdown output to
> other formats, it is necessary to use the post-process parameter of
> org-export-to-file.
> I think this patch makes sense; let me know what you think.
Thanks for your patch.
Though, it is not necessary. `post-process' is meant for processing
after an asynchronous export (e.g., prepare a buffer in the current
process).
You're looking after a filter. See
(info "(org) Advanced configuration")
for more information.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Allow passing post-process to org-publish-org-to for use by org-export-to
2014-02-12 13:02 ` Nicolas Goaziou
@ 2014-02-12 15:23 ` Erik Hetzner
2014-02-12 22:55 ` Nicolas Goaziou
0 siblings, 1 reply; 5+ messages in thread
From: Erik Hetzner @ 2014-02-12 15:23 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: Org Mode
At Wed, 12 Feb 2014 14:02:12 +0100,
Nicolas Goaziou wrote:
>
> Hello,
>
> Erik Hetzner <egh@e6h.org> writes:
>
> > I have been looking at publishing to HTML using pandoc. Because pandoc
> > requires post-processing to transform the org-mode markdown output to
> > other formats, it is necessary to use the post-process parameter of
> > org-export-to-file.
>
> > I think this patch makes sense; let me know what you think.
>
> Thanks for your patch.
>
> Though, it is not necessary. `post-process' is meant for processing
> after an asynchronous export (e.g., prepare a buffer in the current
> process).
>
> You're looking after a filter. See
>
> (info "(org) Advanced configuration")
>
> for more information.
Hi Nicholas,
Thanks very much for your response (and ox.el)! I looked at filters,
but concluded they were not appropriate, because pandoc operates on
the file as a whole, and writes to a file, and can return binary
content (for example, if it is generating PDFs). It seemed equivalent
to the way that the latex exporter uses pdflatex to generate a PDF,
and the latex exported uses a post-process function.
I could be wrong, though. It would also be convenient to have access
to the info plist; in fact, I was going to write another email about
having access to the info plist in a post-process filter.
Is there a way to define a filter that operates on the entire content,
is guaranteed to run after everything else, and can handle binary
content? Thanks.
best, Erik
--
Sent from my free software system <http://fsf.org/>.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Allow passing post-process to org-publish-org-to for use by org-export-to
2014-02-12 15:23 ` Erik Hetzner
@ 2014-02-12 22:55 ` Nicolas Goaziou
2014-02-13 3:08 ` Erik Hetzner
0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2014-02-12 22:55 UTC (permalink / raw)
To: Erik Hetzner; +Cc: Org Mode
Erik Hetzner <egh@e6h.org> writes:
> Thanks very much for your response (and ox.el)! I looked at filters,
> but concluded they were not appropriate, because pandoc operates on
> the file as a whole, and writes to a file, and can return binary
> content (for example, if it is generating PDFs).
Then you're correct: filters won't help.
> It seemed equivalent to the way that the latex exporter uses pdflatex
> to generate a PDF, and the latex exported uses a post-process
> function.
Not really. If you look at `org-latex-publish-to-pdf' you will see that
publishing is done differently: the binary file is generated, then
published as an attachment.
> I could be wrong, though. It would also be convenient to have access
> to the info plist; in fact, I was going to write another email about
> having access to the info plist in a post-process filter.
>
> Is there a way to define a filter that operates on the entire content,
> is guaranteed to run after everything else, and can handle binary
> content? Thanks.
Sort of. `org-export-filter-final-output-functions' will get you the
final string, along with the info plist. You can use it to apply
modifications and generate the binary file. The original output can then
be discarded.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Allow passing post-process to org-publish-org-to for use by org-export-to
2014-02-12 22:55 ` Nicolas Goaziou
@ 2014-02-13 3:08 ` Erik Hetzner
0 siblings, 0 replies; 5+ messages in thread
From: Erik Hetzner @ 2014-02-13 3:08 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: Org Mode
At Wed, 12 Feb 2014 23:55:52 +0100,
Nicolas Goaziou wrote:
>
> Not really. If you look at `org-latex-publish-to-pdf' you will see that
> publishing is done differently: the binary file is generated, then
> published as an attachment.
Hi Nicolas,
Thanks so much for your help. This looks like exactly what I need.
best, Erik
--
Sent from my free software system <http://fsf.org/>.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-02-13 3:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-12 7:00 [PATCH] Allow passing post-process to org-publish-org-to for use by org-export-to Erik Hetzner
2014-02-12 13:02 ` Nicolas Goaziou
2014-02-12 15:23 ` Erik Hetzner
2014-02-12 22:55 ` Nicolas Goaziou
2014-02-13 3:08 ` Erik Hetzner
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).