emacs-orgmode
[Top][All Lists]
Advanced

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

Re: how to export an org file, to 2 different locations (in to different


From: Juan Manuel Macías
Subject: Re: how to export an org file, to 2 different locations (in to different formats)
Date: Fri, 27 May 2022 18:42:53 +0000

Hi Uwe,

Uwe Brauer writes:

> Hi
>
> Currently I use 
> #+EXPORT_FILE_NAME: /home/oub/Desktop/some-stuff.html
>
> To export my org file in html format to that location.
>
> But I would also like to export it as a latex file to a different
> location, without modifying the above line, or to be more precise to add
> a different location, like
>
>     1. if export to latex use that folder
>
>     2. If export to html use this folder
>
> Anybody know about such a functionality?
>
> Thanks and regards
>
> Uwe Brauer 

One (pedestrian) way to achieve it, with this function:

(defun my-org/export-to-path (backend export-path extension)
  (org-element-map (org-element-parse-buffer) 'keyword
    (lambda (k)
      (when (string= (org-element-property :key k) "EXPORT_FILE_NAME")
        (let ((value (org-element-property :value k)))
          (org-export-to-file backend
              (format
               "%s%s.%s"
               export-path
               value extension)))))))

And then you could evaluate it inside a block in your document, with the
chosen arguments. For example:

#+EXPORT_FILE_NAME: myfile

#+begin_src emacs-lisp :exports none :eval never-export :results silent
  (my-org/export-to-path 'html "~/Desktop/" "html")
#+end_src

Best regards,

Juan Manuel 



reply via email to

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