emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [Feature Request] Let publishing-function decide :output-file and wh


From: Ruben Maher
Subject: [O] [Feature Request] Let publishing-function decide :output-file and whether publishing is needed
Date: Sat, 25 Jul 2015 18:08:16 +0930
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Hi list,

I've been working on a derived exporter to publish a static blog, and
I've run into some issues.  Say that `:publishing-directory' is
"~/public_html" and I have `:base-directory' with an Org file foo.org.

foo.org has option keywords like this:
#+title: foo.org
#+date: <2015-07-25 Sat 17:21:41>

My derived exporter visits each Org file to get information from the
keywords, and would export foo.org like so: foo.org ->
~/public_html/2015/07/25/foo/index.html, using something like

#+begin_src elisp
(let ((pub-dir
       (file-name-as-directory
        (concat (expand-file-name pub-dir)
                (format-time-string "%Y/%m/%d/" date)
                (file-name-base filename)))))
  (org-publish-org-to
   'rkm-html filename
   (concat "." (or (plist-get plist :html-extension)
                   org-html-extension "html"))
   (org-combine-plists plist '(:output-file "index")) pub-dir))
#+end_src

I have achieved this using the attached diff, which tells
`org-export-output-file-name' to respect the property `:output-file' in
the communications channel.

This works pretty well, except that now `org-publish-needed-p' will
always return t when called by `org-publish-file' in ox-publish.el.

As far as I can tell this would be less trivial to change.  The call to
org-publish-needed-p would have to move from here (in
`org-publish-file'):

#+begin_src elisp
;; Allow chain of publishing functions.
(dolist (f publishing-function)
  (when (org-publish-needed-p filename pub-dir f tmp-pub-dir base-dir)
    (let ((output (funcall f project-plist filename tmp-pub-dir)))
      (org-publish-update-timestamp filename pub-dir f base-dir)
      (run-hook-with-args 'org-publish-after-publishing-hook
                          filename
                          output))))
#+end_src

...to the actual publishing function.

I believe a change like this would go a ways to making publishing
backends more extensible for Org users.

Please tell me your thoughts.

Attachment: 0001-org-export-output-file-name-respect-output-file.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]