emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Emanuele Santoro <santoro@autistici.org>
To: emacs-orgmode@gnu.org
Subject: [OT] Exporting org files to html from outside GNU Emacs
Date: Sat, 18 Dec 2010 02:22:26 +0100	[thread overview]
Message-ID: <9360.34962437606$1292637343@news.gmane.org> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1538 bytes --]

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 #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

             reply	other threads:[~2010-12-18  1:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-18  1:22 Emanuele Santoro [this message]
     [not found] <5103105833544608553@unknownmsgid>
2010-12-18  2:38 ` [OT] Exporting org files to html from outside GNU Emacs Jeff Horn
2010-12-18  8:52   ` Sébastien Vauban
2010-12-21  5:04   ` Puneeth
2010-12-21  7:47     ` Jeff Horn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='9360.34962437606$1292637343@news.gmane.org' \
    --to=santoro@autistici.org \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).