From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Guerry Subject: Re: Converting to html in a shell script Date: Thu, 13 Mar 2008 01:04:43 +0000 Message-ID: <87r6efl9hw.fsf@bzg.ath.cx> References: <20080312200141.4273426f@mistral.stie> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JZbsK-0001gw-P1 for emacs-orgmode@gnu.org; Wed, 12 Mar 2008 21:04:52 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JZbsJ-0001gd-3i for emacs-orgmode@gnu.org; Wed, 12 Mar 2008 21:04:52 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JZbsJ-0001ga-0V for emacs-orgmode@gnu.org; Wed, 12 Mar 2008 21:04:51 -0400 Received: from fg-out-1718.google.com ([72.14.220.154]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JZbsI-0004uH-GW for emacs-orgmode@gnu.org; Wed, 12 Mar 2008 21:04:50 -0400 Received: by fg-out-1718.google.com with SMTP id d23so3864340fga.30 for ; Wed, 12 Mar 2008 18:04:49 -0700 (PDT) In-Reply-To: <20080312200141.4273426f@mistral.stie> (lanas@securenet.net's message of "Wed, 12 Mar 2008 20:01:41 -0400") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: lanas Cc: emacs-orgmode@gnu.org lanas writes: > I would like to convert an org file to HTML, much like C-c C-e h > would do, automatically from a shell script. So far I've tried > unsuccesfully some permutaions of: > > emacs -batch -l ~/.emacs -eval '(org-export-as-html "./file.org")' > emacs -batch -l ~/.emacs -eval '(org-export-as-html)' ./file.org The function `org-export-as-html' doesn't take the file as an argument, it has to be called in the buffer where a file has been found. Look at the script for example: #!/bin/bash emacs -batch -eval \ "(progn (load-file \"~/org-mode/org.el\") \ (load-file \"~/elisp/config/org-batch-config.el\") \ (find-file \"~/yourfile.org\") \ (org-export-as-html 3))" I use org-batch-config.el because obviously I don't need to load all my Emacs config for running this script. But I think it's cleaner to define projects with org-publish and then to publish a project like: emacs -batch -eval "(progn (load \"~/org-mode/org.el\") \ (org-publish \"myproject\"))" HTH, -- Bastien