Export Org-mode files as editable web pages -*- org -*-
You will need Emacs 24 or later, and recent versions of elnode and Org-mode which are available from http://nicferrier.github.com/elnode/ and http://orgmode.org/org-mode-download.html respectively.
- Optionally install with ELPA from the marmalade repository
http://marmalade-repo.org/packages/org-ehtml.
(mapc (lambda (package) (add-to-list 'package-archives package)) '(("org" . "http://orgmode.org/elpa/") ("marmalade" . "http://marmalade-repo.org/packages/"))) (unless (package-installed-p 'org-ehtml) (package-install 'org-ehtml))
- Run the tests to make sure everything is working.
(require 'test-org-ehtml) (ert "org-ehtml")
- Set the root of your directory of Org-mode files. For now we’ll
just use the example files used in the tests, later you can
customize this variable.
(setq org-ehtml-docroot test-org-ehtml-example-dir)
- Start up elnode.
(elnode-start 'org-ehtml-handler :port 8888)
- Point your browser to http://localhost:8888/simple.org and move your mouse over the page. Editable portions of the page will be highlighted, click on these to edit.
Warning: Be sure you backup your files before you start editing them through this experimental web interface as it could trash your files.
(require 'org-ehtml)
;; Configure the server
(setq
org-ehtml-everything-editable t
org-ehtml-docroot "~/path/to/your/files"
my-org-ehtml-port 3333
)
;; Start the server
(elnode-start 'org-ehtml-handler :port my-org-ehtml-port)
;; Stop the server
;; (elnode-stop my-org-ehtml-port)
To enable user authentication replace the ‘org-ehtml-handler elnode handler with the ‘org-ehtml-auth-handler from src/org-ehtml-auth.el.
This may no longer work due to changes in elnode.
Warning: This could screw up your version control system as well as your flat files.
org-ehtml provides an org-ehtml-after-save-hook which can be used to commit all changes to a local version control system.
(require 'vc)
(add-hook
'org-ehtml-after-save-hook
(lambda ()
(let ((file (buffer-file-name (current-buffer))))
(vc-checkin (list file) (vc-backend file) nil "edit through org-ehtml"))))
Using the Makefile is not required in any way. However, it may be used to either compile the Emacs Lisp source, or to run a simple web server. To do so, set ORGMODE and ELNODE environment variables to point to the development directories of Org-mode and elnode. You can then run “make” to build the Emacs Lisp source or run “make example” to launch an example web server.
Specifically Version 21.0.1180.79 (151411) of chrome sends empty text fields to the server resulting in the deletion of the edited portion of the Org-mode file.
This is due to Chrome’s miss-evaluation of line 14 or so of src/ox-ehtml.js.