emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Converting to html in a shell script
@ 2008-03-13  0:01 lanas
  2008-03-13  1:04 ` Bastien Guerry
  2008-03-13 17:36 ` Michael Hohn
  0 siblings, 2 replies; 3+ messages in thread
From: lanas @ 2008-03-13  0:01 UTC (permalink / raw)
  To: emacs-orgmode

Hi all,

  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

  Is it at all possible and if so, what would be the actual way of
calling emacs to do this ?

Thanks,

Al

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Converting to html in a shell script
  2008-03-13  0:01 Converting to html in a shell script lanas
@ 2008-03-13  1:04 ` Bastien Guerry
  2008-03-13 17:36 ` Michael Hohn
  1 sibling, 0 replies; 3+ messages in thread
From: Bastien Guerry @ 2008-03-13  1:04 UTC (permalink / raw)
  To: lanas; +Cc: emacs-orgmode

lanas <lanas@securenet.net> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Converting to html in a shell script
  2008-03-13  0:01 Converting to html in a shell script lanas
  2008-03-13  1:04 ` Bastien Guerry
@ 2008-03-13 17:36 ` Michael Hohn
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Hohn @ 2008-03-13 17:36 UTC (permalink / raw)
  To: lanas; +Cc: emacs-orgmode

lanas wrote:
> Hi all,
>
>   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
>
>   Is it at all possible and if so, what would be the actual way of
> calling emacs to do this ?
>
>   

I use a makefile entry

%.html: %.org org-export-cust.el
    emacs --batch -q $< -l ./org-export-cust.el
    tidy -i -m $@


together with this org-export-cust.el script:

;; Batch script to convert %.org to %.html, with external style sheet
;; and other options.
;;
;; Used via     emacs --batch -q $< -l ./org-export-cust.el
;;
(load-library "~/emacs/lisp/org.elc")

(setq org-export-html-style
      "<link rel=stylesheet href=\"l3style.css\" type=\"text/css\">")

(org-export-as-html 3 'hidden)

-- Michael

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-03-13 17:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-13  0:01 Converting to html in a shell script lanas
2008-03-13  1:04 ` Bastien Guerry
2008-03-13 17:36 ` Michael Hohn

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).