emacs-orgmode
[Top][All Lists]
Advanced

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

[Orgmode] [OT] Exporting org files to html from outside GNU Emacs


From: Emanuele Santoro
Subject: [Orgmode] [OT] Exporting org files to html from outside GNU Emacs
Date: Sat, 18 Dec 2010 02:22:26 +0100
User-agent: Mutt/1.5.20 (2009-06-14)

I'll be a little OT, I'm sorry.

Hello people,
I'm writing a sort of wiki software, and i want it to use Org-Mode's
syntax for its documents.
Thus, I'd need to have some code to export org files to HTML.
Something like a library for Php or Perl.
Is anyone planning to write something like that?

Now, in the meantime, it's ok for me to use an underlying emacs for do
the html export, via the org-export-as-html-batch function.
I can export org-files by calling, in Perl:

my $args = '/usr/bin/emacs -q --batch ' .
    "--visit=$DOCUMENT " .
    '--funcall org-export-as-html-batch '.
    ">/dev/null 2>&1";

(I know it's ugly code, but it's still a draft)

It works, but it's damned slow since it has to spawn a new full emacs
process each time.

Since I usually use emacs in daemon mode, I then tried to use my
emacsclient to export org files, writing this silly function:

(defun batch-export-file (orgdoc)
  "open and export an file"
  (interactive "")
  (save-excursion 
    (find-file orgdoc)
    (set-buffer (file-name-nondirectory orgdoc))
    (org-export-as-html-batch)
    (write-file 
     (concat 
      (file-name-directory org-doc) 
      "/" 
      (file-name-sans-extension (file-name-nondirectory org-doc))))))

As you can see, I'm not a proficient elisp programmer.
The aim is to run emacsclient -e "(batch-export-file $my_file_path)",
but still it isn't fully working. 
Any idea on how to improve it?

Sorry for being OT and thanks in advance.

Cheers,
--
Emanuele Santoro

Attachment: signature.asc
Description: Digital signature


reply via email to

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