7

I use org-publish to publish HTML exports of org-mode files quite often to share documents with my coworkers, however, I generate a lot of diagrams with plantuml and gnuplot. These diagrams aren't sent to the remote server when I export the file with C-c C-e P f.

My configuration looks like:

("org-pastebin"
 :base-directory "~/org/"
 :base-extension "org\\|zsh\\|html\\|png"
 :publishing-directory "/ssh:user@server:~/public_html/org/"
 :publishing-function org-html-publish-to-html
 :with-toc t
 :html-preamble t)

If I have an org-mode file that looks like:

* Header
Some prose

#+BEGIN_SRC plantuml :file my-file.png :results raw
...
#+END_SRC

#+RESULTS:
[[file:my-file.png]]

How can I get Emacs to automatically publish the linked file (my-file.png) in this case? Even if I publish the whole project the images are not copied.

7

In order to publish projects consisting of multiple file types I add the following to my .emacs file:

(setq org-publish-project-alist
  '(("myprojectorg"
     :base-directory "~/path/to/myproject/"
     :publishing-directory "/ssh:user@server:~/public_html/myproject/"
     :publishing-function org-html-publish-to-html
     :auto-preamble t
     )
    ("myprojectother"
     :base-directory "~/path/to/myproject/"
     :base-extension "css\\|pdf\\|sh"
     :publishing-directory "/ssh:user@server:~/public_html/myproject"
     :publishing-function org-publish-attachment
     )
    ("myprojectimages"
     :base-directory "~/path/to/myproject/images"
     :base-extension "png\\|jpg"
     :publishing-directory "/ssh:user@server:~/public_html/myproject/images"
     :publishing-function org-publish-attachment
     )
    ("myprojectweb" :components("myprojectorg" "myprojectother" "myprojectimages"))
   )
)

This defines an entry myprojectweb which I use when publishing from org-mode using C-c C-e P x. This myprojectweb consists of:

  • the org file(s) as defined in myprojectorg,
  • image files as defined in myprojectimages (which are in a subdirectory), and
  • other files (in this case PDFs, CSS files and shell scripts), which are defined in myprojectother.

These last two entries are published using org-publish-attachment which does nothing but copy the files to the publishing-directory.

  • Tested this and it works great, thanks! – Lee H Oct 2 '14 at 10:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.